/**
  *
  */
 public function testMerge()
 {
     $first = ['one' => 1, 'two' => 2, 'three' => ['four' => 4, 'five' => 5]];
     $second = ['two' => 'two', 'three' => ['four' => 'four']];
     $expected = ['one' => 1, 'two' => 'two', 'three' => ['four' => 'four', 'five' => 5]];
     $this->assertEquals($expected, Transform::merge($first, $second));
 }
Exemplo n.º 2
0
 /**
  *	Builds a media from the given meta tags.
  *
  *	@param array $metas Meta tags.
  *	@return Media Media.
  */
 protected function _media(array $metas)
 {
     $metas = Transform::combine($metas, function ($Meta) {
         (yield $Meta->get('property') => $Meta->get('content'));
     });
     return new Media($metas);
 }
 /**
  *	{@inheritDoc}
  */
 public function present(Media $Media)
 {
     return $Media->setProperties(Transform::reindex($Media->properties(), $this->_mapping));
 }
 /**
  *	Merges the given properties with the current ones.
  *
  *	@param array $properties Properties to merge.
  */
 public function configure(array $properties)
 {
     $this->_properties = Transform::merge($this->_properties, $properties);
     return $this;
 }
Exemplo n.º 5
0
 /**
  *	Builds a media from the given meta tags.
  *
  *	@param array $metas Meta tags.
  *	@return Media Media.
  */
 protected function _media(array $metas)
 {
     $metas = Transform::combine($metas, function ($Meta) {
         (yield $Meta->get($this->_metaAttribute) => $Meta->get('content'));
     });
     return new Media($metas);
 }
 /**
  *	Fetches informations about the given URLs.
  *
  *	@param array $urls An array of URLs to fetch informations from.
  *	@param array $options Custom options to be interpreted by a provider.
  *	@return array An array of informations, indexed by URL.
  */
 public function extractAll(array $urls, array $options = [])
 {
     return Transform::combine($urls, function ($url) use($options) {
         (yield $url => $this->extract($url, $options));
     });
 }