/**
  * {@inheritdoc}
  */
 public function findMetadataBySubject(MetadataSubjectInterface $metadataSubject)
 {
     $compiledMetadata = $this->metadataProvider->findMetadataBySubject($metadataSubject);
     if (null === $compiledMetadata) {
         return null;
     }
     return $this->metadataProcessor->process($compiledMetadata, ['subject' => $metadataSubject]);
 }
 /**
  * {@inheritdoc}
  */
 public function getProperty(MetadataSubjectInterface $metadataSubject, $propertyPath = null)
 {
     $metadata = $this->metadataProvider->findMetadataBySubject($metadataSubject);
     if (null === $propertyPath) {
         return $metadata;
     }
     return $this->propertyAccessor->getValue($metadata, $propertyPath);
 }
 /**
  * {@inheritdoc}
  */
 public function findMetadataBySubject(MetadataSubjectInterface $metadataSubject)
 {
     $metadata = $this->metadataProvider->findMetadataBySubject($metadataSubject);
     if (null !== $metadata) {
         return $metadata;
     }
     $hierarchy = $this->metadataHierarchyProvider->getHierarchyByMetadataSubject($metadataSubject);
     if ('DefaultPage' === end($hierarchy)) {
         return new PageMetadata();
     }
     return null;
 }
 function it_returns_given_metadata_property_if_it_exists(MetadataProviderInterface $metadataProvider, PropertyAccessorInterface $propertyAccessor, MetadataSubjectInterface $metadataSubject, MetadataInterface $metadata)
 {
     $propertyAccessor->getValue($metadata, 'property.path[0]')->shouldBeCalled()->willReturn('property value');
     $metadataProvider->findMetadataBySubject($metadataSubject)->shouldBeCalled()->willReturn($metadata);
     $this->getProperty($metadataSubject, 'property.path[0]');
 }
 function it_does_not_process_returned_metadata_if_null(MetadataProviderInterface $metadataProvider, MetadataProcessorInterface $metadataProcessor, MetadataSubjectInterface $metadataSubject)
 {
     $metadataProvider->findMetadataBySubject($metadataSubject)->shouldBeCalled()->willReturn(null);
     $metadataProcessor->process(Argument::cetera())->shouldNotBeCalled();
     $this->findMetadataBySubject($metadataSubject)->shouldReturn(null);
 }