One file - one class (#24)

This commit is contained in:
bzick
2013-07-29 16:15:52 +04:00
parent 3674de41cb
commit e9b7951d7a
12 changed files with 189 additions and 115 deletions

View File

@ -8,6 +8,8 @@
* file that was distributed with this source code.
*/
namespace Fenom;
use Fenom\Error\InvalidUsageException;
use Fenom\Error\UnexpectedTokenException;
use Fenom\Tokenizer;
use Fenom\Template;
use Fenom\Scope;

View File

@ -0,0 +1,18 @@
<?php
/*
* This file is part of Fenom.
*
* (c) 2013 Ivan Shalganov
*
* For the full copyright and license information, please view the license.md
* file that was distributed with this source code.
*/
namespace Fenom\Error;
/**
* @package Fenom\Error
*/
class CompileException extends \ErrorException
{
}

View File

@ -0,0 +1,18 @@
<?php
/*
* This file is part of Fenom.
*
* (c) 2013 Ivan Shalganov
*
* For the full copyright and license information, please view the license.md
* file that was distributed with this source code.
*/
namespace Fenom\Error;
/**
* @package Fenom\Error
*/
class InvalidUsageException extends \LogicException
{
}

View File

@ -0,0 +1,18 @@
<?php
/*
* This file is part of Fenom.
*
* (c) 2013 Ivan Shalganov
*
* For the full copyright and license information, please view the license.md
* file that was distributed with this source code.
*/
namespace Fenom\Error;
/**
* @package Fenom\Error
*/
class SecurityException extends CompileException
{
}

View File

@ -0,0 +1,18 @@
<?php
/*
* This file is part of Fenom.
*
* (c) 2013 Ivan Shalganov
*
* For the full copyright and license information, please view the license.md
* file that was distributed with this source code.
*/
namespace Fenom\Error;
/**
* @package Fenom\Error
*/
class TokenizeException extends \RuntimeException
{
}

View File

@ -1,6 +1,15 @@
<?php
/*
* This file is part of Fenom.
*
* (c) 2013 Ivan Shalganov
*
* For the full copyright and license information, please view the license.md
* file that was distributed with this source code.
*/
namespace Fenom;
namespace Fenom\Error;
use Fenom\Tokenizer;
/**
* Unexpected token

View File

@ -8,7 +8,12 @@
* file that was distributed with this source code.
*/
namespace Fenom;
use Fenom;
use Fenom,
Fenom\Error\UnexpectedTokenException;
use Fenom\Error\CompileException;
use Fenom\Error\InvalidUsageException;
use Fenom\Error\SecurityException;
use Fenom\Error\TokenizeException;
/**
* Template compiler
@ -146,7 +151,7 @@ class Template extends Render
* Load source from provider
* @param string $name
* @param bool $compile
* @return $this
* @return self
*/
public function load($name, $compile = true)
{
@ -1370,20 +1375,4 @@ class Template extends Render
return $params;
}
}
class CompileException extends \ErrorException
{
}
class SecurityException extends CompileException
{
}
class InvalidUsageException extends \LogicException
{
}
class TokenizeException extends \RuntimeException
{
}

View File

@ -9,16 +9,18 @@
*/
namespace Fenom;
use Fenom\Error\UnexpectedTokenException;
/**
* for <PHP 5.4 compatible
* for PHP <5.4 compatible
*/
defined('T_INSTEADOF') || define('T_INSTEADOF', 341);
defined('T_TRAIT') || define('T_TRAIT', 355);
defined('T_TRAIT_C') || define('T_TRAIT_C', 365);
/**
* for PHP <5.5
* for PHP <5.5 compatible
*/
defined('T_YIELD') || define('T_YIELD', 370);
defined('T_YIELD') || define('T_YIELD', 390);
/**
* Each token have structure