示例#1
0
 /**
  * adds it to $this->notSatisfied if it does not match
  * 
  * @param  Specification $specification 
  * @param  mixed         $object   
  * @param  array         &[$notSatisfied] (optional) array to contain the not satisfiedBy @array<Specification)
  * @return void
  */
 protected function appendIfNotSatisfiedBy($specification, $object, array &$notSatisfied = [])
 {
     if (!$specification->isSatisfiedBy($object)) {
         if ($specification instanceof AbstractCombinationSpecification) {
             $notSatisfied = array_merge($notSatisfied, $specification->getSpecificationsNotSatisfiedBy($object));
         } else {
             $notSatisfied[] = $specification;
         }
     }
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function isSatisfiedBy($candidate) : bool
 {
     return $this->firstSpec->isSatisfiedBy($candidate) && $this->secondSpec->isSatisfiedBy($candidate);
 }
 /**
  * @param mixed $object
  * @return bool
  */
 public function isSatisfiedBy($object)
 {
     return !$this->specification->isSatisfiedBy($object);
 }
示例#4
0
 /**
  * {@inheritdoc}
  */
 public function isSatisfiedBy($candidate)
 {
     return $this->one->isSatisfiedBy($candidate) || $this->other->isSatisfiedBy($candidate);
 }
示例#5
0
 /**
  * {@inheritdoc}
  */
 public function isSatisfiedBy($candidate)
 {
     return !$this->spec->isSatisfiedBy($candidate);
 }
示例#6
0
 /**
  * @param $object
  *
  * @return bool
  */
 public function isSatisfiedBy($object)
 {
     return $this->left->isSatisfiedBy($object) && $this->right->isSatisfiedBy($object);
 }
 /**
  * @param mixed $object
  * @return bool
  */
 public function isSatisfiedBy($object)
 {
     return $this->one->isSatisfiedBy($object) && $this->other->isSatisfiedBy($object);
 }
示例#8
0
 /**
  * {inheritdoc}
  */
 public function isSatisfiedBy($candidate)
 {
     return $this->firstPart->isSatisfiedBy($candidate) || $this->secondPart->isSatisfiedBy($candidate);
 }
示例#9
0
 /**
  * 
  * can be 0+, just duplicate to return a single one that is not an array and rename this `findAllSatisfying`
  * @return array<Object|empty>
  * 
  */
 public function findSatisfying(Specification $specification)
 {
     $data = $this->findAll();
     $result = array();
     foreach ($data as $object) {
         if ($specification->isSatisfiedBy($object)) {
             $result[] = $object;
         }
     }
     return $result;
 }
示例#10
0
 /**
  * {inheritdoc}
  */
 public function isSatisfiedBy($candidate)
 {
     return !$this->wrappedSpecification->isSatisfiedBy($candidate);
 }