LoggerInterface PHP Class Code Examples

This page contains top rated real world PHP examples of class LoggerInterface extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: Handler.php Project: guduchango/limoncello-collins
0
 /**
  * @param LoggerInterface $log
  */
 public function __construct(LoggerInterface $log)
 {
     parent::__construct($log);
     $this->integration = new LaravelIntegration();
     $this->renderContainer = new RendererContainer($this->integration);
     $this->registerCustomExceptions();
 }
Example #2
Show file File: TwigFormulaLoader.php Project: xabbuh/LiipThemeBundle
0
 public function __construct(\Twig_Environment $twig, LoggerInterface $logger = null, ActiveTheme $activeTheme = null)
 {
     parent::__construct($twig, $logger);
     $this->activeTheme = $activeTheme;
     $this->twig = $twig;
     $this->logger = $logger;
 }
Example #3
Show file File: RedisConnectionPool.php Project: jpena88/mediawiki-dokku-deploy
0
 /**
  * @param RedisConnectionPool $pool
  * @param string $server
  * @param Redis $conn
  * @param LoggerInterface $logger
  */
 public function __construct(RedisConnectionPool $pool, $server, Redis $conn, LoggerInterface $logger)
 {
     $this->pool = $pool;
     $this->server = $server;
     $this->conn = $conn;
     $this->logger = $logger;
 }
Example #4
Show file File: UpdateEmailOriginTableQuery.php Project: Maksold/platform
0
 /**
  * @param LoggerInterface $logger
  * @param bool $dryRun
  *
  * @throws \Doctrine\DBAL\DBALException
  */
 protected function doExecute(LoggerInterface $logger, $dryRun = false)
 {
     $dbDriver = $this->connection->getDriver()->getName();
     switch ($dbDriver) {
         case DatabaseDriverInterface::DRIVER_POSTGRESQL:
             $query = <<<SQL
ATE oro_email_origin AS eo SET owner_id = ueo.user_id
ROM oro_user_email_origin AS ueo WHERE ueo.origin_id = eo.id;
ATE oro_email_origin AS eo SET organization_id = u.organization_id
ROM oro_user AS u WHERE u.id = eo.owner_id;
;
             break;
         case DatabaseDriverInterface::DRIVER_MYSQL:
         default:
             $query = <<<SQL
ATE oro_email_origin eo SET eo.owner_id =
SELECT ueo.user_id FROM oro_user_email_origin ueo WHERE ueo.origin_id = eo.id);
ATE oro_email_origin eo SET eo.organization_id =
SELECT u.organization_id FROM oro_user u WHERE u.id = eo.owner_id);
;
             break;
     }
     $this->logQuery($logger, $query);
     if (!$dryRun) {
         $this->connection->executeUpdate($query);
     }
 }
Example #5
Show file File: Export.php Project: hientruong90/magento2_installer
0
 /**
  * @param \Psr\Log\LoggerInterface $logger
  * @param \Magento\Framework\Filesystem $filesystem
  * @param \Magento\ImportExport\Model\Export\ConfigInterface $exportConfig
  * @param \Magento\ImportExport\Model\Export\Entity\Factory $entityFactory
  * @param \Magento\ImportExport\Model\Export\Adapter\Factory $exportAdapterFac
  * @param array $data
  */
 public function __construct(\Psr\Log\LoggerInterface $logger, \Magento\Framework\Filesystem $filesystem, \Magento\ImportExport\Model\Export\ConfigInterface $exportConfig, \Magento\ImportExport\Model\Export\Entity\Factory $entityFactory, \Magento\ImportExport\Model\Export\Adapter\Factory $exportAdapterFac, array $data = [])
 {
     $this->_exportConfig = $exportConfig;
     $this->_entityFactory = $entityFactory;
     $this->_exportAdapterFac = $exportAdapterFac;
     parent::__construct($logger, $filesystem, $data);
 }
Example #6
Show file File: Worker.php Project: ly827/gearman
0
 /**
  * @param Config $config
  * @param null|LoggerInterface $logger
  * @throws ServerConnectionException
  */
 public function __construct(Config $config, LoggerInterface $logger = null)
 {
     $this->setConfig($config);
     if (null !== $logger) {
         $this->setLogger($logger);
     }
 }
Example #7
Show file File: UpdateCustomEntityOwnerQuery.php Project: Maksold/platform
0
 /**
  * @param LoggerInterface $logger
  * @param bool            $dryRun
  */
 protected function migrateConfigs(LoggerInterface $logger, $dryRun = false)
 {
     $query = 'SELECT cf.id, c.class_name, cf.data' . ' FROM oro_entity_config c' . ' INNER JOIN oro_entity_config_field cf ON cf.entity_id = c.id' . ' WHERE cf.field_name = :field';
     $params = ['field' => 'owner'];
     $types = ['field' => Type::STRING];
     $this->logQuery($logger, $query, $params, $types);
     $updateQueries = [];
     // prepare update queries
     $rows = $this->connection->fetchAll($query, $params, $types);
     foreach ($rows as $row) {
         if (strpos($row['class_name'], 'Extend\\Entity\\') !== 0) {
             continue;
         }
         $data = $this->connection->convertToPHPValue($row['data'], 'array');
         if (isset($data['entity']['label']) && $data['entity']['label'] === 'Owner') {
             $data['entity']['label'] = self::NEW_OWNER_LABEL;
             $data['entity']['description'] = self::NEW_OWNER_DESCRIPTION;
             $id = $row['id'];
             $updateQueries[] = ['UPDATE oro_entity_config_field SET data = :data, mode = :mode WHERE id = :id', ['id' => $id, 'mode' => ConfigModel::MODE_DEFAULT, 'data' => $data], ['id' => Type::INTEGER, 'mode' => Type::STRING, 'data' => Type::TARRAY]];
             $updateQueries[] = ['UPDATE oro_entity_config_index_value SET value = :value' . ' WHERE field_id = :id AND scope = :scope AND code = :code', ['id' => $id, 'scope' => 'entity', 'code' => 'label', 'value' => self::NEW_OWNER_LABEL], ['id' => Type::INTEGER, 'scope' => Type::STRING, 'code' => Type::STRING, 'value' => Type::STRING]];
         }
     }
     // execute update queries
     foreach ($updateQueries as $val) {
         $this->logQuery($logger, $val[0], $val[1], $val[2]);
         if (!$dryRun) {
             $this->connection->executeUpdate($val[0], $val[1], $val[2]);
         }
     }
 }
Example #8
Show file File: Cache.php Project: mickaelsteinberg/BackBee
0
 /**
  * Class constructor.
  *
  * @param array                    $options Initial options for the cache adapter:
  *                                          - em \Doctrine\ORM\EntityManager  Optional, an already defined EntityManager (simply returns it)
  *                                          - dbal array Optional, an array of Doctrine connection options among:
  *                                          - connection  \Doctrine\DBAL\Connection  Optional, an already initialized database connection
  *                                          - proxy_dir   string                     The proxy directory
  *                                          - proxy_ns    string                     The namespace for Doctrine proxy
  *                                          - charset     string                     Optional, the charset to use
  *                                          - collation   string                     Optional, the collation to use
  *                                          - ...         mixed                      All the required parameter to open a new connection
  * @param string                   $context An optional cache context
  * @param \Psr\Log\LoggerInterface $logger  An optional logger
  *
  * @throws \BackBee\Cache\Exception\CacheException Occurs if the entity manager for this cache adaptor cannot be created
  */
 public function __construct(array $options = array(), $context = null, LoggerInterface $logger = null)
 {
     parent::__construct($options, $context, $logger);
     $this->setEntityManager();
     $this->setEntityRepository();
     $this->setPrefixKey();
 }
Example #9
Show file File: UpdateEntityConfigFieldValueQuery.php Project: Maksold/platform
0
 /**
  * @param LoggerInterface $logger
  * @param bool            $dryRun
  */
 protected function updateFieldConfig(LoggerInterface $logger, $dryRun = false)
 {
     $sql = 'SELECT f.id, f.data
         FROM oro_entity_config_field as f
         INNER JOIN oro_entity_config as e ON f.entity_id = e.id
         WHERE e.class_name = ?
         AND field_name = ?
         LIMIT 1';
     $parameters = [$this->entityName, $this->fieldName];
     $row = $this->connection->fetchAssoc($sql, $parameters);
     if ($row) {
         $data = $row['data'];
         $id = $row['id'];
         $data = $data ? $this->connection->convertToPHPValue($data, Type::TARRAY) : [];
         if ($this->isDoUpdate($data)) {
             $data[$this->scope][$this->code] = $this->value;
             $data = $this->connection->convertToDatabaseValue($data, Type::TARRAY);
             // update field itself
             $sql = 'UPDATE oro_entity_config_field SET data = ? WHERE id = ?';
             $parameters = [$data, $id];
             $this->logQuery($logger, $sql, $parameters);
             if (!$dryRun) {
                 $statement = $this->connection->prepare($sql);
                 $statement->execute($parameters);
             }
         }
     }
 }
Example #10
Show file File: EmailNotificationProcessor.php Project: Maksold/platform
0
 /**
  * Applies the given notifications to the given object
  *
  * @param mixed                        $object
  * @param EmailNotificationInterface[] $notifications
  * @param LoggerInterface              $logger Override for default logger. If this parameter is specified
  *                                             this logger will be used instead of a logger specified
  *                                             in the constructor
  */
 public function process($object, $notifications, LoggerInterface $logger = null)
 {
     if (!$logger) {
         $logger = $this->logger;
     }
     foreach ($notifications as $notification) {
         $emailTemplate = $notification->getTemplate();
         try {
             list($subjectRendered, $templateRendered) = $this->renderer->compileMessage($emailTemplate, ['entity' => $object]);
         } catch (\Twig_Error $e) {
             $identity = method_exists($emailTemplate, '__toString') ? (string) $emailTemplate : $emailTemplate->getSubject();
             $logger->error(sprintf('Rendering of email template "%s" failed. %s', $identity, $e->getMessage()), ['exception' => $e]);
             continue;
         }
         $senderEmail = $this->cm->get('oro_notification.email_notification_sender_email');
         $senderName = $this->cm->get('oro_notification.email_notification_sender_name');
         if ($notification instanceof SenderAwareEmailNotificationInterface && $notification->getSenderEmail()) {
             $senderEmail = $notification->getSenderEmail();
             $senderName = $notification->getSenderName();
         }
         if ($emailTemplate->getType() == 'txt') {
             $type = 'text/plain';
         } else {
             $type = 'text/html';
         }
         foreach ((array) $notification->getRecipientEmails() as $email) {
             $message = \Swift_Message::newInstance()->setSubject($subjectRendered)->setFrom($senderEmail, $senderName)->setTo($email)->setBody($templateRendered, $type);
             $this->mailer->send($message);
         }
         $this->addJob(self::SEND_COMMAND);
     }
 }
Example #11
Show file File: FFMpeg.php Project: unionbt/hanpaimall
0
 /**
  * Creates a new FFMpeg instance.
  *
  * @param array|ConfigurationInterface $configuration
  * @param LoggerInterface              $logger
  * @param FFProbe                      $probe
  *
  * @return FFMpeg
  */
 public static function create($configuration = array(), LoggerInterface $logger = null, FFProbe $probe = null)
 {
     if (null === $probe) {
         $probe = FFProbe::create($configuration, $logger, null);
     }
     return new static(FFMpegDriver::create($logger, $configuration), $probe);
 }
Example #12
Show file File: JobRunner.php Project: xiebinyi/mediawiki
0
 /**
  * @param LoggerInterface $logger
  */
 public function __construct(LoggerInterface $logger = null)
 {
     if ($logger === null) {
         $logger = LoggerFactory::getInstance('runJobs');
     }
     $this->setLogger($logger);
 }
Example #13
Show file File: DeleteEmailPermissionConfig.php Project: ramunasd/platform
0
 protected function doExecute(LoggerInterface $logger, $dryRun = false)
 {
     $sql = "DELETE FROM oro_entity_config_index_value\n            WHERE\n                entity_id = (SELECT id FROM oro_entity_config WHERE class_name = ? LIMIT 1) AND\n                field_id IS NULL AND\n                scope = ? AND\n                code = ?\n            ";
     $className = 'Oro\\Bundle\\EmailBundle\\Entity\\Email';
     $scope = 'security';
     $parameters = [$className, $scope, 'permissions'];
     $statement = $this->connection->prepare($sql);
     if (!$dryRun) {
         $statement->execute($parameters);
     }
     $this->logQuery($logger, $sql, $parameters);
     // update entity config cached data
     $sql = 'SELECT data FROM oro_entity_config WHERE class_name = ? LIMIT 1';
     $parameters = [$className];
     $data = $this->connection->fetchColumn($sql, $parameters);
     $this->logQuery($logger, $sql, $parameters);
     $data = $data ? $this->connection->convertToPHPValue($data, Type::TARRAY) : [];
     if (array_key_exists($scope, $data)) {
         unset($data[$scope]);
     }
     $data = $this->connection->convertToDatabaseValue($data, Type::TARRAY);
     $sql = 'UPDATE oro_entity_config SET data = ? WHERE class_name = ?';
     $parameters = [$data, $className];
     $statement = $this->connection->prepare($sql);
     if (!$dryRun) {
         $statement->execute($parameters);
     }
     $this->logQuery($logger, $sql, $parameters);
 }
Example #14
Show file File: ActivityListMigrationQuery.php Project: Maksold/platform
0
 /**
  * @param LoggerInterface $logger
  * @param bool            $dryRun
  */
 protected function runActivityLists(LoggerInterface $logger, $dryRun = false)
 {
     // @todo: this workaround should be removed in BAP-9156
     $this->configManager->clear();
     $targetEntities = $this->provider->getTargetEntityClasses();
     $toSchema = clone $this->schema;
     $hasSchemaChanges = false;
     foreach ($targetEntities as $targetEntity) {
         $associationName = ExtendHelper::buildAssociationName($targetEntity, ActivityListEntityConfigDumperExtension::ASSOCIATION_KIND);
         $relationTableName = $this->nameGenerator->generateManyToManyJoinTableName(ActivityListEntityConfigDumperExtension::ENTITY_CLASS, $associationName, $targetEntity);
         if (!$toSchema->hasTable($relationTableName)) {
             $hasSchemaChanges = true;
             $this->activityListExtension->addActivityListAssociation($toSchema, $this->metadataHelper->getTableNameByEntityClass($targetEntity));
         }
     }
     if ($hasSchemaChanges) {
         $comparator = new Comparator();
         $platform = $this->connection->getDatabasePlatform();
         $schemaDiff = $comparator->compare($this->schema, $toSchema);
         $queries = $schemaDiff->toSql($platform);
         foreach ($queries as $query) {
             $this->logQuery($logger, $query);
             if (!$dryRun) {
                 $this->connection->executeQuery($query);
             }
         }
     }
 }
Example #15
Show file File: LoadEntityConfigStateMigrationQuery.php Project: Maksold/platform
0
 /**
  * @param LoggerInterface $logger
  */
 protected function loadEntityConfigStates(LoggerInterface $logger)
 {
     if (!$this->connection->getSchemaManager()->tablesExist(['oro_entity_config', 'oro_entity_config_field'])) {
         return;
     }
     $entityConfigs = [];
     $sql = 'SELECT e.class_name, e.data FROM oro_entity_config e';
     $this->logQuery($logger, $sql);
     foreach ($this->connection->fetchAll($sql) as $row) {
         $data = $this->connection->convertToPHPValue($row['data'], 'array');
         if (isset($data['extend']['state']) && $data['extend']['state'] !== ExtendScope::STATE_ACTIVE) {
             $entityConfigs[$row['class_name']] = $data['extend']['state'];
         }
     }
     $fieldConfigs = [];
     $sql = 'SELECT e.class_name, f.field_name, f.data ' . 'FROM oro_entity_config e ' . 'INNER JOIN oro_entity_config_field f ON f.entity_id = e.id';
     $this->logQuery($logger, $sql);
     foreach ($this->connection->fetchAll($sql) as $row) {
         $data = $this->connection->convertToPHPValue($row['data'], 'array');
         if (isset($data['extend']['state']) && $data['extend']['state'] !== ExtendScope::STATE_ACTIVE) {
             $fieldConfigs[$row['class_name']][$row['field_name']] = $data['extend']['state'];
         }
     }
     $this->storage->set('initial_entity_config_state', ['entities' => $entityConfigs, 'fields' => $fieldConfigs]);
 }
Example #16
Show file File: FFProbe.php Project: unionbt/hanpaimall
0
 /**
  * @api
  *
  * Creates an FFProbe.
  *
  * @param array|ConfigurationInterface $configuration
  * @param LoggerInterface              $logger
  * @param Cache                        $cache
  *
  * @return FFProbe
  */
 public static function create($configuration = array(), LoggerInterface $logger = null, Cache $cache = null)
 {
     if (null === $cache) {
         $cache = new ArrayCache();
     }
     return new static(FFProbeDriver::create($configuration, $logger), $cache);
 }
Example #17
Show file File: Decrypter.php Project: Shalmezad/saml2
0
 public function __construct(\Psr\Log\LoggerInterface $logger, SAML2_Configuration_IdentityProvider $identityProvider, SAML2_Configuration_ServiceProvider $serviceProvider, SAML2_Certificate_PrivateKeyLoader $privateKeyLoader)
 {
     $this->logger = $logger;
     $this->identityProvider = $identityProvider;
     $this->serviceProvider = $serviceProvider;
     $this->privateKeyLoader = $privateKeyLoader;
 }
Example #18
Show file File: AbstractCache.php Project: mickaelsteinberg/BackBee
0
 /**
  * Class constructor.
  *
  * @param array                    $options An array of options allowing to construct the cache adapter
  * @param string                   $context An optional cache context
  * @param \Psr\Log\LoggerInterface $logger  An optional logger
  *
  * @throws \BackBee\Cache\Exception\CacheException Occurs if the cache adapter cannot be construct
  * @codeCoverageIgnore
  */
 public function __construct(array $options = array(), $context = null, LoggerInterface $logger = null)
 {
     $this->_instance_options = array_merge($this->_default_instance_options, $this->_instance_options);
     $this->setContext($context);
     $this->setLogger($logger);
     $this->setInstanceOptions($options);
 }