_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q250600 | FinalCallback.finalize | validation | protected function finalize($function)
{
$response = $this->container->get(self::RESPONSE);
if (is_string($function) === true) {
$stream = $response->getBody();
$stream->write((string) $function);
}
$instanceof = $function instanceof ResponseInterface;
... | php | {
"resource": ""
} |
q250601 | CallbackHandler.middleware | validation | protected function middleware(FinalCallback $callback, ServerRequestInterface $request)
{
$response = $this->container->get(self::RESPONSE);
if (interface_exists(Application::MIDDLEWARE) === true) {
$middleware = new Dispatcher($this->middlewares, $response);
$delegate = ne... | php | {
"resource": ""
} |
q250602 | Complex.norm | validation | public function norm()
{
if ($this->original) {
return $this->original->rho;
}
return sqrt(pow($this->float_r, 2) + pow($this->float_i, 2));
} | php | {
"resource": ""
} |
q250603 | Complex.argument | validation | public function argument()
{
if ($this->original) {
return $this->original->theta;
}
return atan2($this->float_i, $this->float_r);
} | php | {
"resource": ""
} |
q250604 | Complex.add | validation | public function add($z)
{
if (is_numeric($z)) {
$z = new self($z, 0);
}
return new self($this->float_r + $z->re, $this->float_i + $z->im);
} | php | {
"resource": ""
} |
q250605 | Complex.substract | validation | public function substract($z)
{
if (is_numeric($z)) {
$z = new self($z, 0);
}
return $this->add($z->negative());
} | php | {
"resource": ""
} |
q250606 | Complex.multiply | validation | public function multiply($z)
{
if (is_numeric($z)) {
$z = new self($z, 0);
}
return new self(
($this->float_r * $z->re) - ($this->float_i * $z->im),
($this->float_r * $z->im) + ($z->re * $this->float_i)
);
} | php | {
"resource": ""
} |
q250607 | Complex.divide | validation | public function divide($z)
{
if (is_numeric($z)) {
$z = new self($z, 0);
}
if ($z->is_zero) {
throw new \InvalidArgumentException('Cannot divide by zero!');
}
$divisor = pow($z->re, 2) + pow($z->im, 2);
$r = ($this->float_r * $z->re) + ($thi... | php | {
"resource": ""
} |
q250608 | Complex.equal | validation | public function equal($z)
{
if (is_numeric($z)) {
$z = new self($z, 0);
}
return ($z->real == $this->float_r) && ($z->imaginary == $this->float_i);
} | php | {
"resource": ""
} |
q250609 | HttpIntegration.globals | validation | protected function globals(Configuration $config)
{
$cookies = $config->get('app.http.cookies', array());
$files = $config->get('app.http.files', array());
$get = $config->get('app.http.get', array());
$post = $config->get('app.http.post', array());
$server = $config->get... | php | {
"resource": ""
} |
q250610 | HttpIntegration.resolve | validation | protected function resolve(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response)
{
if (class_exists('Zend\Diactoros\ServerRequestFactory')) {
$response = new ZendResponse;
$request = ServerRequestFactory::fromGlobals();
}
$cont... | php | {
"resource": ""
} |
q250611 | Application.handle | validation | public function handle(ServerRequestInterface $request)
{
$callback = new CallbackHandler(self::$container);
if (static::$container->has(self::MIDDLEWARE)) {
$middleware = static::$container->get(self::MIDDLEWARE);
$delegate = new Delegate($callback);
$result =... | php | {
"resource": ""
} |
q250612 | Application.integrate | validation | public function integrate($integrations, ConfigurationInterface $config = null)
{
list($config, $container) = array($config ?: $this->config, static::$container);
foreach ((array) $integrations as $item) {
$integration = is_string($item) ? new $item : $item;
$container = $i... | php | {
"resource": ""
} |
q250613 | Application.run | validation | public function run()
{
// NOTE: To be removed in v1.0.0. Use "ErrorHandlerIntegration" instead.
if (static::$container->has(self::ERROR_HANDLER)) {
$debugger = static::$container->get(self::ERROR_HANDLER);
$debugger->display();
}
$request = static::$contain... | php | {
"resource": ""
} |
q250614 | WhoopsErrorHandler.display | validation | public function display()
{
$handler = new PrettyPageHandler;
error_reporting(E_ALL);
$this->__call('pushHandler', array($handler));
return $this->whoops->register();
} | php | {
"resource": ""
} |
q250615 | MiddlewareIntegration.dispatcher | validation | protected function dispatcher(ResponseInterface $response, $stack)
{
$dispatcher = new Dispatcher($stack, $response);
if (class_exists('Zend\Stratigility\MiddlewarePipe')) {
$pipe = new MiddlewarePipe;
$dispatcher = new StratigilityDispatcher($pipe, $stack, $response);
... | php | {
"resource": ""
} |
q250616 | Renderer.render | validation | public function render($template, array $data = array())
{
list($file, $name) = array(null, str_replace('.', '/', $template));
foreach ((array) $this->paths as $key => $path) {
$files = (array) $this->files($path);
$item = $this->check($files, $path, $key, $name . '.php');
... | php | {
"resource": ""
} |
q250617 | Renderer.check | validation | protected function check(array $files, $path, $source, $template)
{
$file = null;
foreach ((array) $files as $key => $value) {
$filepath = (string) str_replace($path, $source, $value);
$filepath = str_replace('\\', '/', (string) $filepath);
$filepath = (string)... | php | {
"resource": ""
} |
q250618 | Renderer.extract | validation | protected function extract($filepath, array $data)
{
extract($data);
ob_start();
include $filepath;
$contents = ob_get_contents();
ob_end_clean();
return $contents;
} | php | {
"resource": ""
} |
q250619 | Renderer.files | validation | protected function files($path)
{
$directory = new \RecursiveDirectoryIterator($path);
$iterator = new \RecursiveIteratorIterator($directory);
$regex = new \RegexIterator($iterator, '/^.+\.php$/i', 1);
return (array) array_keys(iterator_to_array($regex));
} | php | {
"resource": ""
} |
q250620 | Dispatcher.parse | validation | protected function parse($httpMethod, $uri, $route)
{
$matched = preg_match($route[4], $uri, $parameters);
if ($matched && ($httpMethod == $route[0] || $httpMethod == 'OPTIONS')) {
$this->allowed($route[0]);
array_shift($parameters);
return array($route[2], $pa... | php | {
"resource": ""
} |
q250621 | Dispatcher.retrieve | validation | protected function retrieve(array $routes, $uri)
{
$routes = array_values(array_filter($routes));
if (empty($routes)) {
$message = 'Route "' . $uri . '" not found';
throw new \UnexpectedValueException($message);
}
$route = current($routes);
$route[... | php | {
"resource": ""
} |
q250622 | LeagueContainer.set | validation | public function set($id, $concrete, $share = false)
{
return $this->add($id, $concrete, $share);
} | php | {
"resource": ""
} |
q250623 | FontAwesomeBackend.getTag | validation | public function getTag($classNames, $color = null)
{
return ArrayData::create([
'ClassNames' => $classNames,
'Color' => $color
])->renderWith(sprintf('%s\Tag', self::class));
} | php | {
"resource": ""
} |
q250624 | FontAwesomeBackend.getClassName | validation | public function getClassName($identifier, $args = [])
{
if (isset($this->classes[$identifier])) {
return $args ? vsprintf($this->classes[$identifier], $args) : $this->classes[$identifier];
}
} | php | {
"resource": ""
} |
q250625 | FontAwesomeBackend.getIcons | validation | public function getIcons()
{
// Initialise:
$icons = [];
// Iterate Grouped Icons:
foreach ($this->getGroupedIcons() as $name => $group) {
foreach ($group as $id => $icon) {
if (!isset($icons[$id])) ... | php | {
"resource": ""
} |
q250626 | FontAwesomeBackend.getGroupedIcons | validation | public function getGroupedIcons()
{
// Answer Cached Icons (if available):
if ($icons = self::cache()->get($this->getCacheKey())) {
return $icons;
}
// Initialise:
$icons = [];
// Parse Icon Source Data:
... | php | {
"resource": ""
} |
q250627 | Router.retrieve | validation | public function retrieve($httpMethod, $uri)
{
$route = array($httpMethod, $uri);
$routes = array_map(function ($route) {
return array($route[0], $route[1]);
}, $this->routes);
$key = array_search($route, $routes);
return $key !== false ? $this->routes[$key] : n... | php | {
"resource": ""
} |
q250628 | Router.restful | validation | public function restful($route, $class, $middlewares = array())
{
$middlewares = (is_string($middlewares)) ? array($middlewares) : $middlewares;
$this->add('GET', '/' . $route, $class . '@index', $middlewares);
$this->add('POST', '/' . $route, $class . '@store', $middlewares);
$thi... | php | {
"resource": ""
} |
q250629 | Router.prefix | validation | public function prefix($prefix = '', $namespace = '')
{
$namespace === '' && $namespace = (string) $this->namespace;
$prefix && $prefix[0] !== '/' && $prefix = '/' . $prefix;
$namespace = str_replace('\\\\', '\\', $namespace . '\\');
$this->prefix = (string) $prefix;
$thi... | php | {
"resource": ""
} |
q250630 | Router.parse | validation | protected function parse($route)
{
$route[0] = strtoupper($route[0]);
$route[1] = str_replace('//', '/', $this->prefix . $route[1]);
is_string($route[2]) && $route[2] = explode('@', $route[2]);
is_array($route[2]) && $route[2][0] = $this->namespace . $route[2][0];
is_arra... | php | {
"resource": ""
} |
q250631 | Sortable.getSortValBeforeAll | validation | public function getSortValBeforeAll($groupingId = null)
{
if ($groupingId === null && $this->grpColumn) {
throw new SortableException(
'groupingId may be omitted only when grpColumn is not configured.'
);
}
$query = (new Query())
->select(... | php | {
"resource": ""
} |
q250632 | Sortable.getSortValAfterAll | validation | public function getSortValAfterAll($groupingId = null)
{
if (!$groupingId === null && $this->grpColumn) {
throw new SortableException(
'groupingId may be omitted only when grpColumn is not configured.'
);
}
$query = (new Query())
->select(... | php | {
"resource": ""
} |
q250633 | Sortable.skipRowsClause | validation | protected function skipRowsClause() {
$skipClause = [];
foreach ($this->skipRows as $cl => $val) {
$skipClause[] = ['<>', $cl, $val];
}
if (count($skipClause) > 1) array_unshift($skipClause, 'and');
return $skipClause;
} | php | {
"resource": ""
} |
q250634 | Response.withStatus | validation | public function withStatus($code, $reason = '')
{
// TODO: Add \InvalidArgumentException
$static = clone $this;
$static->code = $code;
$static->reason = $reason ?: $static->codes[$code];
return $static;
} | php | {
"resource": ""
} |
q250635 | Growl.execute | validation | public function execute()
{
if ($this->escape !== false) {
$this->options = $this->escape($this->options);
}
if ($this->builder !== null) {
$command = $this->builder->build($this->options);
exec($command);
}
} | php | {
"resource": ""
} |
q250636 | Growl.buildCommand | validation | public function buildCommand()
{
if ($this->escape !== false) {
$this->options = $this->escape($this->options);
}
if ($this->builder !== null) {
$this->command = $this->builder->build($this->options);
}
return $this;
} | php | {
"resource": ""
} |
q250637 | Growl.setSafe | validation | public function setSafe($options)
{
if (is_string($options)) {
$this->safe[] = $options;
return $this;
}
if (is_array($options)) {
foreach ($options as $key => $value) {
$this->safe[] = $value;
}
return $this;
... | php | {
"resource": ""
} |
q250638 | Growl.escape | validation | protected function escape(array $options)
{
$results = [];
foreach ($options as $key => $value) {
if (!in_array($key, $this->safe)) {
$results[$key] = escapeshellarg($value);
} else {
$results[$key] = $value;
}
}
re... | php | {
"resource": ""
} |
q250639 | Growl.selectBuilder | validation | protected function selectBuilder()
{
if (PHP_OS === 'Darwin') {
if (exec('which growlnotify')) {
return new GrowlNotifyBuilder;
}
if (exec('which terminal-notifier')) {
return new TerminalNotifierBuilder;
}
}
if ... | php | {
"resource": ""
} |
q250640 | Factorial.compute | validation | protected function compute($n)
{
$int_fact = 1;
for ($i = 1; $i <= $n ; $i++) {
$int_fact *= $i;
}
return $int_fact;
} | php | {
"resource": ""
} |
q250641 | SentryTarget.export | validation | public function export()
{
foreach ($this->messages as $message) {
list($msg, $level, $catagory, $timestamp, $traces) = $message;
$errStr = '';
$options = [
'level' => yii\log\Logger::getLevelName($level),
'extra' => [],
];
... | php | {
"resource": ""
} |
q250642 | Collection.setHttp | validation | public function setHttp(ServerRequestInterface $request, ResponseInterface $response)
{
$this->set('Psr\Http\Message\ServerRequestInterface', $request);
return $this->set('Psr\Http\Message\ResponseInterface', $response);
} | php | {
"resource": ""
} |
q250643 | GrowlNotifyBuilder.build | validation | public function build($options)
{
$command = $this->path;
if (isset($options['title'])) {
$command .= " -t {$options['title']}";
}
if (isset($options['message'])) {
$command .= " -m {$options['message']}";
}
if (isset($options['image'])) {
... | php | {
"resource": ""
} |
q250644 | Collector.get | validation | public static function get(ContainerInterface $container, array $components = array(), &$globals = null)
{
$configuration = new Configuration;
$collection = new Collection;
foreach ((array) $components as $component) {
$instance = self::prepare($collection, $component);
... | php | {
"resource": ""
} |
q250645 | Collector.prepare | validation | protected static function prepare(Collection &$collection, $component)
{
$instance = new $component;
$type = $instance->type();
if (empty($type) === false) {
$parameters = array($instance->get());
$type === 'http' && $parameters = $instance->get();
$cl... | php | {
"resource": ""
} |
q250646 | Dispatcher.push | validation | public function push($middleware)
{
if (is_array($middleware)) {
$this->stack = array_merge($this->stack, $middleware);
return $this;
}
$this->stack[] = $middleware;
return $this;
} | php | {
"resource": ""
} |
q250647 | Dispatcher.approach | validation | protected function approach($middleware)
{
if ($middleware instanceof \Closure)
{
$object = new \ReflectionFunction($middleware);
return count($object->getParameters()) === 2;
}
$class = (string) get_class($middleware);
$object = new \ReflectionMeth... | php | {
"resource": ""
} |
q250648 | Dispatcher.callback | validation | protected function callback($middleware, ResponseInterface $response)
{
$middleware = is_string($middleware) ? new $middleware : $middleware;
$callback = function ($request, $next = null) use ($middleware) {
return $middleware($request, $next);
};
if ($this->approach($m... | php | {
"resource": ""
} |
q250649 | Dispatcher.resolve | validation | protected function resolve($index)
{
$callback = null;
$stack = $this->stack;
if (isset($this->stack[$index])) {
$item = $stack[$index];
$next = $this->resolve($index + 1);
$callback = function ($request) use ($item, $next) {
return $it... | php | {
"resource": ""
} |
q250650 | Dispatcher.transform | validation | protected function transform($middleware, $wrappable = true)
{
if (is_a($middleware, Application::MIDDLEWARE) === false) {
$approach = (boolean) $this->approach($middleware);
$response = $approach === self::SINGLE_PASS ? $this->response : null;
$wrapper = new CallableMi... | php | {
"resource": ""
} |
q250651 | PhrouteDispatcher.collect | validation | protected function collect()
{
$collector = new RouteCollector;
foreach ($this->router->routes() as $route) {
$collector->addRoute($route[0], $route[1], $route[2]);
}
return $collector->getData();
} | php | {
"resource": ""
} |
q250652 | PhrouteDispatcher.exceptions | validation | protected function exceptions(\Exception $exception, $uri)
{
$interface = 'Phroute\Phroute\Exception\HttpRouteNotFoundException';
$message = (string) $exception->getMessage();
is_a($exception, $interface) && $message = 'Route "' . $uri . '" not found';
throw new \UnexpectedValueEx... | php | {
"resource": ""
} |
q250653 | Uri.getAuthority | validation | public function getAuthority()
{
$authority = $this->host;
if ($this->host !== '' && $this->user !== null) {
$authority = $this->user . '@' . $authority;
$authority = $authority . ':' . $this->port;
}
return $authority;
} | php | {
"resource": ""
} |
q250654 | Uri.instance | validation | public static function instance(array $server)
{
$secure = isset($server['HTTPS']) ? $server['HTTPS'] : 'off';
$http = $secure === 'off' ? 'http' : 'https';
$url = $http . '://' . $server['SERVER_NAME'];
$url .= (string) $server['SERVER_PORT'];
return new Uri($url . $serv... | php | {
"resource": ""
} |
q250655 | NormalDistribution.variance | validation | public function variance()
{
$float_variance = pow($this->float_sigma, 2);
if ($this->int_precision) {
return round($float_variance, $this->int_precision);
}
return $float_variance;
} | php | {
"resource": ""
} |
q250656 | NormalDistribution.precision | validation | public function precision($n)
{
if (!is_numeric($n) || $n < 0) {
throw new \InvalidArgumentException('Precision must be positive number');
}
$this->int_precision = (integer) $n;
} | php | {
"resource": ""
} |
q250657 | NormalDistribution.max | validation | public function max()
{
$float_max = 1 / ($this->float_sigma * sqrt(2 * pi()));
if ($this->int_precision) {
return round($float_max, $this->int_precision);
}
return $float_max;
} | php | {
"resource": ""
} |
q250658 | NormalDistribution.fwhm | validation | public function fwhm()
{
$float_fwhm = 2 * sqrt(2 * log(2)) * $this->float_sigma;
if ($this->int_precision) {
return round($float_fwhm, $this->int_precision);
}
return $float_fwhm;
} | php | {
"resource": ""
} |
q250659 | NormalDistribution.f | validation | public function f($x)
{
if (!is_numeric($x)) {
throw new \InvalidArgumentException('x variable must be numeric value.');
}
$float_fx = exp(-0.5 * pow(($x - $this->float_mu) / $this->float_sigma, 2)) / ($this->float_sigma * sqrt(2 * pi()));
if ($this->int_precision) {
... | php | {
"resource": ""
} |
q250660 | NormalDistribution.samples | validation | public function samples($amount)
{
if (!is_numeric($amount) || $amount < 1) {
throw new \InvalidArgumentException('Amount of samples must be greater or equal to one');
}
$arr = array();
for ($i = 1; $i <= $amount; $i++) {
$r = new Random();
$flo... | php | {
"resource": ""
} |
q250661 | FontIconField.search | validation | public function search(HTTPRequest $request)
{
// Detect Ajax:
if (!$request->isAjax()) {
return;
}
// Initialise:
$data = [];
// Filter Icons:
if ($term = $request->getVar('term')) {
... | php | {
"resource": ""
} |
q250662 | Stream.getContents | validation | public function getContents()
{
if (is_null($this->stream) || ! $this->isReadable()) {
$message = 'Could not get contents of stream';
throw new \RuntimeException($message);
}
return stream_get_contents($this->stream);
} | php | {
"resource": ""
} |
q250663 | Stream.getMetadata | validation | public function getMetadata($key = null)
{
isset($this->stream) && $this->meta = stream_get_meta_data($this->stream);
$metadata = isset($this->meta[$key]) ? $this->meta[$key] : null;
return is_null($key) ? $this->meta : $metadata;
} | php | {
"resource": ""
} |
q250664 | Stream.getSize | validation | public function getSize()
{
if (is_null($this->size) === true) {
$stats = fstat($this->stream);
$this->size = $stats['size'];
}
return $this->size;
} | php | {
"resource": ""
} |
q250665 | Stream.write | validation | public function write($string)
{
if (! $this->isWritable()) {
$message = 'Stream is not writable';
throw new \RuntimeException($message);
}
$this->size = null;
return fwrite($this->stream, $string);
} | php | {
"resource": ""
} |
q250666 | Stats.f | validation | public function f()
{
if(is_null($this->arr_f)){
$arr = $this->frequency();
array_walk(
$arr,
function(&$v, $k, $n){
$v = $v / $n;
},
count($this)
);
$this->arr_f = $arr;
... | php | {
"resource": ""
} |
q250667 | TerminalNotifierBuilder.build | validation | public function build($options)
{
$command = $this->path;
if (isset($options['title'])) {
$command .= " -title {$options['title']}";
}
if (isset($options['subtitle'])) {
$command .= " -subtitle {$options['subtitle']}";
}
if (isset($options['me... | php | {
"resource": ""
} |
q250668 | TwigRenderer.render | validation | public function render($template, array $data = array(), $extension = 'twig')
{
$file = $template . '.' . $extension;
return $this->twig->render($file, $data);
} | php | {
"resource": ""
} |
q250669 | FontIconExtension.updateCMSFields | validation | public function updateCMSFields(FieldList $fields)
{
// Insert Icon Tab:
$fields->insertAfter(
Tab::create(
'Icon',
$this->owner->fieldLabel('Icon')
),
'Main'
);
// Create Icon Fields:
... | php | {
"resource": ""
} |
q250670 | FontIconExtension.getFontIconClassNames | validation | public function getFontIconClassNames()
{
$classes = [];
if ($this->owner->FontIcon) {
if ($this->owner->FontIconListItem) {
$classes[] = $this->backend->getClassName('list-item');
}
if ($this->owner->FontIconFixe... | php | {
"resource": ""
} |
q250671 | FontIconExtension.getFontIconTag | validation | public function getFontIconTag()
{
if ($this->owner->hasFontIcon()) {
return $this->backend->getTag(
$this->owner->FontIconClass,
$this->owner->FontIconColor
);
}
} | php | {
"resource": ""
} |
q250672 | FastRouteRouter.routes | validation | public function routes()
{
$routes = array_merge($this->routes, $this->collector->getData());
return function (RouteCollector $collector) use ($routes) {
foreach (array_filter($routes) as $route) {
list($method, $uri, $handler) = (array) $route;
$collect... | php | {
"resource": ""
} |
q250673 | RandomComplex.random | validation | protected static function random($float_min, $float_max)
{
if ($float_max >= 0) {
$r = new Random();
while (true) {
$float_prov = $float_max * $r->get();
if ($float_prov >= $float_min) {
return $float_prov;
}
... | php | {
"resource": ""
} |
q250674 | RandomComplex.checkOrder | validation | protected static function checkOrder($float_min, $float_max)
{
if (!is_numeric($float_min) && !is_numeric($float_max)) {
throw new \InvalidArgumentException('Min and max values must be valid numbers.');
}
if ($float_min >= $float_max) {
throw new \InvalidArgumentExce... | php | {
"resource": ""
} |
q250675 | RandomComplex.rho | validation | public function rho($float_min, $float_max)
{
self::checkOrder($float_min, $float_max);
if ($float_min < 0 || $float_max < 0) {
throw new \InvalidArgumentException('Rho value must be a positive number!');
}
if ($this->r || $this->i) {
throw new \RuntimeExcep... | php | {
"resource": ""
} |
q250676 | RandomComplex.theta | validation | public function theta($float_min, $float_max)
{
self::checkOrder($float_min, $float_max);
if ($this->r || $this->i) {
throw new \RuntimeException('You cannot set theta value, because algebraic form is in use.');
}
$this->theta = new \stdClass();
$this->theta->mi... | php | {
"resource": ""
} |
q250677 | RandomComplex.get | validation | public function get()
{
if ($this->r || $this->i) {
if (!is_object($this->i)) {
return new Complex(
self::random($this->r->min, $this->r->max),
0
);
}
if (!is_object($this->r)) {
retu... | php | {
"resource": ""
} |
q250678 | RandomComplex.getMany | validation | public function getMany($n)
{
if (!is_integer($n) || $n < 2) {
throw new \InvalidArgumentException('You must take 2 or more items in this case.');
}
$arr_out = array();
for ($i = 0; $i < $n; $i++) {
$arr_out[] = $this->get();
}
return $arr_o... | php | {
"resource": ""
} |
q250679 | RandomComplex.reset | validation | public function reset()
{
$this->rho = null;
$this->theta = null;
$this->r = null;
$this->i = null;
return $this;
} | php | {
"resource": ""
} |
q250680 | Container.alias | validation | public function alias($id, $original)
{
$this->instances[$id] = $this->get($original);
return $this;
} | php | {
"resource": ""
} |
q250681 | Container.value | validation | protected function value($name)
{
$object = isset($this->instances[$name]) ? $this->get($name) : null;
$exists = ! $object && $this->extra->has($name) === true;
return $exists === true ? $this->extra->get($name) : $object;
} | php | {
"resource": ""
} |
q250682 | Random.get | validation | public function get()
{
if ($this->range->as_integer) {
return mt_rand($this->range->min, $this->range->max);
} else {
return mt_rand(0, mt_getrandmax()) / mt_getrandmax();
}
} | php | {
"resource": ""
} |
q250683 | Random.getManyWithoutReplacement | validation | public function getManyWithoutReplacement($n)
{
if (!is_integer($n) || $n < 2) {
throw new \InvalidArgumentException('You must take 2 or more items in this case.');
}
if ($this->range->as_integer) {
$arr_range = range($this->range->min, $this->range->max);
... | php | {
"resource": ""
} |
q250684 | JetPackTrait.setPackOptions | validation | public function setPackOptions(Container $app) {
foreach ($this->packOptions as $key => &$value) {
$key = $this->_ns($key);
if (isset($app[$key])) {
$value = $app[$key];
}
}
} | php | {
"resource": ""
} |
q250685 | JetPackTrait.getName | validation | public function getName()
{
static $names = [];
$me = get_class($this);
if (empty($names[$me])) {
$names[$me] = $this->getReflector()->getShortName();
$suffix = defined('static::PACK_SUFFIX') ? static::PACK_SUFFIX : 'Pack';
if (strrpos($names[$me], $suffix... | php | {
"resource": ""
} |
q250686 | JetPackTrait.getEntityMappings | validation | public function getEntityMappings(Container $app)
{
static $mappings = [];
$me = get_class($this);
if (empty($mappings[$me])) {
$subns = $this->packOptions['entity_subnamespace'];
$subns = trim($subns, '\\');
$simple = $this->packOptions['entity_use_simple... | php | {
"resource": ""
} |
q250687 | JetPackTrait.getConfigsPath | validation | public function getConfigsPath(Container $app)
{
static $paths = [];
$me = get_class($this);
if (empty($paths[$me])) {
$subpath = $this->packOptions['configs_subpath'];
$paths[$me] = dirname($this->getReflector()->getFileName()) . '/' . $subpath;
}
ret... | php | {
"resource": ""
} |
q250688 | JetPackTrait.getSymlinks | validation | public function getSymlinks(Container $app)
{
$symlinks = [];
if ($this->getPublicPath($app)) {
$symlinks[$this->getPublicPath($app)] = 'packs/' . $this->_ns();
}
return $symlinks;
} | php | {
"resource": ""
} |
q250689 | JetPackTrait.getPackPath | validation | public function getPackPath(Container $app) {
static $paths = [];
$me = get_class($this);
if (empty($paths[$me])) {
$paths[$me] = dirname($this->getReflector()->getFileName());
}
return $paths[$me];
} | php | {
"resource": ""
} |
q250690 | AbstractDispatcher.allowed | validation | protected function allowed($method)
{
if (in_array($method, $this->allowed) === false) {
$message = 'Used method is not allowed';
throw new \UnexpectedValueException($message);
}
return true;
} | php | {
"resource": ""
} |
q250691 | Rule.pathExtract | validation | protected function pathExtract(): array
{
$regExp = [];
$path = $this->path;
if (\is_array($this->path)) {
$regExp = \array_pop($this->path);
$path = \array_pop($this->path);
}
return [$path, $regExp];
} | php | {
"resource": ""
} |
q250692 | Dlstats.logDLStatDetails | validation | protected function logDLStatDetails()
{
//Host / Page ID ermitteln
$pageId = $GLOBALS['objPage']->id; // ID der grad aufgerufenden Seite.
$pageHost = \Environment::get('host'); // Host der grad aufgerufenden Seite.
if (isset($GLOBALS['TL_CONFIG']['dlstatdets'])
&& (bool) $GLOBALS... | php | {
"resource": ""
} |
q250693 | SearchAbstract.query | validation | public function query($index, array $filters = null,
array $queries = null, array $fieldWeights = null,
$limit = 20, $offset = 0
) {
$sphinxClient = $this->getSphinxClient();
$sphinxClient->SetLimits($offset, $limit);
if (null !== $filters) {
foreach ($filters as ... | php | {
"resource": ""
} |
q250694 | SearchAbstract.getCollection | validation | public function getCollection($index, array $filters = null,
array $queries = null, array $fieldWeights = null,
$limit = 20, $offset = 0, $countableAttributes = null
) {
$result = $this->query($index, $filters, $queries,
$fieldWeights, $limit, $offset);
if (is_array($res... | php | {
"resource": ""
} |
q250695 | Parser.doParse | validation | protected function doParse(StringReader $string)
{
$val = null;
// May be : or ; as a terminator, depending on what the data
// type is.
$type = substr($string->read(2), 0, 1);
switch ($type) {
case 'a':
// Associative array: a:length:{[index][v... | php | {
"resource": ""
} |
q250696 | QueryAbstract.getQueries | validation | public function getQueries()
{
$array = [];
foreach ($this->getKeywords() as $keyword) {
$value = $keyword->getData();
if ($this->getCountableAttributes()) {
$value['countableAttributes'] = $this->getCountableAttributes();
}
$array[] = ... | php | {
"resource": ""
} |
q250697 | QueryAbstract.getOffSet | validation | public function getOffSet()
{
if ($this->getPaginator()) {
return $this->getPaginator()->getOffset();
} else {
$offset = $this->get('offset');
if (!$offset) {
$offset = 0;
}
return $offset;
}
} | php | {
"resource": ""
} |
q250698 | QueryAbstract.addCountableAttribute | validation | public function addCountableAttribute($attribute)
{
if (empty($attribute)) {
return false;
}
if (in_array($attribute, $this->getCountableAttributes(), true)) {
return false;
}
$this->addToArrayValue('countableAttributes', $attribute);
return ... | php | {
"resource": ""
} |
q250699 | RouteServiceProvider.mapAdminRoutes | validation | private function mapAdminRoutes()
{
$this->adminGroup(function () {
$this->name('foundation.')->group(function () {
Routes\Admin\DashboardRoute::register();
Routes\Admin\SettingsRoutes::register();
Routes\Admin\SystemRoutes::register();
... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.