示例#1
0
 /**
  * @return LoggerInterface
  */
 private function getLogger() : LoggerInterface
 {
     if (!$this->logger) {
         $this->logger = LoggerFactory::getLogger(get_class($this));
     }
     return $this->logger;
 }
示例#2
0
 /**
  * Returns a {@link \Psr\Log\LoggerInterface} logger implementation.
  */
 public function getLogger()
 {
     if (null === $this->logger) {
         $this->logger = LoggerFactory::getLogger(__CLASS__);
     }
     return $this->logger;
 }
示例#3
0
 /**
  * Creates a new {@link \bitExpert\Adroit\AdroitMiddleware}.
  *
  * @param \bitExpert\Adroit\Action\Resolver\ActionResolver[] $actionResolvers
  * @param \bitExpert\Adroit\Responder\Resolver\ResponderResolver[] $responderResolvers
  * @param Router $router
  */
 public function __construct(array $actionResolvers, array $responderResolvers, Router $router)
 {
     $this->actionResolvers = $actionResolvers;
     $this->responderResolvers = $responderResolvers;
     $this->router = $router;
     $this->logger = LoggerFactory::getLogger(__CLASS__);
 }
示例#4
0
 /**
  * Creates a new {@link \bitExpert\Adroit\Router\RegexRouter}.
  *
  * @param string $baseURL
  */
 public function __construct($baseURL)
 {
     // completes the base url with a / if not set in configuration
     $this->baseURL = rtrim($baseURL, '/') . '/';
     $this->defaultActionToken = null;
     $this->routes = [];
     $this->logger = LoggerFactory::getLogger(__CLASS__);
 }
示例#5
0
 /**
  * Creates a new {@link \bitExpert\Pathfinder\RegexRouter}.
  *
  * @param string $baseURL
  */
 public function __construct($baseURL)
 {
     // completes the base url with a / if not set in configuration
     $this->baseURL = rtrim($baseURL, '/') . '/';
     $this->defaultTarget = null;
     $this->targetRequestAttribute = self::DEFAULT_TARGET_REQUEST_ATTRIBUTE;
     $this->routes = [];
     $this->logger = LoggerFactory::getLogger(__CLASS__);
 }
 /**
  * @test
  */
 public function channelParamIsPassedToCallable()
 {
     $loggerMock = $this->getMock('\\Psr\\Log\\LoggerInterface');
     LoggerFactory::registerFactoryCallback(function ($channel) use($loggerMock) {
         $loggerMock->channel = $channel;
         return $loggerMock;
     });
     $logger = LoggerFactory::getLogger('test');
     $this->assertSame('test', $logger->channel);
 }
示例#7
0
 /**
  * Creates a new {@link \bitExpert\AddItEasy\Cli\Command\ExportCommand}.
  *
  * @param Adrenaline $app
  * @param string $exportDir
  * @param string $dataDir
  * @param string $assetDir
  */
 public function __construct(Adrenaline $app, $exportDir, $dataDir, $assetDir)
 {
     parent::__construct('export');
     $this->setDescription('Runs the static site export process');
     $this->app = $app;
     $this->exportDir = realpath($exportDir);
     $this->dataDir = realpath($dataDir);
     $this->assetDir = realpath($assetDir);
     $this->logger = LoggerFactory::getLogger(__CLASS__);
 }
示例#8
0
<?php

/*
 * This file is part of the Pathfinder package.
 *
 * (c) bitExpert AG
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
declare (strict_types=1);
// include and configure Composer autoloader
include __DIR__ . '/../vendor/autoload.php';
// configure the Simple Logging Facade for PSR-3 loggers with a Monolog backend
\bitExpert\Slf4PsrLog\LoggerFactory::registerFactoryCallback(function ($channel) {
    if (!\Monolog\Registry::hasLogger($channel)) {
        \Monolog\Registry::addLogger(new \Monolog\Logger($channel));
    }
    return \Monolog\Registry::getInstance($channel);
});
 /**
  * Creates a new {@link \bitExpert\Http\Middleware\Psr7\Prophiler\ProphilerMiddleware}.
  *
  * @param Toolbar $toolbar
  */
 public function __construct(Toolbar $toolbar)
 {
     $this->toolbar = $toolbar;
     $this->logger = LoggerFactory::getLogger(__CLASS__);
 }
示例#10
0
 /**
  * Creates a new {@link \bitExpert\AddItEasy\Http\Action\HandlePageAction}.
  *
  * @param $basePath
  */
 public function __construct($basePath)
 {
     $this->basePath = $basePath;
     $this->logger = LoggerFactory::getLogger(__CLASS__);
 }
 /**
  * Creates a new {@link \bitExpert\AddItEasy\Http\Middleware\PageNotFoundMiddleware}.
  */
 public function __construct()
 {
     $this->logger = LoggerFactory::getLogger(__CLASS__);
 }
示例#12
0
 /**
  * Creates a new {@link \bitExpert\Pathfinder\AbstractRouter}.
  *
  * @param Route[] routes
  * @throws \InvalidArgumentException
  * @throws \RuntimeException
  */
 public function __construct(array $routes = [])
 {
     $this->routes = [];
     $this->setRoutes($routes);
     $this->logger = LoggerFactory::getLogger(__CLASS__);
 }
示例#13
0
 /**
  * Creates a new {\bitExpert\AddItEasy\Http\Responder\TwigResponder}.
  *
  * @param \Twig_Environment $twig
  * @param array $siteParams key/value collection of default global variables
  */
 public function __construct(\Twig_Environment $twig, array $siteParams)
 {
     $this->twig = $twig;
     $this->siteParams = $siteParams;
     $this->logger = LoggerFactory::getLogger(__CLASS__);
 }
示例#14
0
 /**
  * Creates a new {@link \bitExpert\AddItEasy\Cli\Command\InitCommand}.
  */
 public function __construct()
 {
     parent::__construct('init');
     $this->setDescription('Creates initial filesystem layout for a new project');
     $this->logger = LoggerFactory::getLogger(__CLASS__);
 }
示例#15
0
 /**
  * Creates a new {@link \bitExpert\Adroit\Action\Resolver\ContainerAwareActionResolver}.
  *
  * @param ContainerInterface $container
  * @throws \RuntimeException
  */
 public function __construct(ContainerInterface $container)
 {
     $this->container = $container;
     $this->logger = LoggerFactory::getLogger(__CLASS__);
 }
示例#16
0
 /**
  * Creates a new {@link \bitExpert\AddItEasy\Twig\PageBlockProvider}.
  *
  * @param $basePath
  * @param Twig_Environment $twigEnv
  */
 public function __construct($basePath, Twig_Environment $twigEnv)
 {
     $this->basePath = $basePath;
     $this->twigEnv = $twigEnv;
     $this->logger = LoggerFactory::getLogger(__CLASS__);
 }
 /**
  * Creates a new {@link \bitExpert\AddItEasy\Http\Action\HandleDefaultPageAction}.
  *
  * @param string $basePath
  * @param string $defaultPage
  */
 public function __construct($basePath, $defaultPage)
 {
     $this->basePath = $basePath;
     $this->defaultPage = $defaultPage;
     $this->logger = LoggerFactory::getLogger(__CLASS__);
 }
 /**
  * @param Resolver[] | Resolver $resolvers
  * @throws \InvalidArgumentException
  */
 public function __construct(array $resolvers)
 {
     $this->logger = LoggerFactory::getLogger(__CLASS__);
     $this->resolvers = $resolvers;
 }
示例#19
0
 * This file is part of the addItEasy package.
 *
 * (c) bitExpert AG
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require __DIR__ . '/../config/config.inc.php';
// Configure logger infrastructure
if (isset($APP_CONF['logger'], $APP_CONF['logger']['logfile'], $APP_CONF['logger']['level'])) {
    // configure the Simple Logging Facade for PSR-3 loggers with a Monolog backend
    \bitExpert\Slf4PsrLog\LoggerFactory::registerFactoryCallback(function ($channel) use($APP_CONF) {
        if (!\Monolog\Registry::hasLogger($channel)) {
            $handler = new \Monolog\Handler\StreamHandler($APP_CONF['logger']['logfile'], $APP_CONF['logger']['level']);
            $log = new \Monolog\Logger('name');
            $log->pushHandler($handler);
            \Monolog\Registry::addLogger($log, $channel);
            return $log;
        }
        return \Monolog\Registry::getInstance($channel);
    });
}
// Create Disco cache dir
if (isset($APP_CONF['di'], $APP_CONF['di']['cache']) and !is_dir($APP_CONF['di']['cache'])) {
    @mkdir($APP_CONF['di']['cache'], 0777, true);
}
// Configure and set up the BeanFactory instance
$config = new \bitExpert\Disco\BeanFactoryConfiguration($APP_CONF['di']['cache'], null, null, !$APP_CONF['di']['devMode']);
$beanFactory = new \bitExpert\Disco\AnnotationBeanFactory($APP_CONF['di']['config'], $APP_CONF, $config);
\bitExpert\Disco\BeanFactoryRegistry::register($beanFactory);
$request = \Zend\Diactoros\ServerRequestFactory::fromGlobals();
$response = new \Zend\Diactoros\Response();