public function testGetHost() { $host = $this->SUT->getHost('http://github.com/path/file.txt'); $this->assertEquals('github.com', $host); }
/** * Returns an array of interaction counts (shares, comments, clicks, reach) for host of $url on Xing. * * @access public * @param url string The URL to check. * @return array Returns URL shares, comments, clicks and 'reach'. * @link https://blog.xing.com/2012/01/xing-share-button/ Return values explained (German) */ public static function getXingShares($url = false) { $host = parent::getHost($url); $dataUrl = sprintf(Config\Services::XING_SHAREBUTTON_URL, urlencode($host)); $htmlData = parent::_getPage($dataUrl); @preg_match_all('/\\r?\\n(\\d+)\\r?\\n/s', $htmlData, $matches); if (isset($matches[1]) && 4 == sizeof($matches[1])) { return array('shares' => intval($matches[1][0]), 'comments' => intval($matches[1][1]), 'clicks' => intval($matches[1][2]), 'reach' => intval($matches[1][3])); } return parent::noDataDefaultValue(); }