* @copyright 2012-2019 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class ReflectionUtilMEP { public static function getClassSource(ReflectionClass $class) { $path = $class->getFileName(); $lines = @file($path); $from = $class->getStartLine(); $to = $class->getEndLine(); $len = $to - $from + 1; return implode(array_slice($lines, $from-1, $len)); } public static function getClassSourceByClassName($class_name) { self::getClassSource(new ReflectionClass($class_name)); } public static function getDirNameClass($class_name) { $reflector = new ReflectionClass($class_name); $fn = $reflector->getFileName(); return dirname($fn); } }