app\models\File::__construct PHP Method

__construct() public method

Upon construction, we'll set the path, hash, and associated Song object (if any).
public __construct ( string | SplFileInf\SplFileInfo $path, getID\getID3 $getID3 = null )
$path string | SplFileInf\SplFileInfo Either the file's path, or a SplFileInfo object
$getID3 getID\getID3 A getID3 object for DI (and better performance)
    public function __construct($path, $getID3 = null)
    {
        $this->splFileInfo = $path instanceof SplFileInfo ? $path : new SplFileInfo($path);
        $this->setGetID3($getID3);
        // Workaround for #344, where getMTime() fails for certain files with Unicode names
        // on Windows.
        // Yes, beloved Windows.
        try {
            $this->mtime = $this->splFileInfo->getMTime();
        } catch (Exception $e) {
            // Not worth logging the error. Just use current stamp for mtime.
            $this->mtime = time();
        }
        $this->path = $this->splFileInfo->getPathname();
        $this->hash = self::getHash($this->path);
        $this->song = Song::find($this->hash);
        $this->syncError = '';
    }