Commit 26154dbe authored by Radek Suski's avatar Radek Suski

Revert "Merge branch 'master' into 'master'"

This reverts merge request !16
parent 900f74c8
<?php
/**
* @package SobiPro
* @subpackage
* @copyright A copyright
* @license A "Slug" license name e.g. GPL2
*/
declare( strict_types=1 );
namespace SobiPro;
use Sobi\FileSystem\Directory;
class Autoloader extends \Sobi\Autoloader\Autoloader
{
/**
* @return Autoloader
*/
public function & register()
{
spl_autoload_register( [ $this, 'load' ], true );
return $this;
}
/**
* @return Autoloader
*/
public static function getInstance()
{
static $self = null;
if ( !is_object( $self ) ) {
$self = new self();
}
return $self;
}
protected function load( $class )
{
$path = explode( '\\', $class );
if ( $path[ 0 ] == 'SobiPro' ) {
unset( $path[ 0 ] );
$path = $this->getPath( $path );
if ( $path ) {
/** @noinspection PhpIncludeInspection */
include_once $path;
}
else {
throw new \Exception( "Can't find class {$class} definition" );
}
}
}
/**
* Is more like a backward compatibility path translator
*
* @param array $classes
*
* @return string
*/
protected function getPath( array $classes ): string
{
$libPath = SOBI_PATH . '/lib';
foreach ( $classes as $file ) {
$dir = scandir( $libPath );
foreach ( $dir as $dirFile ) {
if ( strtolower( $file ) == strtolower( $dirFile ) || strtolower( "{$file}.php" ) == strtolower( $dirFile ) ) {
$libPath .= "/{$dirFile}";
break;
}
}
}
return $libPath;
}
}
<?php
/**
* @package SobiPro\Ctrl\Adm
* @subpackage
* @copyright A copyright
* @license A "Slug" license name e.g. GPL2
*/
declare( strict_types=1 );
namespace SobiPro\Ctrl\Adm;
include_once( 'config.php' );
class ConfigAdmCtrl extends \SPConfigAdmCtrl
{
}
<?php
/**
* @package SobiPro\Ctrl
* @subpackage
* @copyright A copyright
* @license A "Slug" license name e.g. GPL2
*/
declare( strict_types=1 );
namespace SobiPro\Ctrl\Adm;
class SiteBuilder extends ConfigAdmCtrl
{
/**
* @return bool
* @throws \Exception
*/
public function execute(): bool
{
\SPConfig::debOut( "Youhuuu" );
return true;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment