2
I am using the Laravel
in various projects that 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 surprised me.
The File class is a facade for Illuminate\Filesystem\Filesystem
, which is the "royal class".
See the source code of the method 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);
}
It makes it seem that File::copy
is a facade for native function copy
.
So what are the reasons for using the copy method, since it is simply a return of the function copy
of PHP?
Should I use File::copy
only to maintain the standard encoding framework?
It really seems redundant.
– Guilherme Nascimento