src/Services/Migrator.php
private function makeMigrationClass($name, $file)
    {
        if (($pos = strpos($name, '_')) === false) {
            throw new MigrationException('Name of the migration file "' . $name . '.php" is invalid. Format "<timestamp>_<classname>.php" expected.');
        }
        $class = substr($name, $pos + 1);

        /** @noinspection PhpIncludeInspection */
        require_once $file;

        if (!class_exists($class, false)) {
            throw new MigrationException('Migration class "' . $class . '" is not defined in file "' . $name . '.php".');
        }

        $instance = new $class;

        if (!($instance instanceof Migration)) {
            throw new MigrationException('Migration "' . $name . '" is invalid. The Class have to implements the interface \Core\Services\Contracts\Migration.');
        }

        return $instance;
    }
private function makeMigrationClass($name, $file)
    {
        if (($pos = strpos($name, '_')) === false) {
            throw new MigrationException('Name of the migration file "' . $name . '.php" is invalid. Format "<timestamp>_<classname>.php" expected.');
        }
        $class = substr($name, $pos + 1);

        /** @noinspection PhpIncludeInspection */
        require_once $file;

        if (!class_exists($class, false)) {
            throw new MigrationException('Migration class "' . $class . '" is not defined in file "' . $name . '.php".');
        }

        $instance = new $class;

        if (!($instance instanceof Migration)) {
            throw new MigrationException('Migration "' . $name . '" is invalid. The Class have to implements the interface \Core\Services\Contracts\Migration.');
        }

        return $instance;
    }
private function makeMigrationClass ( $ name , $ file ) { if ( ( $ pos = strpos ( $ name , '_' ) ) === false ) { throw new MigrationException ( 'Name of the migration file "' . $ name . '.php" is invalid. Format "<timestamp>_<classname>.php" expected.' ) ; } $ class = substr ( $ name , $ pos + 1 ) ; /** @noinspection PhpIncludeInspection */ require_once $ file ; if ( ! class_exists ( $ class , false ) ) { throw new MigrationException ( 'Migration class "' . $ class . '" is not defined in file "' . $ name . '.php".' ) ; } $ instance = new $ class ; if ( ! ( $ instance instanceof Migration ) ) { throw new MigrationException ( 'Migration "' . $ name . '" is invalid. The Class have to implements the interface \Core\Services\Contracts\Migration.' ) ; } return $ instance ; }
Create a new migration class.

@param string $name
@param string $file
@return Migration
@throws \Exception
Create a new migration class .