public function __construct($filePath) { $dir = dirname($filePath); if (!is_dir($dir)) { throw new \InvalidArgumentException("Please specify valid file path. Directory not exists. You have specified: {$dir}."); } $this->filePath = $filePath; }