Implement review suggestions

This commit is contained in:
MGatner 2021-06-23 13:47:27 +00:00 committed by John Paul E. Balandan, CPA
parent 096b5bdd5f
commit d1408104b9
2 changed files with 23 additions and 5 deletions

View File

@ -34,6 +34,8 @@ class FileCollection implements Countable, IteratorAggregate
*/
protected $files = [];
//--------------------------------------------------------------------
// Support Methods
//--------------------------------------------------------------------
/**
@ -104,7 +106,7 @@ class FileCollection implements Countable, IteratorAggregate
final protected static function matchFiles(array $files, string $pattern): array
{
// Convert pseudo-regex into their true form
if (@preg_match($pattern, null) === false) // @phpstan-ignore-line
if (@preg_match($pattern, '') === false)
{
$pattern = str_replace(
['#', '.', '*', '?'],
@ -119,6 +121,8 @@ class FileCollection implements Countable, IteratorAggregate
});
}
//--------------------------------------------------------------------
// Class Core
//--------------------------------------------------------------------
/**
@ -209,6 +213,8 @@ class FileCollection implements Countable, IteratorAggregate
return $this;
}
//--------------------------------------------------------------------
// File Handling
//--------------------------------------------------------------------
/**
@ -268,6 +274,8 @@ class FileCollection implements Countable, IteratorAggregate
return $this->removeFiles([$file]);
}
//--------------------------------------------------------------------
// Directory Handling
//--------------------------------------------------------------------
/**
@ -317,6 +325,8 @@ class FileCollection implements Countable, IteratorAggregate
return $this;
}
//--------------------------------------------------------------------
// Filtering
//--------------------------------------------------------------------
/**
@ -366,6 +376,8 @@ class FileCollection implements Countable, IteratorAggregate
}
//--------------------------------------------------------------------
// Interface Methods
//--------------------------------------------------------------------
/**
* Returns the current number of files in the collection.

View File

@ -87,6 +87,8 @@ class Publisher extends FileCollection
*/
protected $destination = FCPATH;
//--------------------------------------------------------------------
// Support Methods
//--------------------------------------------------------------------
/**
@ -154,6 +156,8 @@ class Publisher extends FileCollection
}
}
//--------------------------------------------------------------------
// Class Core
//--------------------------------------------------------------------
/**
@ -217,6 +221,8 @@ class Publisher extends FileCollection
return $this->addPath('/')->merge(true);
}
//--------------------------------------------------------------------
// Property Accessors
//--------------------------------------------------------------------
/**
@ -275,6 +281,8 @@ class Publisher extends FileCollection
return $this->published;
}
//--------------------------------------------------------------------
// Additional Handlers
//--------------------------------------------------------------------
/**
@ -310,8 +318,6 @@ class Publisher extends FileCollection
return $this;
}
//--------------------------------------------------------------------
/**
* Downloads and stages files from an array of URIs.
*
@ -347,6 +353,8 @@ class Publisher extends FileCollection
return $this->addFile($file);
}
//--------------------------------------------------------------------
// Write Methods
//--------------------------------------------------------------------
/**
@ -361,8 +369,6 @@ class Publisher extends FileCollection
return $this;
}
//--------------------------------------------------------------------
/**
* Copies all files into the destination, does not create directory structure.
*