public static function byPath($_pathfile) { if (!file_exists($_pathfile)) { throw new Exception('Chemin jusqu\'au widget non trouvé : ' . $_pathfile); } $path_parts = pathinfo($_pathfile); $informations = explode('.', $path_parts['basename']); $widget = new self(); $widget->setType($informations[1]); $widget->setSubtype($informations[2]); $widget->setName($informations[3]); $folder = explode('/', $path_parts['dirname']); $widget->setVersion($folder[count($folder) - 1]); $widget->setContent(file_get_contents($_pathfile)); $widget->setPath($_pathfile); return $widget; }