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); }
/** * @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 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(); }
public function testUnregisteredKeyThrowsException() { $instance = new Options(); $this->setExpectedException('InvalidArgumentException'); $instance->get('Foo'); }
/** * @since 1.9.2 * * @param Options $options */ public function setOptions(Options $options) { $this->options = $options; if ($options->has('server')) { $GLOBALS['wgServer'] = $options->get('server'); } if ($options->has('d')) { $this->delay = intval($options->get('d')) * 1000; // convert milliseconds to microseconds } if ($options->has('s')) { $this->start = max(1, intval($options->get('s'))); } elseif ($options->has('startidfile')) { $this->canWriteToIdFile = $this->idFileIsWritable($options->get('startidfile')); $this->startIdFile = $options->get('startidfile'); if (is_readable($options->get('startidfile'))) { $this->start = max(1, intval(file_get_contents($options->get('startidfile')))); } } // Note: this might reasonably be larger than the page count if ($options->has('e')) { $this->end = intval($options->get('e')); } elseif ($options->has('n')) { $this->end = $this->start + intval($options->get('n')); } $this->verbose = $options->has('v'); $this->exceptionFileLogger->setOptions($options); $this->setFiltersFromOptions($options); }