I'm using Laravel
on various projects I use.
I needed to copy a particular file from one location to another, and I saw in the Laravel documentation that I should use File::copy()
.
Out of curiosity, as I always do, I decided to take a look at the source code, to know how this method was built, and I was surprised.
The class File is a facade for Illuminate\Filesystem\Filesystem
, which is the "real class".
See the source code for File::copy()
/**
* Copy a file to a new location.
*
* @param string $path
* @param string $target
* @return bool
*/
public function copy($path, $target)
{
return copy($path, $target);
}
This makes it appear that File::copy
is a facade for the native function copy
.
So, what are the reasons for using the copy method, since it is simply a return of the copy
function of PHP?
Should I use File::copy
just to keep the framework encoding standard?