public function makeOptions($siteOptions, $compressOptions) { foreach ($compressOptions as $key => $value) { $compressOptions[$key] = true; } $this->curOptions = array_replace_recursive($this->defaultOptions, array("site" => $siteOptions, "compress" => $compressOptions)); }
/** * Set up application environment * * This sets up the PHP environment, loads the provided module and returns * the MVC application. * * @param string $module Module to load * @param bool $addTestConfig Add config for test environment (enable all debug options, no config file) * @param array $applicationConfig Extends default application config * @return \Zend\Mvc\Application * @codeCoverageIgnore */ public static function init($module, $addTestConfig = false, $applicationConfig = array()) { // Set up PHP environment. session_cache_limiter('nocache'); // Default headers to prevent caching return \Zend\Mvc\Application::init(array_replace_recursive(static::getApplicationConfig($module, $addTestConfig), $applicationConfig)); }
/** * Constructor * @param array $opts */ public function __construct(array $opts) { // merging options $this->options = array_replace_recursive($this->options, $opts); // getting a client object $this->client = $this->getClient(); }
/** * Merges new config values with the existing ones (overriding) * * @param array $config */ public function merge(array $config) { // override defaults with given config if (!empty($config['config']) && is_array($config['config'])) { $this->config = array_replace_recursive($this->config, $config['config']); } if (!empty($config['repositories']) && is_array($config['repositories'])) { $this->repositories = array_reverse($this->repositories, true); $newRepos = array_reverse($config['repositories'], true); foreach ($newRepos as $name => $repository) { // disable a repository by name if (false === $repository) { unset($this->repositories[$name]); continue; } // disable a repository with an anonymous {"name": false} repo if (1 === count($repository) && false === current($repository)) { unset($this->repositories[key($repository)]); continue; } // store repo if (is_int($name)) { $this->repositories[] = $repository; } else { $this->repositories[$name] = $repository; } } $this->repositories = array_reverse($this->repositories, true); } }
/** * @return array */ public function productCreationProvider() { $productBuilder = function ($data) { return array_replace_recursive($this->getSimpleProductData(), $data); }; return [[$productBuilder([ProductInterface::TYPE_ID => 'simple', ProductInterface::SKU => 'psku-test-1'])], [$productBuilder([ProductInterface::TYPE_ID => 'virtual', ProductInterface::SKU => 'psku-test-2'])]]; }
protected function getTable($name) { $table = (include_once dirname($this->getFileLocation()) . "/" . $this->getFolderLocation() . "/" . $name . ".php"); $table = array_replace_recursive($this->tableDefault, $table); foreach ($table["fields"] as $name => $field) { $table["fields"][$name] = array_merge($this->tableFieldDefault, $field); if (!isset($field["label"])) { $table["fields"][$name]["label"] = ucwords($name); } if (!in_array($this->tableAction, array("data", "update", "delete", "insert", "reorder"))) { // page $_list = $table["fields"][$name]["_list"]; if (is_array($_list)) { $list = array(); $rows = $_list["src"](); foreach ($rows as $row) { $idField = $_list["primary"]; $displayAttrField = $_list["displayAttr"]; $list["" . $row->{$idField}] = $row->{$displayAttrField}; } $table["fields"][$name]["list"] = $list; } } } $table["url"] = $this->md($this->id . "/" . $table["tableAlias"], false); if ($table["actions"]["_view"] == "*") { $table["actions"]["_view"] = array(); foreach ($table["fields"] as $column => $field) { $table["actions"]["_view"][] = $column; } } $table["multiPages"] = $table["editType"] == "page" || $table["viewType"] == "page" || $table["createType"] == "page"; return $table; }
public function tests() { PHPUsableTest::$current_test = $this; describe('Arrays', function ($test) { describe('Merge', function ($test) { it('should not convert scalars to arrays', function ($test) { $a = array('level 1' => array('level 2' => 2)); $b = array('level 1' => array('level 2' => 5)); $test->expect(array_replace_recursive($a, $b))->to->eql(array('level 1' => array('level 2' => 5))); }); it('should unionize arrays', function ($test) { $a = array('level 1' => array('level 2' => array(2, 3))); $b = array('level 1' => array('level 2' => array(5))); $test->expect(array_replace_recursive($a, $b))->to->eql(array('level 1' => array('level 2' => array(5, 3)))); }); }); describe('Get', function ($test) { it('should get a single level value', function ($test) { $arr = array('planets' => 'pluto'); $test->expect(Arrays::get($arr, 'planets'))->to->eql('pluto'); }); it('should get a multi level value', function ($test) { $arr = array('milky_way' => array('planets' => array('earth'))); $test->expect(Arrays::get($arr, 'milky_way.planets'))->to->eql(array('earth')); }); it('should return null for an undefined key', function ($test) { $arr = array('milky_way' => array('planets' => array('earth'))); $test->expect(Arrays::get($arr, 'andromeda.planets'))->to->eql(null); }); }); }); }
/** * @param Container $container */ public function __construct(Container $container, array $config, $debug = false) { $this->container = $container; $config['debug'] = $debug; $this->config = array_replace_recursive($this->config, $config); $container->registerFactory($this); }
/** * @param array $options * @param JobBuilderInterface|null $jobBuilder * @return FileConversionClient */ public static function factory($options = array(), JobBuilderInterface $jobBuilder = null) { // $requiredOptions = array( // 'application_id', // ); // // foreach ($requiredOptions as $optionName) { // if (!isset($options[$optionName]) || $options[$optionName] === '') { // throw new Exception\InvalidArgumentException( // sprintf('Missing required configuration option "%s"', $optionName) // ); // } // } $defaultOptions = array('base_url' => 'https://dws-fileconversion.detailnet.ch/api', 'defaults' => array('connect_timeout' => 10, 'timeout' => 60)); $headers = array('Accept' => 'application/json', 'User-Agent' => 'dfw-fileconversion/' . self::CLIENT_VERSION); if (isset($options[self::OPTION_APP_ID])) { $headers[self::HEADER_APP_ID] = $options[self::OPTION_APP_ID]; } if (isset($options[self::OPTION_APP_KEY])) { $headers[self::HEADER_APP_KEY] = $options[self::OPTION_APP_KEY]; } // These are always applied $overrideOptions = array('defaults' => array('exceptions' => false, 'headers' => $headers)); // Apply options $config = array_replace_recursive($defaultOptions, $options, $overrideOptions); $httpClient = new HttpClient($config); $httpClient->getEmitter()->attach(new Subscriber\Http\ProcessError()); $description = new ServiceDescription(require __DIR__ . '/ServiceDescription/FileConversion.php'); $client = new static($httpClient, $description, $jobBuilder); return $client; }
public static function factory($options = array()) { // $requiredOptions = array(); // // foreach ($requiredOptions as $optionName) { // if (!isset($options[$optionName]) || $options[$optionName] === '') { // throw new Exception\InvalidArgumentException( // sprintf('Missing required configuration option "%s"', $optionName) // ); // } // } // These are applied if not otherwise specified $defaultOptions = array('base_url' => self::getDefaultServiceUrl(), 'defaults' => array('connect_timeout' => 10, 'timeout' => 60)); $headers = array('Accept' => 'application/json', 'User-Agent' => 'denner-client/' . self::CLIENT_VERSION); if (isset($options[self::OPTION_APP_ID])) { $headers[self::HEADER_APP_ID] = $options[self::OPTION_APP_ID]; } if (isset($options[self::OPTION_APP_KEY])) { $headers[self::HEADER_APP_KEY] = $options[self::OPTION_APP_KEY]; } // These are always applied $overrideOptions = array('defaults' => array('exceptions' => false, 'headers' => $headers)); // Apply options $config = array_replace_recursive($defaultOptions, $options, $overrideOptions); $httpClient = new HttpClient($config); $httpClient->getEmitter()->attach(new Subscriber\Http\ProcessError()); $serviceDescriptionFile = __DIR__ . sprintf('/ServiceDescription/%s.php', self::getServiceDescriptionName()); if (!file_exists($serviceDescriptionFile)) { throw new Exception\RuntimeException(sprintf('Service description does not exist at "%s"', $serviceDescriptionFile)); } $description = new ServiceDescription(require $serviceDescriptionFile); $client = new static($httpClient, $description); return $client; }
/** * @param array $configuration * * @return Configuration */ protected function makeConfiguration(array $configuration) { $defaults = ['paths' => ['app' => realpath(getcwd() . '/..'), 'cache' => realpath(__DIR__ . '/../cache'), 'views' => realpath(__DIR__ . '/../views'), 'deployer' => realpath(getcwd())], 'allowed_ips' => ['127.0.0.1'], 'scm' => ['url' => 'git@github.com:foo/bar.git', 'branch' => 'master'], 'tasks' => [Deploy::class]]; $configuration = array_replace_recursive($defaults, $configuration); $configuration = new Configuration($configuration); return $configuration; }
/** * Sets up the Aimeos environemnt * * @param string $extdir Absolute or relative path to the Aimeos extension directory * @return \Aimeos\Slim\Bootstrap Self instance */ public function setup($extdir = '../ext') { $container = $this->app->getContainer(); $container['router'] = function ($c) { return new \Aimeos\Slim\Router(); }; $container['mailer'] = function ($c) { return \Swift_Mailer::newInstance(\Swift_SendmailTransport::newInstance()); }; $default = (require __DIR__ . DIRECTORY_SEPARATOR . 'aimeos-default.php'); $settings = array_replace_recursive($default, $this->settings); $container['aimeos'] = function ($c) use($extdir) { return new \Aimeos\Bootstrap((array) $extdir, false); }; $container['aimeos_config'] = function ($c) use($settings) { return new \Aimeos\Slim\Base\Config($c, $settings); }; $container['aimeos_context'] = function ($c) { return new \Aimeos\Slim\Base\Context($c); }; $container['aimeos_i18n'] = function ($c) { return new \Aimeos\Slim\Base\I18n($c); }; $container['aimeos_locale'] = function ($c) { return new \Aimeos\Slim\Base\Locale($c); }; $container['aimeos_page'] = function ($c) { return new \Aimeos\Slim\Base\Page($c); }; $container['aimeos_view'] = function ($c) { return new \Aimeos\Slim\Base\View($c); }; return $this; }
/** * @param ServiceLocatorInterface $serviceLocator * @param string $name * @param string $requestedName * @param callable $callback * @return SimpleRouteStack * @throws Exception */ public function createDelegatorWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName, $callback) { /* @var $router TreeRouteStack */ $router = $callback(); if ($router instanceof SimpleRouteStack) { return $router; } $config = $serviceLocator->get('Config'); $doCompileOnRequest = (bool) $config['annotated_router']['compile_on_request']; $cacheFile = $config['annotated_router']['cache_file']; $useCache = $config['annotated_router']['use_cache']; $annotatedRouterConfig = array(); if ($doCompileOnRequest) { $annotatedRouterConfig = $serviceLocator->get('AnnotatedRouter\\ControllerParser')->getRouteConfig(); } else { if ($useCache) { if (file_exists($cacheFile)) { $annotatedRouterConfig = (include $cacheFile); } else { throw new Exception('Cache file: "' . $cacheFile . '" does not exists.'); } } } $defaultRouterConfig = isset($config['router']['routes']) ? $config['router']['routes'] : array(); $mergedRouterConfig = array_replace_recursive($annotatedRouterConfig, $defaultRouterConfig); $router->addRoutes($mergedRouterConfig); return $router; }
/** * Execute this configuration handler. * * @param AgaviXmlConfigDomDocument $document configuration document * * @return string data to be written to a cache file */ public function execute(AgaviXmlConfigDomDocument $document) { $document->setDefaultNamespace(self::XML_NAMESPACE, 'view_templates'); $all_view_templates = []; // iterate over configuration nodes and collect templates foreach ($document->getConfigurationElements() as $configuration) { $all_view_templates = array_merge($all_view_templates, $this->parseViewTemplates($configuration, $document)); } // TODO recursively extend view_configs for ($i = 0; $i < 5; $i++) { // when view_templates have an "extends" attribute with a valid scope name, we merge scopes foreach ($all_view_templates as $view_scope => &$view_templates) { if (!empty($view_templates['extends'])) { if (empty($all_view_templates[$view_templates['extends']])) { throw new ConfigError(sprintf('The "extends" attribute value of the scope "%s" view_templates node is invalid. ' . 'No view_templates node with scope "%s" found in configuration file "%s".', $view_scope, $view_templates['extends'], $document->documentURI)); } $view_templates = array_replace_recursive($all_view_templates[$view_templates['extends']], $view_templates); } // unset($view_templates['extends']); } } // var_dump($all_view_templates);die; $config_code = sprintf('return %s;', var_export($all_view_templates, true)); return $this->generate($config_code, $document->documentURI); }
/** * {@inheritdoc} */ public function buildView(FormView $view, FormInterface $form, array $options) { if (in_array('collection', $view->vars['block_prefixes'])) { if ($options['widget_add_btn'] !== null && !is_array($options['widget_add_btn'])) { throw new InvalidArgumentException('The "widget_add_btn" option must be an "array".'); } if (isset($options['allow_add']) && true === $options['allow_add'] && $options['widget_add_btn']) { if (isset($options['widget_add_btn']['attr']) && !is_array($options['widget_add_btn']['attr'])) { throw new InvalidArgumentException('The "widget_add_btn.attr" option must be an "array".'); } $options['widget_add_btn'] = array_replace_recursive($this->options['widget_add_btn'], $options['widget_add_btn']); } } if ($view->parent && in_array('collection', $view->parent->vars['block_prefixes'])) { if ($options['widget_remove_btn'] !== null && !is_array($options['widget_remove_btn'])) { throw new InvalidArgumentException('The "widget_remove_btn" option must be an "array".'); } if (isset($view->parent->vars['allow_delete']) && true === $view->parent->vars['allow_delete'] && $options['widget_remove_btn']) { if (isset($options['widget_remove_btn']) && !is_array($options['widget_remove_btn'])) { throw new InvalidArgumentException('The "widget_remove_btn" option must be an "array".'); } $options['widget_remove_btn'] = array_replace_recursive($this->options['widget_remove_btn'], $options['widget_remove_btn']); } } $view->vars['omit_collection_item'] = $options['omit_collection_item']; $view->vars['widget_add_btn'] = $options['widget_add_btn']; $view->vars['widget_remove_btn'] = $options['widget_remove_btn']; $view->vars['prototype_names'] = $options['prototype_names']; $view->vars['horizontal_wrap_children'] = $options['horizontal_wrap_children']; }
public function __construct(array $options = null, Compiler $compiler = null, Parser $parser = null, Lexer $lexer = null) { $this->_options = array_replace_recursive(['adapter' => 'stream', 'adapterOptions' => [], 'compiler' => [], 'parser' => [], 'lexer' => []], $options ? $options : []); $this->_lexer = $lexer ? $lexer : new Lexer($this->_options['lexer']); $this->_parser = $parser ? $parser : new Parser($this->_options['parser'], $lexer); $this->_compiler = $compiler ? $compiler : new Compiler($this->_options['compiler'], $parser); }
public function onKernelController(FilterControllerEvent $event) { $request = $event->getRequest(); if (!$request->attributes->has('_api')) { return; } /** @var Api $apiCommand */ $apiCommand = $request->attributes->get('_api'); if (!($type = $apiCommand->getType())) { return; } $formOptions = ['csrf_protection' => false, 'validation_groups' => $apiCommand->getGroups(), 'allow_extra_fields' => true]; if (!count($apiCommand->getGroups()) !== 0) { $formOptions['validation_groups'] = $apiCommand->getGroups(); } $formData = null; if ($request->attributes->has($apiCommand->getName())) { $formData = $request->attributes->get($apiCommand->getName()); } $form = $this->formFactory->createNamed('', $type, $formData, $formOptions); // "Loose" form submission, POST => GET => FILES. // @todo: Throw exception on parameter collision. $form->submit(array_replace_recursive($request->request->all(), $request->query->all(), $request->files->all()), !$request->isMethod('PATCH')); if (!$form->isValid()) { throw new CommandInvalidException($type, $form); } $request->attributes->set($apiCommand->getName(), $form->getData()); }
public static function getInteractionDocumentation() { $documentation['@attributes'] = QtiDoc::defaultCommonInteractionAttributeRow(); $documentation = array_replace_recursive($documentation, ['@notes' => "\n The element 'textEntryInteraction' map to our 'clozetext' question.\n Read the documentation: <a href='http://docs.learnosity.com/assessment/questions/questiontypes#clozetext'>\n http://docs.learnosity.com/assessment/questions/questiontypes#clozetext</a>.\n <br/><br/>\n Currently support `exactMatch` and `map_response` validation.\n ", '@attributes' => ['base' => QtiDoc::none('We always assume base to be 10.'), 'stringIdentifier' => QtiDoc::none(), 'expectedLength' => QtiDoc::none('We ignore this value for now. We do support `max_length` as a validity constraint.'), 'patternMask' => QtiDoc::none(), 'placeholderText' => QtiDoc::none('Our `clozetext` question type does not support placeholder text.')]]); return $documentation; }
/** * Renders the smarty template * @param string|array $template Path to smarty templates to render * @param array $data Params to be passed to smarty * @param bool $return If set to true, the output is returned * @param bool $wrap If set to true, template wrapping is used if present * @return string */ public function view($template, $data = array(), $return = false, $wrap = true) { ob_start(); extract(array_merge(array('data' => array_replace_recursive($this->_ext_vars, $data)), $this->_meta_vars)); if (!is_array($template)) { $template = array($template); } $out = ''; foreach ($template as $t) { include $this->_template($t); } $out = ob_get_clean(); if ($wrap && $this->_wrap) { ob_start(); if (isset($data['_this'])) { $data['_meta'] = array_replace_recursive($data['_meta'], $data['_this']); } include $this->_template($this->config->item('view', 'header') ?: 'header.php'); echo $out; include $this->_template($this->config->item('view', 'footer') ?: 'footer.php'); $out = ob_get_clean(); } if ($return == false) { echo $out; return null; } else { return $out; } }
/** * @param \TechFinancials\Command $command * @return \TechFinancials\Response * @throws \TechFinancials\Exception */ public function call(Command $command) { $uri = $this->parameters['baseUrl'] . $command->getUri(); $requestData = [static::API_USERNAME => $this->parameters['affiliateUserName'], static::API_PASSWORD => $this->parameters['affiliatePassword']]; $requestData = array_replace_recursive($requestData, $command->getParameters()); $serverResponse = $this->httpClient->request('POST', $uri, ['form_params' => $requestData]); // Read a body contents $contents = $serverResponse->getBody()->getContents(); // Parse raw body contents into Payload object. $payload = new Payload($contents); // Load data from parsed object into Response object. $response = $command->getResponse($payload); if (!$response->isSuccess()) { $errorCode = $response->getErrorCodes(); $errorMessage = $response->getErrorCodes(); switch ($errorCode) { case 'Identical user ID already found in the system. Please enter different user ID.': throw new \TechFinancials\Exceptions\EmailAlreadyExists($response, $response->getErrorCodes(), 1); break; default: throw new Exception($response, $response->getErrorCodes(), 1); break; } } return $response; }
/** * @param string $name * @param string $type * @param array $options * @param array $fieldDescriptionOptions * @return \Sonata\AdminBundle\Form\FormMapper */ public function add($name, $type = null, array $options = array(), array $fieldDescriptionOptions = array()) { if (!$this->currentGroup) { $this->with($this->admin->getLabel()); } $label = $name instanceof FormBuilder ? $name->getName() : $name; $formGroups = $this->admin->getFormGroups(); $formGroups[$this->currentGroup]['fields'][$label] = $label; $this->admin->setFormGroups($formGroups); if (!isset($fieldDescriptionOptions['type']) && is_string($type)) { $fieldDescriptionOptions['type'] = $type; } $fieldDescription = $this->admin->getModelManager()->getNewFieldDescriptionInstance($this->admin->getClass(), $name instanceof FormBuilder ? $name->getName() : $name, $fieldDescriptionOptions); $this->formContractor->fixFieldDescription($this->admin, $fieldDescription, $fieldDescriptionOptions); $this->admin->addFormFieldDescription($name instanceof FormBuilder ? $name->getName() : $name, $fieldDescription); if ($name instanceof FormBuilder) { $this->formBuilder->add($name); } else { $options = array_replace_recursive($this->formContractor->getDefaultOptions($type, $fieldDescription), $options); if (!isset($options['label'])) { $options['label'] = $this->admin->getLabelTranslatorStrategy()->getLabel($fieldDescription->getName(), 'form', 'label'); } $this->formBuilder->add($name, $type, $options); } return $this; }
/** * {@inheritdoc} */ public function buildView(FormView $view, FormInterface $form, array $options) { $vars = ['configs' => $options['configs']]; if ($form->getData()) { $data = $form->getParent()->getData(); $fieldConfig = $this->cm->getProvider('extend')->getConfig($data, $form->getName()); if ($form->getData()) { /** @var ConverterInterface|EntitySelectHandler $converter */ $converter = $options['converter']; $result = []; if ($converter instanceof EntitySelectHandler) { $converter->initForEntity($fieldConfig->getId()->getClassName(), $fieldConfig->get('target_field')); } if (isset($options['configs']['multiple']) && $options['configs']['multiple']) { foreach ($form->getData() as $item) { $result[] = $converter->convertItem($item); } } else { $result[] = $converter->convertItem($form->getData()); } $vars['attr'] = ['data-selected-data' => json_encode($result)]; } } $view->vars = array_replace_recursive($view->vars, $vars); }
/** * {@inheritdoc} * * Dumps the workflow as a graphviz graph. * * Available options: * * * graph: The default options for the whole graph * * node: The default options for nodes (places) * * edge: The default options for edges */ public function dump(Definition $definition, Marking $marking = null, array $options = array()) { $places = $this->findPlaces($definition, $marking); $edges = $this->findEdges($definition); $options = array_replace_recursive(self::$defaultOptions, $options); return $this->startDot($options) . $this->addPlaces($places) . $this->addEdges($edges) . $this->endDot(); }
/** * @return array */ protected function getData() { $rawData = []; $final = []; $lastRow = ['closed' => 1, 'open' => 1]; $open = $this->getOpenedReviews(); $close = $this->getClosedReviews(); $result = array_replace_recursive($open, $close); ksort($result); foreach ($result as $date => $rows) { $rawData[] = ['date' => $date, 'open' => isset($rows['open']) ? $rows['open'] : $lastRow['open'], 'closed' => isset($rows['closed']) ? $rows['closed'] : $lastRow['closed']]; if (!isset($rows['closed'])) { $rows['closed'] = $lastRow['closed']; } if (!isset($rows['open'])) { $rows['open'] = $lastRow['open']; } $lastRow = $rows; } foreach ($rawData as $key => $values) { $reviewCount = $values['open'] - $values['closed']; if ($reviewCount > 0) { $final[] = ['date' => $values['date'], 'diff' => $reviewCount]; } } $this->chartData = ['chartData' => $final, 'lines' => ['diff' => ['color' => '#C2274A', 'title' => 'Days']]]; }
function __construct($options = null) { $this->options = array('script_url' => $this->getFullUrl() . '/', 'upload_dir' => dirname($_SERVER['SCRIPT_FILENAME']) . '/files/', 'upload_url' => $this->getFullUrl() . '/files/', 'param_name' => 'files', 'delete_type' => 'DELETE', 'max_file_size' => null, 'min_file_size' => 1, 'accept_file_types' => '/.+$/i', 'max_number_of_files' => null, 'max_width' => null, 'max_height' => null, 'min_width' => 1, 'min_height' => 1, 'discard_aborted_uploads' => true, 'orient_image' => false, 'image_versions' => array('thumbnail' => array('upload_dir' => dirname($_SERVER['SCRIPT_FILENAME']) . '/thumbnails/', 'upload_url' => $this->getFullUrl() . '/thumbnails/', 'max_width' => 80, 'max_height' => 80))); if ($options) { $this->options = array_replace_recursive($this->options, $options); } }
/** * @inheritdoc */ protected function execute(InputInterface $input, OutputInterface $output) { $name = $input->getOption('setup'); $force = $input->getOption('force'); if (!$this->hasCommandSet($name) || !$this->getCommandSet($name)->count()) { $output->writeln('there is no setup script.'); return; } $commandSet = $this->getCommandSet($name); /** @var QuestionHelper $helper */ $helper = $this->getHelperSet()->get('question'); if (!$force) { $question = new Question('Do you want to fire up setup? (y/n)'); $yesno = $helper->ask($input, $output, $question); if ($yesno != 'y') { $output->writeln('exiting ...'); } } $iterator = $commandSet->getIterator(); $iterator->uasort(function (CommandMeta $a, CommandMeta $b) { return $a->getPriority() < $b->getPriority() ? -1 : 1; }); $commandSet = new ArrayCollection(iterator_to_array($iterator)); /** @var CommandMeta $meta */ foreach ($commandSet as $meta) { $command = $meta->getCommand(); $output->writeln(''); $output->writeln('execute command "' . $command->getName() . '":'); $inputArray = array_replace_recursive($meta->getArguments()->toArray(), array('command' => $command->getName())); $commandI = new ArrayInput($inputArray); $command->run($commandI, $output); } }
public function configure(array $config = []) { $this->extension = '.html'; $defaultConfig = $this->getDefaultConfiguration(); $this->config = array_replace_recursive($defaultConfig['html'], $config); return $this; }
/** * Get JS config * * @return array */ public function getJsConfig() { if (isset($this->wrappedComponent)) { return array_replace_recursive((array) $this->wrappedComponent->getData('config'), (array) $this->getData('config')); } return (array) $this->getData('config'); }
/** * Renders audio player for the blog * * @since 5.0 * @access public * @param string * @return */ public function renderAudioPlayer($uri, $options = array()) { // Merge the options with the default options $options = array_replace_recursive(self::$defaultAudioOptions, $options); // Generate a random uid $uniqid = uniqid(); $uid = 'audio-' . EBMM::getHash($uri . $uniqid); // Url to the audio $url = $this->normalizeURI($uri); // Get the track if there is no track provided if (!$options['track']) { $options['track'] = basename($url); } // Set a default artist if artist isn't set if (!$options['artist']) { $options['artist'] = JText::_('COM_EASYBLOG_BLOCKS_AUDIO_ARTIST'); } $template = EB::template(); $template->set('uid', $uid); $template->set('showTrack', $options['showTrack']); $template->set('showDownload', $options['showDownload']); $template->set('showArtist', $options['showArtist']); $template->set('autoplay', $options['autoplay']); $template->set('loop', $options['loop']); $template->set('artist', $options['artist']); $template->set('track', $options['track']); $template->set('url', $url); $output = $template->output('site/blogs/blocks/audio'); return $output; }
/** * Public constructor. * * @param array $parameters */ public function __construct(array $parameters = []) { $this->options = $parameters; if (isset($parameters['markers'])) { $this->options = array_replace_recursive($parameters['markers'], $this->options); } }