| @@ -37,7 +37,7 @@ | ||
| 37 | 37 | /** | 
| 38 | 38 | * Try to load a class | 
| 39 | 39 | * | 
| 40 | - * @param string $class The class name to load | |
| 40 | + * @param string $className The class name to load | |
| 41 | 41 | * | 
| 42 | 42 | * @return boolean If the loading was successful | 
| 43 | 43 | */ | 
| @@ -60,7 +60,6 @@ | ||
| 60 | 60 | * HTTP HEAD request with curl. | 
| 61 | 61 | * | 
| 62 | 62 | * @access private | 
| 63 | - * @param String $a The request URL | |
| 64 | 63 | * @return Integer Returns the HTTP status code received in | 
| 65 | 64 | * response to a GET request of the input URL. | 
| 66 | 65 | */ | 
| @@ -17,7 +17,6 @@ | ||
| 17 | 17 | * Decodes a JSON string into appropriate variable. | 
| 18 | 18 | * | 
| 19 | 19 | * @param string $str JSON-formatted string | 
| 20 | - * @param boolean $accos When true, returned objects will be converted into associative arrays. | |
| 21 | 20 | * @return mixed number, boolean, string, array, or object corresponding to given JSON input string. | 
| 22 | 21 | * Note that decode() always returns strings in ASCII or UTF-8 format! | 
| 23 | 22 | */ | 
| @@ -149,6 +149,9 @@ discard block | ||
| 149 | 149 | return $url; | 
| 150 | 150 | } | 
| 151 | 151 | |
| 152 | + /** | |
| 153 | + * @param boolean $url | |
| 154 | + */ | |
| 152 | 155 | public function setUrl($url) | 
| 153 | 156 |      { | 
| 154 | 157 |          if (false !== Helper\Url::isRfc($url)) { | 
| @@ -162,6 +165,9 @@ discard block | ||
| 162 | 165 | return true; | 
| 163 | 166 | } | 
| 164 | 167 | |
| 168 | + /** | |
| 169 | + * @return string | |
| 170 | + */ | |
| 165 | 171 | public static function getHost($url = false) | 
| 166 | 172 |      { | 
| 167 | 173 | return Helper\Url::parseHost(self::getUrl($url)); | 
| @@ -173,7 +179,7 @@ discard block | ||
| 173 | 179 | } | 
| 174 | 180 | |
| 175 | 181 | /** | 
| 176 | - * @return DOMDocument | |
| 182 | + * @return \DOMDocument | |
| 177 | 183 | */ | 
| 178 | 184 |      protected static function _getDOMDocument($html) { | 
| 179 | 185 | $doc = new \DOMDocument; | 
| @@ -182,7 +188,7 @@ discard block | ||
| 182 | 188 | } | 
| 183 | 189 | |
| 184 | 190 | /** | 
| 185 | - * @return DOMXPath | |
| 191 | + * @return \DOMXPath | |
| 186 | 192 | */ | 
| 187 | 193 |      protected static function _getDOMXPath($doc) { | 
| 188 | 194 | $xpath = new \DOMXPath($doc); | 
| @@ -231,8 +231,6 @@ discard block | ||
| 231 | 231 | /** | 
| 232 | 232 | * @access public | 
| 233 | 233 | * @param integer $type Specifies the graph type. Valid values are 1 to 6. | 
| 234 | - * @param integer $width Specifies the graph width (in px). | |
| 235 | - * @param integer $height Specifies the graph height (in px). | |
| 236 | 234 | * @param integer $period Specifies the displayed time period. Valid values are 1 to 12. | 
| 237 | 235 | * @return string Returns a string, containing the HTML code of an image, showing Alexa Statistics as Graph. | 
| 238 | 236 | */ | 
| @@ -258,6 +256,7 @@ discard block | ||
| 258 | 256 | } | 
| 259 | 257 | |
| 260 | 258 | /** | 
| 259 | + * @param boolean $url | |
| 261 | 260 | * @return DOMXPath | 
| 262 | 261 | */ | 
| 263 | 262 |      protected static function _getXPath($url) { | 
| @@ -275,6 +274,9 @@ discard block | ||
| 275 | 274 | return $xpath; | 
| 276 | 275 | } | 
| 277 | 276 | |
| 277 | + /** | |
| 278 | + * @param string $url | |
| 279 | + */ | |
| 278 | 280 | protected static function _getAlexaPage($url) | 
| 279 | 281 |      { | 
| 280 | 282 | $domain = Helper\Url::parseHost($url); | 
| @@ -320,6 +322,7 @@ discard block | ||
| 320 | 322 | |
| 321 | 323 | /** | 
| 322 | 324 | * | 
| 325 | + * @param string[] $xpathQueryList | |
| 323 | 326 | * @return mixed nodeValue | 
| 324 | 327 | */ | 
| 325 | 328 | protected static function parseDomByXpathsToInteger($xpathDom, $xpathQueryList) | 
| @@ -334,6 +337,7 @@ discard block | ||
| 334 | 337 | |
| 335 | 338 | /** | 
| 336 | 339 | * | 
| 340 | + * @param string[] $xpathQueryList | |
| 337 | 341 | * @return mixed nodeValue | 
| 338 | 342 | */ | 
| 339 | 343 | protected static function parseDomByXpathsWithoutTags($xpathDom, $xpathQueryList) | 
| @@ -350,6 +354,7 @@ discard block | ||
| 350 | 354 | |
| 351 | 355 | /** | 
| 352 | 356 | * | 
| 357 | + * @param string[] $xpathQueryList | |
| 353 | 358 | * @return mixed nodeValue | 
| 354 | 359 | */ | 
| 355 | 360 | protected static function parseDomByXpathsToIntegerWithoutTags($xpathDom, $xpathQueryList) | 
| @@ -122,7 +122,6 @@ | ||
| 122 | 122 | * Returns array, containing detailed results for any Google search. | 
| 123 | 123 | * | 
| 124 | 124 | * @param string $query String, containing the search query. | 
| 125 | - * @param string $tld String, containing the desired Google top level domain. | |
| 126 | 125 | * @return array Returns array, containing the keys 'URL', 'Title' and 'Description'. | 
| 127 | 126 | */ | 
| 128 | 127 | public static function getSerps($query, $maxResults=100, $domain=false) | 
| @@ -23,7 +23,6 @@ discard block | ||
| 23 | 23 | * Returns array, containing detailed results for any Google search. | 
| 24 | 24 | * | 
| 25 | 25 | * @param string $query String, containing the search query. | 
| 26 | - * @param string $tld String, containing the desired Google top level domain. | |
| 27 | 26 | * @return array Returns array, containing the keys 'URL', 'Title' and 'Description'. | 
| 28 | 27 | */ | 
| 29 | 28 | public static function getSerps($query, $maxResults=100, $domain=false) | 
| @@ -55,6 +54,11 @@ discard block | ||
| 55 | 54 | return $result->toArray(); | 
| 56 | 55 | } | 
| 57 | 56 | |
| 57 | + /** | |
| 58 | + * @param integer $start | |
| 59 | + * @param string $query | |
| 60 | + * @param Helper\ArrayHandle $result | |
| 61 | + */ | |
| 58 | 62 | protected static function makeRequest ($start, $query, $result, $domainRexExp) | 
| 59 | 63 |      { | 
| 60 | 64 | $ref = static::getReference($start, $query); | 
| @@ -90,6 +94,9 @@ discard block | ||
| 90 | 94 |              : sprintf('search?q=%s&hl=en&prmd=imvns&start=%s0&sa=N', $query, $start); | 
| 91 | 95 | } | 
| 92 | 96 | |
| 97 | + /** | |
| 98 | + * @param boolean $domain | |
| 99 | + */ | |
| 93 | 100 | protected static function getDomainFilter ($domain) | 
| 94 | 101 |      { | 
| 95 | 102 | return $domain | 
| @@ -104,6 +111,9 @@ discard block | ||
| 104 | 111 |              : sprintf('search?q=%s&filter=0&start=%s0', $query, $start); | 
| 105 | 112 | } | 
| 106 | 113 | |
| 114 | + /** | |
| 115 | + * @param string $response | |
| 116 | + */ | |
| 107 | 117 | protected static function guardNoCaptcha ($response) | 
| 108 | 118 |      { | 
| 109 | 119 |          if (preg_match("#answer[=|/]86640#i", $response)) { | 
| @@ -146,11 +156,18 @@ discard block | ||
| 146 | 156 | : $match; | 
| 147 | 157 | } | 
| 148 | 158 | |
| 159 | + /** | |
| 160 | + * @param string $url | |
| 161 | + */ | |
| 149 | 162 | protected static function isAGoogleWebmasterLink($url) | 
| 150 | 163 |      { | 
| 151 | 164 |          return preg_match('#^https?://www.google.com/(?:intl/.+/)?webmasters#', $url); | 
| 152 | 165 | } | 
| 153 | 166 | |
| 167 | + /** | |
| 168 | + * @param string $path | |
| 169 | + * @param string $ref | |
| 170 | + */ | |
| 154 | 171 | protected static function gCurl($path, $ref, $useCookie = Config\DefaultSettings::ALLOW_GOOGLE_COOKIES) | 
| 155 | 172 |      { | 
| 156 | 173 |          $url = sprintf('https://www.google.%s/', Config\DefaultSettings::GOOGLE_TLD); | 
| @@ -11,7 +11,6 @@ | ||
| 11 | 11 | * @updated 2013/12/17 | 
| 12 | 12 | */ | 
| 13 | 13 | |
| 14 | -use SEOstats\Common\SEOstatsException as E; | |
| 15 | 14 | use SEOstats\SEOstats as SEOstats; | 
| 16 | 15 | use SEOstats\Config as Config; | 
| 17 | 16 | use SEOstats\Helper as Helper; | 
| @@ -102,6 +102,9 @@ discard block | ||
| 102 | 102 | : Helper\Json::decode($ret, true); | 
| 103 | 103 | } | 
| 104 | 104 | |
| 105 | + /** | |
| 106 | + * @param integer $expires | |
| 107 | + */ | |
| 105 | 108 | private static function _getUrlSafeSignature($expires) | 
| 106 | 109 |      { | 
| 107 | 110 |          $data = Config\ApiKeys::MOZSCAPE_ACCESS_ID . "\n{$expires}"; | 
| @@ -110,6 +113,9 @@ discard block | ||
| 110 | 113 | return base64_encode($sig); | 
| 111 | 114 | } | 
| 112 | 115 | |
| 116 | + /** | |
| 117 | + * @param string $data | |
| 118 | + */ | |
| 113 | 119 | private static function _hmacsha1($data, $key) | 
| 114 | 120 |      { | 
| 115 | 121 | // Use PHP's built in functionality if available | 
| @@ -120,6 +120,9 @@ discard block | ||
| 120 | 120 | } | 
| 121 | 121 | } | 
| 122 | 122 | |
| 123 | + /** | |
| 124 | + * @param string $url | |
| 125 | + */ | |
| 123 | 126 | protected static function getApiData($url) | 
| 124 | 127 |      { | 
| 125 | 128 | $json = static::_getPage($url); | 
| @@ -147,6 +150,12 @@ discard block | ||
| 147 | 150 | } | 
| 148 | 151 | } | 
| 149 | 152 | |
| 153 | + /** | |
| 154 | + * @param integer $reportType | |
| 155 | + * @param integer $width | |
| 156 | + * @param integer $height | |
| 157 | + * @param string $lang | |
| 158 | + */ | |
| 150 | 159 | protected static function guardValidArgsForGetDomainGraph($reportType, $width, $height, $lang) | 
| 151 | 160 |      { | 
| 152 | 161 |          if ($reportType > 5 || $reportType < 1) { | 
| @@ -166,6 +175,11 @@ discard block | ||
| 166 | 175 | } | 
| 167 | 176 | } | 
| 168 | 177 | |
| 178 | + /** | |
| 179 | + * @param string|boolean $url | |
| 180 | + * @param string|boolean $db | |
| 181 | + * @param string $reportType | |
| 182 | + */ | |
| 169 | 183 | protected static function getBackendData($url, $db, $reportType) | 
| 170 | 184 |      { | 
| 171 | 185 | $db = false !== $db ? $db : Config\DefaultSettings::SEMRUSH_DB; | 
| @@ -200,6 +214,12 @@ discard block | ||
| 200 | 214 | return sprintf($widgetUrl, $reportType, $database, $domain); | 
| 201 | 215 | } | 
| 202 | 216 | |
| 217 | + /** | |
| 218 | + * @param boolean $url | |
| 219 | + * @param boolean $db | |
| 220 | + * @param string $reportType | |
| 221 | + * @param string $valueKey | |
| 222 | + */ | |
| 203 | 223 | protected static function getWidgetData($url, $db, $reportType, $valueKey) | 
| 204 | 224 |      { | 
| 205 | 225 | $db = false !== $db ? $db : Config\DefaultSettings::SEMRUSH_DB; | 
| @@ -217,6 +237,7 @@ discard block | ||
| 217 | 237 | /** | 
| 218 | 238 | * | 
| 219 | 239 | * @throws E | 
| 240 | + * @param string $err | |
| 220 | 241 | */ | 
| 221 | 242 | protected static function exc($err) | 
| 222 | 243 |      { |