Exemple #1
0
 /**
  * @inheritdoc
  * Yet another deviation form description.
  * While it keeps the contract, a Functor return, it requires $functor to be a MultipleStaticCreation implementor
  * in order to stay true to the Functor Type. Otherwise it substitutes itself, which can be seen as a Group
  * of Monads. In a strict language, it would make sense to only allow apply on its own kind, however
  * because of PHP's poor typing system, and the implications of having needlessly nested items,
  * the result is flattened.
  * @return MultipleStaticCreation
  */
 public function apply(FunctorInterface $functor)
 {
     $output = [];
     foreach (I($this->hash) as $hof) {
         foreach ($functor->map(__CONTRACT__::contentIsACallable($hof)) as $value) {
             $output[] = $value;
         }
     }
     return $functor instanceof MultipleStaticCreation ? $functor::from($output) : new static($output);
 }
 /**
  * @covers ::contentIsACallable
  * @dataProvider notCallableProvider
  */
 public function test_contentIsACallable_exception($notCallable)
 {
     $this->expectException(invalidContent::class);
     contract::contentIsACallable($notCallable);
 }