Creates an MP4Box binary adapter.

@param null|LoggerInterface         $logger
@param array|ConfigurationInterface $conf

@return MP4Box
8489
public static function create($conf = array(), LoggerInterface $logger = null)
    {
        if (!$conf instanceof ConfigurationInterface) {
            $conf = new Configuration($conf);
        }

        $binaries = $conf->get('mp4box.binaries', array('MP4Box'));

        return static::load($binaries, $logger, $conf);
    }
824775
private function exportConfiguredImageBinary(BinaryInterface $binary, ImageInterface $image, array $config): BinaryInterface
    {
        $options = [
            'quality' => $config['quality'],
        ];

        if (isset($config['jpeg_quality'])) {
            $options['jpeg_quality'] = $config['jpeg_quality'];
        }
        if (isset($config['png_compression_level'])) {
            $options['png_compression_level'] = $config['png_compression_level'];
        }
        if (isset($config['png_compression_filter'])) {
            $options['png_compression_filter'] = $config['png_compression_filter'];
        }

        if ('gif' === $binary->getFormat() && $config['animated']) {
            $options['animated'] = $config['animated'];
        }

        $filteredFormat = $config['format'] ?? $binary->getFormat();
        $filteredString = $image->get($filteredFormat, $options);

        $this->destroyImage($image);

        return new Binary(
            $filteredString,
            $filteredFormat === $binary->getFormat() ? $binary->getMimeType() : $this->mimeTypeGuesser->guess($filteredString),
            $filteredFormat
        );
    }
1294119
public function setLogger(LoggerInterface $logger)
    {
        foreach ($this->adapters as $adapter) {
            if ($adapter instanceof LoggerAwareInterface) {
                $adapter->setLogger($logger);
            }
        }
        $this->logger = $logger;
    }
1086226
protected function createFluentDriver(array $config): LoggerInterface
    {
        return new Monolog($this->parseChannel($config), [
            $this->prepareHandler(
                $this->createFluentHandler($config)
            ),
        ]);
    }
1029235
public function buildLogger($class, Configurator $configurator)
    {
        if (!class_exists($class) || !is_subclass_of($class, Logger::class)) {
            $class = "\\Phassets\\Loggers\\$class";
        }

        if (class_exists($class) && is_subclass_of($class, Logger::class)) {
            return new $class($configurator);
        }

        return false;
    }
511401
public function actionCreate( $config = [] ) {

		$model = $this->modelService->getModelObject();

		$model->siteId	= Yii::$app->core->siteId;
		$model->type	= $this->type;

		$content	= new ModelContent();
		$banner		= File::loadFile( null, 'Banner' );
		$video		= File::loadFile( null, 'Video' );

		if( $model->load( Yii::$app->request->post(), $model->getClassName() ) && $content->load( Yii::$app->request->post(), $content->getClassName() ) &&
			$model->validate() && $content->validate() ) {

			$this->model = $this->modelService->create( $model, [ 'admin' => true, 'content' => $content, 'banner' => $banner, 'video' => $video ] );

			return $this->redirect( 'all' );
		}

		$templatesMap = $this->templateService->getIdNameMapByType( $this->templateType, [ 'default' => true ] );

		return $this->render( 'create', [
			'model' => $model,
			'content' => $content,
			'banner' => $banner,
			'video' => $video,
			'templatesMap' => $templatesMap
		]);
	}
96905
public function make(array $config): Vimeo
    {
        $config = $this->getConfig($config);

        return $this->getClient($config);
    }
301252
public static function getInheritanceFinder(ConfigInterface $config) {
        if($config instanceof FileConfig){
            $cacheStrategy = new \Synga\InheritanceFinder\File\CacheStrategy($config);
        } elseif($config instanceof DatabaseConfig){
            $cacheStrategy = new \Synga\InheritanceFinder\Database\CacheStrategy($config);
        }

        return new \Synga\InheritanceFinder\InheritanceFinder(
            new \Synga\InheritanceFinder\CacheBuilder(
                $cacheStrategy,
                new PhpClassParser((new ParserFactory)->create(ParserFactory::PREFER_PHP7), new ClassNodeVisitor()),
                new \Symfony\Component\Finder\Finder(),
                new \Synga\InheritanceFinder\Helpers\FastArrayAccessHelper()
            )
        );
    }
184793
public static function make(string $environment, array $credentials, LoggerInterface $logger = null)
    {
        // If no logger is passed, we will use the null logger
        $flow = new static($logger ?? new NullLogger());

        // Set the credentials, or throw an Exception if there is none
        $flow->setCredentials($credentials);

        // Set the production environment if set explicitly
        $flow->isProduction($environment === 'production');

        // Set the default Guzzle Adapter
        $flow->setAdapter(new GuzzleAdapter($flow));

        // Return a new instance of Flow
        return $flow;
    }
444599
public static function getFactory(
        string $p_base_ns,
        \FreeFW\Application\Config $p_config,
        \Psr\Log\LoggerInterface $p_logger,
        string $p_default_storage = 'default'
    ) {
        if (!array_key_exists($p_base_ns, self::$instances)) {
            self::$instances[$p_base_ns] = new static($p_base_ns, $p_config, $p_logger, $p_default_storage);
        }
        return self::$instances[$p_base_ns];
    }
677643
private function configureLogger(\n2n\log4php\Logger $logger, $config) {
		$loggerName = $logger->getName();
		
		// Set logger level
		if (isset($config['level'])) {
			$level = \n2n\log4php\LoggerLevel::toLevel($config['level']);
			if (isset($level)) {
				$logger->setLevel($level);
			} else {
				$this->warn("Invalid level value [{$config['level']}] specified for logger [$loggerName]. Ignoring level definition.");
			}
		}
		
		// Link appenders to logger
		if (isset($config['appenders'])) {
			foreach($config['appenders'] as $appenderName) {
				if (isset($this->appenders[$appenderName])) {
					$logger->addAppender($this->appenders[$appenderName]);
				} else {
					$this->warn("Nonexistnant appender [$appenderName] linked to logger [$loggerName].");
				}
			}
		}
		
		// Set logger additivity
		if (isset($config['additivity'])) {
			try {
				$additivity = \n2n\log4php\option\OptionConverter::toBooleanEx($config['additivity'], null);
				$logger->setAdditivity($additivity);
			} catch (Exception $ex) {
				$this->warn("Invalid additivity value [{$config['additivity']}] specified for logger [$loggerName]. Ignoring additivity setting.");
			}
		}
	}
84090
public static function getInstance(
        \FreeFW\Application\Config $p_config,
        \Psr\Log\LoggerInterface $p_logger
    ) {
        if (self::$instance === null) {
            self::$instance = new static($p_config, $p_logger);
        }
        return self::$instance;
    }
785455
public function setLogConfig(array $logConfig)
    {
        $this->logConfig = $logConfig;

        $this->hostConfig = array_merge($this->hostConfig, ['LogConfig' => $logConfig]);

        return $this;
    }
700238
public function load(array $config, ContainerBuilder $container)
    {
        $rClass = new \ReflectionClass($this);

        $yamlLoader = new YamlFileLoader(
            $container,
            new FileLocator(dirname($rClass->getFileName()) . '/Resources/config')
        );

        $xmlLoader = new XmlFileLoader(
            $container,
            new FileLocator(dirname($rClass->getFileName()) . '/Resources/config')
        );

        $phpLoader = new PhpFileLoader(
            $container,
            new FileLocator(dirname($rClass->getFileName()) . '/Resources/config')
        );

        $this->registerCustom($container, $config);
        $this->registerConfigFiles($yamlLoader);
        $this->registerYamlConfigFiles($yamlLoader);
        $this->registerXmlConfigFiles($xmlLoader);
        $this->registerPhpConfigFiles($phpLoader);
        $this->registerCompilerPasses($container);

        /** @var CliApplication $application */
        $application = $container->get('application');

        $this->registerCommands($application);

        /** @var TemplatingServiceInterface $templatingService */
        $templatingService = $container->get('common.services.templating');
        $this->registerTemplates($templatingService);
    }
588515
public static function getMessage($mailer, ConfigObject $config = null)
    {
        // Do it this way to avoid merging into the original mailer config
        $mailerConfig = Mailer::getConfig()->get($mailer)->toArray();
        $mailerConfig = new ConfigObject($mailerConfig);
        if ($config) {
            $mailerConfig->mergeWith($config);
        }
        $lib = self::getLibrary($mailer);

        /** @var MailerInterface $libInstance */
        $libInstance = self::factory($lib, MailerInterface::class);

        $instance = $libInstance::getMessage($mailerConfig);
        if (!self::isInstanceOf($instance, MessageInterface::class)) {
            throw new MailerException(MailerException::MESSAGE_INTERFACE);
        }

        return $instance;
    }
1357343
public function applyFilters(BinaryInterface $binary, array $config): BinaryInterface
    {
        if ($binary instanceof FileBinaryInterface) {
            $image = $this->imagine->open($binary->getPath());
        } else {
            $image = $this->imagine->load($binary->getContent());
        }

        foreach ($this->sanitizeFilters($config['filters'] ?? []) as $name => $options) {
            $prior = $image;
            $image = $this->loaders[$name]->load($image, $options);

            if ($prior !== $image) {
                $this->destroyImage($prior);
            }
        }

        return $this->exportConfiguredImageBinary($binary, $image, $config);
    }
1176450
private function createFluentHandler(array $config): HandlerInterface
    {
        $configure = $this->app['config']['fluent'];
        $fluentHandler = $this->detectHandler($configure);
        return new $fluentHandler(
            new FluentLogger(
                $configure['host'] ?? FluentLogger::DEFAULT_ADDRESS,
                (int)$configure['port'] ?? FluentLogger::DEFAULT_LISTEN_PORT,
                $configure['options'] ?? [],
                $this->detectPacker($configure)
            ),
            $configure['tagFormat'] ?? null,
            $this->level($config)
        );
    }