/** * @param ResourceType $type * * @return Call|LogicalAnd */ public function visitResourceType(ResourceType $type) { $this->typeCheck->visitResourceType(func_get_args()); $isResourceCall = new Call(QualifiedIdentifier::fromString('\\is_resource')); $isResourceCall->add($this->valueExpression()); if (null === $type->ofType()) { return $isResourceCall; } $getResourceTypeCall = new Call(QualifiedIdentifier::fromString('\\get_resource_type')); $getResourceTypeCall->add($this->valueExpression()); return new LogicalAnd($isResourceCall, new StrictEquals($getResourceTypeCall, new Literal($type->ofType()))); }
/** * Visit a resource type. * * @param ResourceType $type The type. * * @return mixed The result of visitation. */ public function visitResourceType(ResourceType $type) { $attributes = ''; if (null !== $type->ofType()) { $attributes = sprintf('{ofType:%s}', var_export($type->ofType(), true)); } return 'resource' . $attributes; }