1: <?php
2:
3: namespace Chromabits\Nucleus\Control\Traits;
4:
5: use Chromabits\Nucleus\Control\Interfaces\ApplyInterface;
6: use Chromabits\Nucleus\Control\Interfaces\ChainInterface;
7:
8: /**
9: * Class ChainTrait
10: *
11: * @method bind(callable $other)
12: *
13: * @author Eduardo Trujillo <ed@chromabits.com>
14: * @package Chromabits\Nucleus\Control\Traits
15: */
16: trait ChainTrait
17: {
18: /**
19: * @param ApplyInterface $other
20: *
21: * @return ChainInterface
22: */
23: public function ap(ApplyInterface $other)
24: {
25: return $this->bind(function (callable $closure) use ($other) {
26: return $other->fmap($closure);
27: });
28: }
29: }
30: