public function testCanMergeArrays()
 {
     $array = Arrays::merge($this->array, ['foo' => 3], ['kal' => 'mon']);
     $this->assertEquals(['foo' => 3, 'bis' => 'ter', 'kal' => 'mon'], $array);
 }
Exemplo n.º 2
0
 public function testCanMergeArrays()
 {
     $array = Arrays::merge($this->array, array('foo' => 3), array('kal' => 'mon'));
     $this->assertEquals(array('foo' => 3, 'bis' => 'ter', 'kal' => 'mon'), $array);
 }
Exemplo n.º 3
0
 /**
  * Retrieves the last $postCount from vdm
  *
  * @param  int $postCount : the number of entries to retrieve
  * @return mixed
  */
 protected function getLatestPosts($postCount)
 {
     // posts array is empty
     $posts = [];
     // starting at page 0 (source achitecture)
     $pageId = 0;
     // fetching until enough posts are retrieved
     while (Arrays::size($posts) < $postCount) {
         $dom = HtmlDomParser::file_get_html(sprintf($this->getBaseUrl(), $pageId));
         $domPosts = $dom->find('.article');
         $posts = Arrays::merge($posts, $domPosts);
         $pageId++;
     }
     // sorting by descending date and keeping only the $postCount first entries
     return Arrays::from($posts)->sort('date', 'desc')->first($postCount)->obtain();
 }