Removing file_exists

This commit is contained in:
Dennis Eichhorn 2016-08-29 21:52:14 +02:00
parent ca03e96fb9
commit ba865a67f3
2 changed files with 7 additions and 8 deletions

View File

@ -39,19 +39,18 @@ class Autoloader
* *
* @return void * @return void
* *
* @throws \Exception Throws this exception if the class to autoload doesn't exist. This could also be related to a wrong namespace/file path correlation. * @throws AutoloadException Throws this exception if the class to autoload doesn't exist. This could also be related to a wrong namespace/file path correlation.
* *
* @since 1.0.0 * @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com> * @author Dennis Eichhorn <d.eichhorn@oms.com>
*/ */
public static function default_autoloader(string $class) public static function default_autoloader(string $class)
{ {
if (($classNew = self::exists($class)) !== false) { $class = ltrim($class, '\\');
/** @noinspection PhpIncludeInspection */ $class = str_replace(['_', '\\'], DIRECTORY_SEPARATOR, $class);
include __DIR__ . '/../' . $classNew . '.php';
} else { /** @noinspection PhpIncludeInspection */
throw new AutoloaderException($class); include_once __DIR__ . '/../' . $class . '.php';
}
} }
/** /**

View File

@ -205,7 +205,7 @@ abstract class ViewAbstract implements \Serializable
*/ */
public function serialize() public function serialize()
{ {
if (!file_exists(__DIR__ . '/../..' . $this->template . '.tpl.php')) { if (empty($this->template)) {
return $this->toArray(); return $this->toArray();
} }