protected function basepath()
    {
        $directory = new \RecursiveDirectoryIterator(getcwd());

        $iterator = new \RecursiveIteratorIterator($directory);

        foreach ($iterator as $item) {
            $core = 'core' . DIRECTORY_SEPARATOR . 'CodeIgniter.php';

            $exists = strpos($item->getPathname(), $core) !== false;

            $path = str_replace($core, '', $item->getPathname());

            $exists && ! defined('BASEPATH') && define('BASEPATH', $path);
        }
    }