@@ -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 | */ |
@@ -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 | */ |
@@ -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 | { |
@@ -136,6 +136,11 @@ discard block |
||
| 136 | 136 | return !in_array($db, self::getDBs()) ? false : $db; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | + /** |
|
| 140 | + * @param string $url |
|
| 141 | + * |
|
| 142 | + * @return string |
|
| 143 | + */ |
|
| 139 | 144 | protected static function getDomainFromUrl($url) |
| 140 | 145 | { |
| 141 | 146 | $url = parent::getUrl($url); |
@@ -145,6 +150,11 @@ discard block |
||
| 145 | 150 | return $domain; |
| 146 | 151 | } |
| 147 | 152 | |
| 153 | + /** |
|
| 154 | + * @param boolean $db |
|
| 155 | + * |
|
| 156 | + * @return string |
|
| 157 | + */ |
|
| 148 | 158 | protected static function getValidDatabase($db) |
| 149 | 159 | { |
| 150 | 160 | $db = ($db == false) ? Config\DefaultSettings::SISTRIX_DB : $db; |
@@ -169,6 +179,9 @@ discard block |
||
| 169 | 179 | } |
| 170 | 180 | } |
| 171 | 181 | |
| 182 | + /** |
|
| 183 | + * @param string $err |
|
| 184 | + */ |
|
| 172 | 185 | private static function exc($err) |
| 173 | 186 | { |
| 174 | 187 | $e = ($err == 'db') |
@@ -69,7 +69,6 @@ discard block |
||
| 69 | 69 | * HTTP HEAD request with curl. |
| 70 | 70 | * |
| 71 | 71 | * @access private |
| 72 | - * @param String $a The request URL |
|
| 73 | 72 | * @return Integer Returns the HTTP status code received in |
| 74 | 73 | * response to a GET request of the input URL. |
| 75 | 74 | */ |
@@ -136,6 +135,9 @@ discard block |
||
| 136 | 135 | return (bool)(false !== stat($file)); |
| 137 | 136 | } |
| 138 | 137 | |
| 138 | + /** |
|
| 139 | + * @return resource |
|
| 140 | + */ |
|
| 139 | 141 | public static function getUserAgent() { |
| 140 | 142 | $ua = sprintf('SEOstats %s https://github.com/eyecatchup/SEOstats', \SEOstats\SEOstats::BUILD_NO); |
| 141 | 143 | if(\SEOstats\Config\DefaultSettings::UA !== '') { |
@@ -152,6 +152,9 @@ discard block |
||
| 152 | 152 | return $url; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | + /** |
|
| 156 | + * @param boolean $url |
|
| 157 | + */ |
|
| 155 | 158 | public function setUrl($url) |
| 156 | 159 | { |
| 157 | 160 | if (false !== Helper\Url::isRfc($url)) { |
@@ -165,6 +168,9 @@ discard block |
||
| 165 | 168 | return true; |
| 166 | 169 | } |
| 167 | 170 | |
| 171 | + /** |
|
| 172 | + * @return string |
|
| 173 | + */ |
|
| 168 | 174 | public static function getHost($url = false) |
| 169 | 175 | { |
| 170 | 176 | return Helper\Url::parseHost(self::getUrl($url)); |
@@ -176,7 +182,7 @@ discard block |
||
| 176 | 182 | } |
| 177 | 183 | |
| 178 | 184 | /** |
| 179 | - * @return DOMDocument |
|
| 185 | + * @return \DOMDocument |
|
| 180 | 186 | */ |
| 181 | 187 | protected static function _getDOMDocument($html) { |
| 182 | 188 | $doc = new \DOMDocument; |
@@ -185,7 +191,7 @@ discard block |
||
| 185 | 191 | } |
| 186 | 192 | |
| 187 | 193 | /** |
| 188 | - * @return DOMXPath |
|
| 194 | + * @return \DOMXPath |
|
| 189 | 195 | */ |
| 190 | 196 | protected static function _getDOMXPath($doc) { |
| 191 | 197 | $xpath = new \DOMXPath($doc); |
@@ -255,7 +261,7 @@ discard block |
||
| 255 | 261 | } |
| 256 | 262 | |
| 257 | 263 | /** |
| 258 | - * @return Useragent string |
|
| 264 | + * @return boolean string |
|
| 259 | 265 | */ |
| 260 | 266 | public static function getUserAgent() |
| 261 | 267 | { |