/** * @since 2.4 * * @param string $key * * @return mixed|false */ public function getOptionBy($key) { if ($this->options !== null && $this->options->has($key)) { return $this->options->get($key); } return false; }
private function getPreferredLocalizedSeparator($custom, $standard, $language) { if ($this->options->has($custom) && ($separator = $this->options->get($custom)) !== false) { return $separator; } return Message::get($standard, Message::TEXT, $language); }
private function getPagesFromQuery() { if (!$this->options->has('query')) { return array(); } $queryString = $this->options->get('query'); // get number of pages and fix query limit $query = SMWQueryProcessor::createQuery($queryString, SMWQueryProcessor::getProcessedParams(array('format' => 'count'))); $result = $this->store->getQueryResult($query); // get pages and add them to the pages explicitly listed in the 'page' parameter $query = SMWQueryProcessor::createQuery($queryString, SMWQueryProcessor::getProcessedParams(array())); $query->setUnboundLimit($result instanceof \SMWQueryResult ? $result->getCountValue() : $result); return $this->store->getQueryResult($query)->getResults(); }
/** * Return formatted request parameters * * @since 1.9 * * @return ObjectDictionary */ protected function formatAskArgs() { $result = new Options(); // Set defaults $result->set('conditions', array()); $result->set('printouts', array()); $result->set('parameters', array()); if (isset($this->requestParameters['parameters']) && is_array($this->requestParameters['parameters'])) { $result->set('parameters', $this->formatParameters()); } if (isset($this->requestParameters['conditions']) && is_array($this->requestParameters['conditions'])) { $result->set('conditions', implode(' ', array_map('self::formatConditions', $this->requestParameters['conditions']))); } if (isset($this->requestParameters['printouts']) && is_array($this->requestParameters['printouts'])) { $result->set('printouts', array_map('self::formatPrintouts', $this->requestParameters['printouts'])); } return $result; }
public function testUnregisteredKeyThrowsException() { $instance = new Options(); $this->setExpectedException('InvalidArgumentException'); $instance->get('Foo'); }
/** * @param array $options */ private function setFiltersFromOptions(Options $options) { $this->filters = array(); if ($options->has('categories')) { $this->filters[] = NS_CATEGORY; } if ($options->has('p')) { $this->filters[] = SMW_NS_PROPERTY; } }
/** * @since 2.2 */ public function __construct() { parent::__construct(array('smwgIgnoreQueryErrors' => $GLOBALS['smwgIgnoreQueryErrors'], 'smwgQSortingSupport' => $GLOBALS['smwgQSortingSupport'], 'smwgQRandSortingSupport' => $GLOBALS['smwgQRandSortingSupport'], 'smwgQSubpropertyDepth' => $GLOBALS['smwgQSubpropertyDepth'], 'smwgQSubcategoryDepth' => $GLOBALS['smwgQSubcategoryDepth'], 'smwgSparqlQFeatures' => $GLOBALS['smwgSparqlQFeatures'])); }
/** * @since 2.2 */ public function __construct() { parent::__construct(array('smwgIgnoreQueryErrors' => $GLOBALS['smwgIgnoreQueryErrors'], 'smwgQSortingSupport' => $GLOBALS['smwgQSortingSupport'], 'smwgQRandSortingSupport' => $GLOBALS['smwgQRandSortingSupport'])); }
/** * @since 1.9 * * @param $config */ protected function setupConfiguration($config) { $configuration = new Options($config); if ($this->configuration instanceof Options) { return $this->configuration = new Options(array_merge($this->configuration->getOptions(), $configuration->getOptions())); } $this->configuration = $configuration; }