/** * @group issue46 * @group issue49 * * Don't add a scheme to schemeless URLs * * @see https://github.com/jeremykendall/php-domain-parser/issues/46 * @see https://github.com/jeremykendall/php-domain-parser/issues/49 */ public function testDoNotPrependSchemeToSchemelessUrls() { $schemeless = 'www.graphstory.com'; $expected = 'www.graphstory.com'; $url = $this->parser->parseUrl($schemeless); $actual = $url->__toString(); $this->assertEquals($expected, $actual); $schemeless = '//www.graphstory.com'; $expected = 'www.graphstory.com'; $url = $this->parser->parseUrl($schemeless); $actual = $url->__toString(); $this->assertEquals($expected, $actual); }
/** * Return a new url with the given path * * @param Path $path * @param Parser $parser Helper used to replace the path * * @return self */ public function withPath(Path $path, Parser $parser) : self { $parsed = $parser->parseUrl((string) $this); return new self((string) new ParsedUrl($parsed->scheme, $parsed->user, $parsed->pass, $parsed->host, $parsed->port, (string) $path, '', '')); }
$keys[] = $i; } $Products = new Products(); $Parser = new Parser(); // ini_set('memory_limit', '728M'); ini_set('max_execution_time', 3000); $k = $l = $i = 0; foreach ($array as $row) { $res = array_combine($keys, $row); if (isset($res['url']) && $res['url'] !== '' && !$Products->SetFieldsByRewrite(G::StrToTrans($res['name']))) { // print_r($res['name']); // print_r('</br>'); // var_dump(G::StrToTrans($res['name'])); // print_r('</br>'); // var_dump(!$Products->SetFieldsByRewrite(G::StrToTrans($res['name'])));die(); if ($Parser->parseUrl($res['url'])) { $k++; sleep(3); } else { $l++; } } else { $i++; } } print_r('<pre>товарів додано: ' . $k . '</pre>'); print_r('<pre>товарів не вдалося додати: ' . $l . '</pre>'); print_r('<pre>товарів пропущено: ' . $i . '</pre>'); // ini_set('memory_limit', '192M'); ini_set('max_execution_time', 30); }