Skip to content

Commit

Permalink
optimize function name
Browse files Browse the repository at this point in the history
  • Loading branch information
ares333 committed Dec 7, 2018
1 parent 6395cb4 commit ba48348
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/HttpClone.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function __construct($dir)
*/
function add($url, $depth = null)
{
$url = $this->urlFormater($url);
$url = $this->formatUrl($url);
if (! isset($url)) {
user_error('invalid url(' . $url . ')', E_USER_ERROR);
}
Expand All @@ -87,9 +87,9 @@ function add($url, $depth = null)
*
* @see \Ares333\Curl\Toolkit::formatUrl()
*/
function urlFormater($url)
function formatUrl($url)
{
$url = parent::urlFormater($url);
$url = parent::formatUrl($url);
$parse = parse_url($url);
if (! isset($parse['path'])) {
$parse['path'] = '/';
Expand All @@ -103,7 +103,7 @@ function urlFormater($url)
function start()
{
foreach ($this->blacklist as $k => $v) {
$this->blacklist[$k] = $this->urlFormater($v);
$this->blacklist[$k] = $this->formatUrl($v);
}
foreach (array_keys($this->_task) as $v) {
if ($this->checkUrl($v)) {
Expand Down Expand Up @@ -139,7 +139,7 @@ function start()
*/
protected function url2src($url, $urlCurrent, $isLocal, $fixQuery = true)
{
$url = $this->urlFormater($url);
$url = $this->formatUrl($url);
if (in_array($url, $this->blacklist)) {
return '';
}
Expand Down Expand Up @@ -295,7 +295,7 @@ function onProcess($r, $args)
continue;
}
$url = $this->uri2url($href, $urlCurrent);
if ($this->isProcess($this->urlFormater($url))) {
if ($this->isProcess($this->formatUrl($url))) {
if (in_array(pathinfo($url, PATHINFO_EXTENSION),
$this->downloadExtension)) {
$urlDownload[$url] = array();
Expand Down Expand Up @@ -332,7 +332,7 @@ function onProcess($r, $args)
$urlParse
) as $k => $v) {
foreach ($v as $k1 => $v1) {
$k1 = $this->urlFormater($k1);
$k1 = $this->formatUrl($k1);
if ($this->checkUrl($k1)) {
$file = $this->url2file($k1);
if (null == $file) {
Expand Down
2 changes: 1 addition & 1 deletion src/Toolkit.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ function isUrl($url)
* @param string $url
* @return string
*/
function urlFormater($url)
function formatUrl($url)
{
if (! $this->isUrl($url)) {
return;
Expand Down

0 comments on commit ba48348

Please sign in to comment.