getFileName(); } //-------------------------------------------------------------------- /** * A recursive remove directory method. * * @param $dir */ protected static function removeDir($dir) { if (is_dir($dir)) { $objects = scandir($dir); foreach ($objects as $object) { if ($object !== '.' && $object !== '..') { if (filetype($dir . '/' . $object) === 'dir') { static::removeDir($dir . '/' . $object); } else { unlink($dir . '/' . $object); } } } reset($objects); rmdir($dir); } } /** * Moves the Zend Escaper files into our base repo so that it's * available for packaged releases where the users don't user Composer. * * @throws \ReflectionException */ public static function moveEscaper() { if (class_exists('\\Zend\\Escaper\\Escaper') && is_file(static::getClassFilePath('\\Zend\\Escaper\\Escaper'))) { $base = basename(__DIR__) . '/' . static::$basePath . 'ZendEscaper'; foreach ([$base, $base . '/Exception'] as $path) { if (! is_dir($path)) { mkdir($path, 0755); } } $files = [ static::getClassFilePath('\\Zend\\Escaper\\Exception\\ExceptionInterface') => $base . '/Exception/ExceptionInterface.php', static::getClassFilePath('\\Zend\\Escaper\\Exception\\InvalidArgumentException') => $base . '/Exception/InvalidArgumentException.php', static::getClassFilePath('\\Zend\\Escaper\\Exception\\RuntimeException') => $base . '/Exception/RuntimeException.php', static::getClassFilePath('\\Zend\\Escaper\\Escaper') => $base . '/Escaper.php', ]; foreach ($files as $source => $dest) { if (! static::moveFile($source, $dest)) { die('Error moving: ' . $source); } } } } //-------------------------------------------------------------------- /** * Moves the Kint file into our base repo so that it's * available for packaged releases where the users don't user Composer. */ public static function moveKint() { $filename = 'vendor/kint-php/kint/build/kint-aante-light.php'; if (is_file($filename)) { $base = basename(__DIR__) . '/' . static::$basePath . 'Kint'; // Remove the contents of the previous Kint folder, if any. if (is_dir($base)) { static::removeDir($base); } // Create Kint if it doesn't exist already if (! is_dir($base)) { mkdir($base, 0755); } if (! static::moveFile($filename, $base . '/kint.php')) { die('Error moving: ' . $filename); } } } }