[Beeframework-svn] SF.net SVN: beeframework:[288] trunk/framework/Bee
Brought to you by:
b_hartmann,
m_plomer
From: <m_p...@us...> - 2015-02-24 13:03:41
|
Revision: 288 http://sourceforge.net/p/beeframework/code/288 Author: m_plomer Date: 2015-02-24 13:03:39 +0000 (Tue, 24 Feb 2015) Log Message: ----------- - introduced TLogged trait into various classes Modified Paths: -------------- trunk/framework/Bee/MVC/Controller/Multiaction/AbstractDelegatingHandlerHolder.php trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/RegexMappingInvocationResolver.php trunk/framework/Bee/MVC/Dispatcher.php trunk/framework/Bee/MVC/SimpleMappingExceptionResolver.php trunk/framework/Bee/MVC/ViewResolver/BasicViewResolver.php trunk/framework/Bee/Persistence/Doctrine2/EntityManagerHolder.php Modified: trunk/framework/Bee/MVC/Controller/Multiaction/AbstractDelegatingHandlerHolder.php =================================================================== --- trunk/framework/Bee/MVC/Controller/Multiaction/AbstractDelegatingHandlerHolder.php 2015-02-24 12:56:16 UTC (rev 287) +++ trunk/framework/Bee/MVC/Controller/Multiaction/AbstractDelegatingHandlerHolder.php 2015-02-24 13:03:39 UTC (rev 288) @@ -15,31 +15,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -use Bee\MVC\Controller\MultiActionController; use Bee\MVC\IDelegatingHandler; -use Logger; +use Bee\Utils\TLogged; /** * Class AbstractControllerHolder */ abstract class AbstractDelegatingHandlerHolder { + use TLogged; /** - * @var Logger - */ - protected $log; - - /** - * @return Logger - */ - protected function getLog() { - if (!$this->log) { - $this->log = Logger::getLogger(get_class($this)); - } - return $this->log; - } - - /** * Enter description here... * * @var IDelegatingHandler Modified: trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/RegexMappingInvocationResolver.php =================================================================== --- trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/RegexMappingInvocationResolver.php 2015-02-24 12:56:16 UTC (rev 287) +++ trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/RegexMappingInvocationResolver.php 2015-02-24 13:03:39 UTC (rev 288) @@ -19,6 +19,7 @@ use Bee\Beans\PropertyEditor\PropertyEditorRegistry; use Bee\MVC\IHttpRequest; use Bee\Utils\AntPathToRegexTransformer; +use Bee\Utils\TLogged; use Logger; use ReflectionMethod; @@ -27,25 +28,11 @@ * @package Bee\MVC\Controller\Multiaction\HandlerMethodInvocator */ class RegexMappingInvocationResolver implements IInvocationResolver { + use TLogged; const IGNORE_WILDCARD_TRAILING_PATTERN = '\\.[^/]*'; /** - * @var Logger - */ - protected static $log; - - /** - * @return Logger - */ - protected static function getLog() { - if (!self::$log) { - self::$log = Logger::getLogger(get_called_class()); - } - return self::$log; - } - - /** * @var HandlerMethodMetadata[] */ private static $methodMetadataMap = array(); @@ -92,8 +79,8 @@ } } // sort matching patterns - if (self::getLog()->isDebugEnabled()) { - self::getLog()->debug('Found ' . count($matchingPatterns) . ' matching patterns for pathInfo "' . $pathInfo . '", trying to determine most specific match'); + if ($this->getLog()->isDebugEnabled()) { + $this->getLog()->debug('Found ' . count($matchingPatterns) . ' matching patterns for pathInfo "' . $pathInfo . '", trying to determine most specific match'); } uksort($matchingPatterns, function ($patternA, $patternB) use ($matchingPatterns, $pathInfo) { @@ -150,11 +137,11 @@ return strlen($matchA->getAntPathPattern()) - strlen($matchB->getAntPathPattern()); }); - if (self::getLog()->isDebugEnabled()) { + if ($this->getLog()->isDebugEnabled()) { $matchingAntPaths = array_map(function (MethodInvocation $item) { return $item->getAntPathPattern(); }, $matchingPatterns); - self::getLog()->debug('Sorted patterns for pathInfo "' . $pathInfo . '" are ' . "\n" . implode("\n", $matchingAntPaths)); + $this->getLog()->debug('Sorted patterns for pathInfo "' . $pathInfo . '" are ' . "\n" . implode("\n", $matchingAntPaths)); } if (count($matchingPatterns) > 0) { Modified: trunk/framework/Bee/MVC/Dispatcher.php =================================================================== --- trunk/framework/Bee/MVC/Dispatcher.php 2015-02-24 12:56:16 UTC (rev 287) +++ trunk/framework/Bee/MVC/Dispatcher.php 2015-02-24 13:03:39 UTC (rev 288) @@ -21,8 +21,8 @@ use Bee\IContext; use Bee\MVC\Session\DispatcherAdapter; use Bee\Utils\Assert; +use Bee\Utils\TLogged; use Exception; -use Logger; /** * The dispatcher is the main entry point into an Bee MVC application. It acts as a front controller, i.e. it handles incoming @@ -49,6 +49,7 @@ * @author Benjamin Hartmann */ class Dispatcher implements IFilterChain { + use TLogged; const REQUEST_BUILDER_BEAN_NAME = 'requestBuilder'; @@ -61,21 +62,6 @@ const HANDLER_EXCEPTION_RESOLVER_NAME = 'handlerExceptionResolver'; /** - * @var Logger - */ - protected $log; - - /** - * @return Logger - */ - protected function getLog() { - if (!$this->log) { - $this->log = Logger::getLogger(get_class($this)); - } - return $this->log; - } - - /** * The dispatcher responsible for the current request * * @var Dispatcher Modified: trunk/framework/Bee/MVC/SimpleMappingExceptionResolver.php =================================================================== --- trunk/framework/Bee/MVC/SimpleMappingExceptionResolver.php 2015-02-24 12:56:16 UTC (rev 287) +++ trunk/framework/Bee/MVC/SimpleMappingExceptionResolver.php 2015-02-24 13:03:39 UTC (rev 288) @@ -16,29 +16,15 @@ * limitations under the License. */ use Bee\Utils\Strings; +use Bee\Utils\TLogged; use Exception; -use Logger; class SimpleMappingExceptionResolver implements IHandlerExceptionResolver { + use TLogged; const MODEL_HANDLER_EXCEPTION_KEY = 'handler_excpetion'; /** - * @var Logger - */ - protected $log; - - /** - * @return Logger - */ - protected function getLog() { - if (!$this->log) { - $this->log = Logger::getLogger(get_class($this)); - } - return $this->log; - } - - /** * * @var array */ Modified: trunk/framework/Bee/MVC/ViewResolver/BasicViewResolver.php =================================================================== --- trunk/framework/Bee/MVC/ViewResolver/BasicViewResolver.php 2015-02-24 12:56:16 UTC (rev 287) +++ trunk/framework/Bee/MVC/ViewResolver/BasicViewResolver.php 2015-02-24 13:03:39 UTC (rev 288) @@ -22,7 +22,7 @@ use Bee\MVC\IViewResolver; use Bee\MVC\ModelAndView; use Bee\MVC\View\ViewBase; -use Logger; +use Bee\Utils\TLogged; /** * Basic implementation of the IViewResolver interface. Uses a Bee\IContext for view name resolution, looking up @@ -32,23 +32,9 @@ * @author Michael Plomer <mic...@it...> */ class BasicViewResolver implements IViewResolver { + use TLogged; /** - * @var Logger - */ - protected $log; - - /** - * @return Logger - */ - protected function getLog() { - if (!$this->log) { - $this->log = Logger::getLogger(get_class($this)); - } - return $this->log; - } - - /** * Enter description here... * * @var IContext Modified: trunk/framework/Bee/Persistence/Doctrine2/EntityManagerHolder.php =================================================================== --- trunk/framework/Bee/Persistence/Doctrine2/EntityManagerHolder.php 2015-02-24 12:56:16 UTC (rev 287) +++ trunk/framework/Bee/Persistence/Doctrine2/EntityManagerHolder.php 2015-02-24 13:03:39 UTC (rev 288) @@ -15,34 +15,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -use BeeFramework; +use Bee\Utils\TLogged; use \Doctrine\ORM\EntityManager; -use Logger; /** * User: mp * Date: 27.06.13 * Time: 04:17 */ - class EntityManagerHolder { + use TLogged; /** - * @var Logger - */ - protected $log; - - /** - * @return Logger - */ - public function getLog() { - if (!$this->log) { - $this->log = BeeFramework::getLoggerForClass(get_class($this)); - } - return $this->log; - } - - /** * @var EntityManager */ private $entityManager; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |