Mixin.php 791 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of the Carbon package.
  5. *
  6. * (c) Brian Nesbitt <brian@nesbot.com>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace Tests\CarbonInterval\Fixtures;
  12. use Carbon\CarbonInterval;
  13. class Mixin
  14. {
  15. public $factor;
  16. public function setFactor()
  17. {
  18. $mixin = $this;
  19. return function ($factor) use ($mixin) {
  20. $mixin->factor = $factor;
  21. };
  22. }
  23. public function doMultiply()
  24. {
  25. $mixin = $this;
  26. return function () use ($mixin) {
  27. /** @var CarbonInterval $interval */
  28. $interval = $this;
  29. return $interval->times($mixin->factor);
  30. };
  31. }
  32. }