Exemplo n.º 1
0
 /**
  * @param $node \Symfony\Component\DomCrawler\Crawler
  * @param string $attr
  * @param $trim
  * @return string
  */
 public function getValue($node, $attr, $trim)
 {
     $temp = '';
     try {
         if (Utils::isBlank($attr)) {
             $temp = $node->text();
         } else {
             $temp = $node->attr($attr);
         }
     } catch (\Exception $e) {
     }
     if ($trim == 'timestamp') {
         $temp = preg_replace('/.*ldst_strftime\\(/', '', $temp);
         $temp = preg_replace('/,.*/', "", $temp);
         $temp = trim($temp);
     }
     if ($trim == 'hash') {
         preg_match('/([0-9a-zA-Z]+)$/', $temp, $m);
         $temp = trim($m[0]);
     }
     return Utils::trimQsa($temp);
 }
Exemplo n.º 2
0
 /**
  * @cover Lodestone\Utils::isBlank
  */
 public function testUtilsIsBlank_greedy指定なしで全角スペースと非空白の組み合わせの場合_falseが返る()
 {
     $input = ' A ';
     $this->assertFalse(Utils::isBlank($input, false), $input);
 }
Exemplo n.º 3
0
 public function testApiAbstract_scrapingのmappingが空の時_HTMLを取得する()
 {
     $mock = new ApiMock();
     $crawler = $mock->getCrawler('GET', $this->url . $this->id);
     $this->assertTrue(!Utils::isBlank($mock->scraping($crawler, [])));
 }