コード例 #1
0
 public function __construct(Exclusion $exclusion = null)
 {
     if (null === $exclusion) {
         return;
     }
     $this->groups = $exclusion->getGroups();
     $this->sinceVersion = $exclusion->getSinceVersion();
     $this->untilVersion = $exclusion->getUntilVersion();
     $this->maxDepth = $exclusion->getMaxDepth();
 }
コード例 #2
0
 private function shouldSkip($object, Exclusion $exclusion = null, SerializationContext $context)
 {
     if (null !== $exclusion && null !== $exclusion->getExcludeIf() && $this->expressionEvaluator->evaluate($exclusion->getExcludeIf(), $object)) {
         return true;
     }
     if (!$context->getExclusionStrategy()) {
         return false;
     }
     $propertyMetadata = new RelationPropertyMetadata($exclusion);
     return $context->getExclusionStrategy()->shouldSkipProperty($propertyMetadata, $context);
 }
コード例 #3
0
 /**
  * @param Exclusion|null $exclusion
  * @return Exclusion
  */
 private function transformExclusion(Exclusion $exclusion = null)
 {
     if (!$exclusion) {
         return new Exclusion([$this->exclusionGroup]);
     }
     $groups = is_array($exclusion->getGroups()) ? $exclusion->getGroups() : [];
     return new Exclusion(array_merge($groups, [$this->exclusionGroup]), $exclusion->getSinceVersion(), $exclusion->getUntilVersion(), $exclusion->getMaxDepth(), $exclusion->getExcludeIf());
 }
コード例 #4
0
 public function __construct(Exclusion $exclusion = null, Relation $relation = null)
 {
     if (null !== $relation) {
         $this->name = $relation->getName();
         $this->class = get_class($relation);
         $typeParser = new TypeParser();
         if (null !== $relation->getEmbedded()) {
             $this->type = $typeParser->parse('Hateoas\\Model\\Embedded');
         } elseif (null !== $relation->getHref()) {
             $this->type = $typeParser->parse('Hateoas\\Model\\Link');
         }
     }
     if (null === $exclusion) {
         return;
     }
     $this->groups = $exclusion->getGroups();
     $this->sinceVersion = $exclusion->getSinceVersion();
     $this->untilVersion = $exclusion->getUntilVersion();
     $this->maxDepth = $exclusion->getMaxDepth();
 }