public static function createFromFile($file) { if (!file_exists($file)) { throw new \Exception('File not found.'); } $stream = new self(); $stream->open($file); $stream->alpha(); return $stream; }