_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q238000
ContentService.getDocumentBySlug
train
public function getDocumentBySlug($slug) { $search = $this->repository->createSearch(); $search->addQuery(new TermQuery('slug', $slug), 'must'); $results = $this->repository->execute($search); if (count($results) === 0) { $this->logger && $this->logger->warning( ...
php
{ "resource": "" }
q238001
RpcMethod.setDescription
train
public function setDescription($description = null) { if ( empty($description) ) $this->description = null; else if ( !is_string($description) ) throw new InvalidArgumentException("Invalid RpcMethod description"); else $this->description = $description; return $this; }
php
{ "resource": "" }
q238002
RpcMethod.addSignature
train
public function addSignature() { $signature = [ "PARAMETERS" => [], "RETURNTYPE" => 'undefined' ]; array_push($this->signatures, $signature); $this->current_signature = max(array_keys($this->signatures)); return $this; }
php
{ "resource": "" }
q238003
RpcMethod.getSignatures
train
public function getSignatures($compact = true) { if ( $compact ) { $signatures = []; foreach ( $this->signatures as $signature ) { $signatures[] = array_merge([$signature["RETURNTYPE"]], array_values($signature["PARAMETERS"])); } return $sign...
php
{ "resource": "" }
q238004
RpcMethod.getSignature
train
public function getSignature($compact = true) { if ( $compact ) { return array_merge([$this->signatures[$this->current_signature]["RETURNTYPE"]], array_values($this->signatures[$this->current_signature]["PARAMETERS"])); } else { return $this->signatures[$this->current_signatu...
php
{ "resource": "" }
q238005
RpcMethod.deleteSignature
train
public function deleteSignature($signature) { if ( !is_integer($signature) || !isset($this->signatures[$signature]) ) { throw new InvalidArgumentException("Invalid RpcMethod signature reference"); } unset($this->signatures[$signature]); return true; }
php
{ "resource": "" }
q238006
RpcMethod.selectSignature
train
public function selectSignature($signature) { if ( !is_integer($signature) || !isset($this->signatures[$signature]) ) { throw new InvalidArgumentException("Invalid RpcMethod signature reference"); } $this->current_signature = $signature; return $this; }
php
{ "resource": "" }
q238007
RpcMethod.setReturnType
train
public function setReturnType($type) { if ( !in_array($type, self::$rpcvalues) ) throw new InvalidArgumentException("Invalid RpcMethod return type"); $this->signatures[$this->current_signature]["RETURNTYPE"] = self::$rpcvalues[$type]; return $this; }
php
{ "resource": "" }
q238008
RpcMethod.addParameter
train
public function addParameter($type, $name) { if ( !in_array($type, self::$rpcvalues) ) throw new InvalidArgumentException("Invalid type for parameter $name"); if ( empty($name) ) throw new InvalidArgumentException("Missing parameter name"); $this->signatures[$this->current_signature]["PARAMET...
php
{ "resource": "" }
q238009
RpcMethod.deleteParameter
train
public function deleteParameter($name) { if ( !array_key_exists($name, $this->signatures[$this->current_signature]["PARAMETERS"]) ) throw new Exception("Cannot find parameter $name"); unset($this->signatures[$this->current_signature]["PARAMETERS"][$name]); return $this; }
php
{ "resource": "" }
q238010
RpcMethod.getParameters
train
public function getParameters($format = self::FETCH_ASSOC) { if ( $format === self::FETCH_NUMERIC ) return array_values($this->signatures[$this->current_signature]["PARAMETERS"]); else return $this->signatures[$this->current_signature]["PARAMETERS"]; }
php
{ "resource": "" }
q238011
RpcMethod.create
train
public static function create($name, callable $callback, ...$arguments) { try { return new RpcMethod($name, $callback, ...$arguments); } catch (Exception $e) { throw $e; } }
php
{ "resource": "" }
q238012
FileSystem.loadTable
train
public function loadTable($table) { $file = $this->path . '/' . $table . '.json'; if (is_file($file)) { $data = file_get_contents($file); if (!$data) { return $this->blankTable(); } if (!$data = @json_decode($data, true, 512)) { ...
php
{ "resource": "" }
q238013
FileSystem.saveTable
train
public function saveTable($table, array &$data) { $file = $this->path . '/' . $table . '.json'; $data = $this->touchModified($data); $opt = is_numeric($this->opt['json_options']) ? $this->opt['json_options'] : 0; $dept = is_numeric($this->opt['json_depth'])...
php
{ "resource": "" }
q238014
ExamineConfigCommand.generateTree
train
private function generateTree($data, $total_depth, $current_depth = 1) { ksort($data); $table = []; foreach ($data as $key => $value) { $row = []; if ($current_depth > 1) { $row = array_merge($row, array_fill(0, ($current_depth - 1), '')); } ...
php
{ "resource": "" }
q238015
ExamineConfigCommand.getConfigDepth
train
private function getConfigDepth($config) { $total_depth = 1; foreach ($config as $data) { if (is_array($data)) { $depth = $this->getConfigDepth($data) + 1; if ($depth > $total_depth) { $total_depth = $depth; } ...
php
{ "resource": "" }
q238016
SReg.sregValue
train
private function sregValue($value = '') { $owner = $this->owner; $values = explode('|', $value); $count = count($values); foreach ($values as $key => $fieldPath) { if ($fieldPath == '' || $fieldPath == 'null') { return null; } elseif ($relValue...
php
{ "resource": "" }
q238017
CommonAppController.forceSsl
train
public function forceSsl($type) { $host = env('SERVER_NAME'); if (empty($host)) { $host = env('HTTP_HOST'); } if ('secure' == $type) { $this->redirect('https://' . $host . $this->here); } }
php
{ "resource": "" }
q238018
CommonAppController._edit
train
protected function _edit($id) { try { $result = $this->{$this->modelClass}->edit($id, $this->request->data); } catch (OutOfBoundsException $e) { return $this->alert($e, array('redirect' => $this->referer(array('action' => 'list'), true))); } $this->request->data = $this->{$this->modelClass}->data; if ...
php
{ "resource": "" }
q238019
CommonAppController._list
train
protected function _list($object = null, $scope = array(), $whitelist = array()) { $View = $this->_getViewObject(); if (!$View->Helpers->loaded('Common.Table')) { $this->_getViewObject()->loadHelper('Common.Table'); } $this->{$this->modelClass}->recursive = 0; $this->set('results', $this->paginate($object,...
php
{ "resource": "" }
q238020
CommonAppController._status
train
protected function _status($id, $status) { if (!$this->{$this->modelClass}->changeStatus($id, $status)) { return $this->alert('status.fail'); } $this->alert('status.success'); }
php
{ "resource": "" }
q238021
ServiceManager.setupServices
train
public function setupServices() { $settings = $this->getApp()->container->get('settings'); if (!empty($settings['services'])) { if (!is_array($settings['services'])) { throw InvalidServiceConfigException::build([], ['serviceConfig' => $settings['services']]); ...
php
{ "resource": "" }
q238022
ServiceManager.getService
train
public function getService($serviceName) { $serviceName = $this->getServiceName($serviceName); return $this->getApp()->container->get($serviceName); }
php
{ "resource": "" }
q238023
StringHelper.endsWith
train
public function endsWith(string $haystack, string $needle): bool { $escaped = preg_quote($needle); return (bool) preg_match("/$escaped$/", $haystack); }
php
{ "resource": "" }
q238024
Application.processRequest
train
public function processRequest() { $this->signal->send($this, 'onProcessRequest'); if (Console::isCli()) { $exitCode = $this->_runner->run($_SERVER['argv']); if (is_int($exitCode)) { $this->end($exitCode); } } else { $this->run...
php
{ "resource": "" }
q238025
Application.runController
train
public function runController($route) { if (($ca = $this->createController($route)) !== null) { /** @var \Mindy\Controller\BaseController $controller */ list($controller, $actionID, $params) = $ca; $_GET = array_merge($_GET, $params); $csrfExempt = $controller...
php
{ "resource": "" }
q238026
Application.createController
train
public function createController($route, $owner = null) { if ($owner === null) { $owner = $this; } if ($route) { list($handler, $vars) = $route; if ($handler instanceof Closure) { $handler->__invoke($this->getComponent('request')); ...
php
{ "resource": "" }
q238027
Application.parseActionParams
train
protected function parseActionParams($pathInfo) { if (($pos = strpos($pathInfo, '/')) !== false) { $manager = $this->getUrlManager(); $manager->parsePathInfo((string)substr($pathInfo, $pos + 1)); $actionID = substr($pathInfo, 0, $pos); return $manager->caseSen...
php
{ "resource": "" }
q238028
Application.findModule
train
public function findModule($id) { if (($controller = $this->getController()) !== null && ($module = $controller->getModule()) !== null) { do { if (($m = $module->getModule($id)) !== null) { return $m; } } while (($module = $module->...
php
{ "resource": "" }
q238029
Application.init
train
public function init() { if (Console::isCli()) { // fix for fcgi defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); if (!isset($_SERVER['argv'])) { die('This script must be run from the command line.'); } $this->_runne...
php
{ "resource": "" }
q238030
Runner.findConfigurationFile
train
public function findConfigurationFile($filename = null, $pwd = null) { $filename = $filename ?: $this->getConfigurationFileName(); $pwd = $pwd ?: getcwd(); $dirs = explode(DS, $pwd); $find = false; do { $dir = join(DS, $dirs); $config_file_pat...
php
{ "resource": "" }
q238031
Runner.loadConfigurationFile
train
public function loadConfigurationFile($file = null) { $file = $file ?: $this->findConfigurationFile(); if (! file_exists($file)) return; $this->config = $this->yaml->load($file); }
php
{ "resource": "" }
q238032
Constraint.valid
train
public function valid ($value) { $valid = true; $error = array(); if ($this->minLength !== null && ! (strlen($value) >= $this->minLength)) { $valid = false; $error[] = 'minimum length'; } if ($this->maxLength !== null && ! (strlen($value) <= $this->m...
php
{ "resource": "" }
q238033
Plugin.appendConfiguration
train
public function appendConfiguration(ArrayNodeDefinition $rootNode) { $rootNode ->children() ->arrayNode('qa') ->children() ->arrayNode('phpcs') ->children() ->arrayNode('dir') ...
php
{ "resource": "" }
q238034
Transformer.transformRows
train
public function transformRows(\Cassandra\Rows $rows) { $entries = []; // page through all results and transform as we go while (true) { while ($rows->valid()) { // transform $entry = $this->transform($rows->current()); if ($entry...
php
{ "resource": "" }
q238035
SqlLogger.log
train
public function log(string $sql, array $parameters = []): void { $message = sprintf('[SQL]: %s', $this->removeWhitespace($sql)); $this->logger->log($this->logLevel, $message, $parameters); }
php
{ "resource": "" }
q238036
ConfigOption.setValue
train
public function setValue($value) { // set default if( $value === "" ) { $value = $this->value; } if( $this->type === "boolean" ) { $value = is_bool($value) ? $value : in_array($value, ['y', 'yes', 'on', '1']); } else if( $this->type === "number" ) { if( ! is_numeric($value) ) { throw...
php
{ "resource": "" }
q238037
ProcessUtil.exec
train
public static function exec($cmd, $timeout, &$code) { $code = -11; // File descriptors passed to the process. $descriptors = [ 0 => ['pipe', 'r'], // stdin 1 => ['pipe', 'w'], // stdout 2 => ['pipe', 'w'] // stderr ]; // Start ...
php
{ "resource": "" }
q238038
Out.err
train
public static function err($message, $endLine = PHP_EOL) { if (! Argument::getInstance()->has('quiet')) { fwrite(STDERR, $message . $endLine); } }
php
{ "resource": "" }
q238039
Out.std
train
public static function std($message, $endLine = PHP_EOL) { if (! Argument::getInstance()->has('quiet')) { fwrite(STDOUT, $message . $endLine); } }
php
{ "resource": "" }
q238040
FormBuilder.checkbox
train
public function checkbox( $name_id, $checked = false ) { $el = $this->element( 'input', $name_id, 'checkbox' ) ->value( 1 ) ->attribute( 'checked', $checked ? 'checked' : null ); return $el; }
php
{ "resource": "" }
q238041
Url.addRelativeUrl
train
public function addRelativeUrl($relativeUrl) { $this->pathTrailingSlash = S::endsWith($relativeUrl, '/'); $parts = array_filter(explode('/', trim($relativeUrl, '/'))); $this->path = array_merge($this->path, $parts); return $this; }
php
{ "resource": "" }
q238042
PregReplace.filter
train
public function filter($value) { if (!is_scalar($value) && !is_array($value)) { return $value; } if ($this->options['pattern'] === null) { throw new Exception\RuntimeException(sprintf( 'Filter %s does not have a valid pattern set', get...
php
{ "resource": "" }
q238043
PregReplace.validatePattern
train
protected function validatePattern($pattern) { if (!preg_match('/(?<modifier>[imsxeADSUXJu]+)$/', $pattern, $matches)) { return true; } if (false !== strstr($matches['modifier'], 'e')) { throw new Exception\InvalidArgumentException(sprintf( 'Pattern f...
php
{ "resource": "" }
q238044
User.getRules
train
public static function getRules($update, $id) { if (is_null($update)) { return static::$registerRules; } static::$updateRules['name'] .= ','.$id.',user_id'; static::$updateRules['email'] .= ','.$id.',user_id'; return static::$updateRules; }
php
{ "resource": "" }
q238045
User.getIsAdminAttribute
train
public function getIsAdminAttribute() { $project = Project::getProjectByUrl(Route::Input('project')); if ($project) { $admins = explode(',', $project->admins); if (in_array(Auth::id(), $admins)) { return $this->attributes['is_admin'] = true; } return $this->attributes['is_admin'] = false; } ...
php
{ "resource": "" }
q238046
User.getIsWriterAttribute
train
public function getIsWriterAttribute() { $project = Project::getProjectByUrl(Route::Input('project')); if ($project) { $writers = explode(',', $project->writers); if (in_array(Auth::id(), $writers)) { return $this->attributes['is_writer'] = true; } return $this->attributes['is_writer'] = false...
php
{ "resource": "" }
q238047
User.getIsReaderAttribute
train
public function getIsReaderAttribute() { $project = Project::getProjectByUrl(Route::Input('project')); if ($project) { $readers = explode(',', $project->readers); if (in_array(Auth::id(), $readers)) { return $this->attributes['is_reader'] = true; } return $this->attributes['is_reader'] = false...
php
{ "resource": "" }
q238048
User.getGroupIdName
train
public static function getGroupIdName($users) { $users = explode(",", $users); $usersArray = array(); foreach ($users as $user) { $user = User::find($user); if ($user) $usersArray[] = array('name' => $user->name, 'user_id' => $user->user_id); } return $usersArray; }
php
{ "resource": "" }
q238049
Zend_Locale_Data._readFile
train
private static function _readFile($locale, $path, $attribute, $value, $temp) { // without attribute - read all values // with attribute - read only this value if (!empty(self::$_ldml[(string) $locale])) { $result = self::$_ldml[(string) $locale]->xpath($path); if ...
php
{ "resource": "" }
q238050
Zend_Locale_Data._findRoute
train
private static function _findRoute($locale, $path, $attribute, $value, &$temp) { // load locale file if not already in cache // needed for alias tag when referring to other locale if (empty(self::$_ldml[(string) $locale])) { $filename = dirname(__FILE__) . '/Data/' . $locale . '....
php
{ "resource": "" }
q238051
Zend_Locale_Data._getFile
train
private static function _getFile($locale, $path, $attribute = false, $value = false, $temp = array()) { $result = self::_findRoute($locale, $path, $attribute, $value, $temp); if ($result) { $temp = self::_readFile($locale, $path, $attribute, $value, $temp); } // parse re...
php
{ "resource": "" }
q238052
Zend_Locale_Data._calendarDetail
train
private static function _calendarDetail($locale, $list) { $ret = "001"; foreach ($list as $key => $value) { if (strpos($locale, '_') !== false) { $locale = substr($locale, strpos($locale, '_') + 1); } if (strpos($key, $locale) !== false) { ...
php
{ "resource": "" }
q238053
Zend_Locale_Data._checkLocale
train
private static function _checkLocale($locale) { if (empty($locale)) { $locale = new Zend_Locale(); } if (!(Zend_Locale::isLocale((string) $locale, null, false))) { throw new Zend_Locale_Exception("Locale (" . (string) $locale . ") is a unknown locale"); } ...
php
{ "resource": "" }
q238054
Zend_Locale_Data.clearCache
train
public static function clearCache() { if (self::$_cacheTags) { self::$_cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('Zend_Locale')); } else { self::$_cache->clean(Zend_Cache::CLEANING_MODE_ALL); } }
php
{ "resource": "" }
q238055
Zend_Locale_Data._getTagSupportForCache
train
private static function _getTagSupportForCache() { $backend = self::$_cache->getBackend(); if ($backend instanceof Zend_Cache_Backend_ExtendedInterface) { $cacheOptions = $backend->getCapabilities(); self::$_cacheTags = $cacheOptions['tags']; } else { self...
php
{ "resource": "" }
q238056
_Log._getFile
train
protected static function _getFile($fullPath) { $file = ''; if (preg_match('/\/(_[A-Z].[A-Za-z]+)\.php$/', $fullPath, $matches)) { $file = isset($matches) && isset($matches[1]) ? $matches[1] : $file; self::$numFileLogs = 0; } else { switch (self::$numFileLogs)...
php
{ "resource": "" }
q238057
SessionServiceProvider.getSessionHandler
train
public function getSessionHandler(ContainerInterface $container): SessionHandlerInterface { $prefix = $container->get('ellipse.session.id.prefix'); $ttl = $container->get('ellipse.session.ttl'); $cache = $container->get('ellipse.session.cache'); return new Psr6SessionHandler($cache,...
php
{ "resource": "" }
q238058
SessionServiceProvider.getSetSessionHandlerMiddleware
train
public function getSetSessionHandlerMiddleware(ContainerInterface $container): SetSessionHandlerMiddleware { $handler = $container->get(SessionHandlerInterface::class); return new SetSessionHandlerMiddleware($handler); }
php
{ "resource": "" }
q238059
CookieJar.updateConfig
train
protected function updateConfig($key, $value = null, $default = null) { $value = $value ?: singleton('env')->get('Cookie.'.$key); if (!$value && !singleton('env')->get('Cookie.dont_use_same_config_as_sessions')) { $value = singleton('env')->get('Session.'.$key); } if(!$...
php
{ "resource": "" }
q238060
PDBquery.append
train
public function append($query, $args = null) { if ($query instanceof PDBquery) { $args = $query->getArgs(); $query = $query->getQuery(); }; $this->_query .= ' ' . $query; if (is_array($args)) { foreach ($args as $arg) { $this->_args...
php
{ "resource": "" }
q238061
PDBquery.implode
train
public function implode($glue, $queries) { $first = true; foreach ($queries as $query) { if ($first) { $first = false; } else { $this->_query .= ' ' . $glue; }; $this->append($query); }; return $this; ...
php
{ "resource": "" }
q238062
PDBquery.implodeClosed
train
public function implodeClosed($glue, $queries) { $this->_query .= ' ('; $this->implode($glue, $queries); $this->_query .= ' )'; return $this; }
php
{ "resource": "" }
q238063
PDB._getColumns
train
private function _getColumns($table) { if (isset($this->_tables[$table])) { return $this->_tables[$table]; }; $this->_tables[$table] = false; if ($rows = $this->selectArray("PRAGMA table_info({$table})")) { $cols = array(); foreach ($rows as $row) ...
php
{ "resource": "" }
q238064
PDB._execute
train
private function _execute($args = array()) { if ($this->_err) { return false; }; if ($this->_sth) { if ($this->_sth->execute($args)) { return true; } else { $this->_err = implode(' ', $this->_sth->errorInfo()); ...
php
{ "resource": "" }
q238065
PDB.exec
train
public function exec($q, $args = array()) { if ($q instanceof PDBquery) { $args = $q->getArgs(); $q = $q->getQuery(); }; return $this->_prepare($q)->_execute($args) ? $this->_sth->rowCount() : false; }
php
{ "resource": "" }
q238066
PDB.insert
train
public function insert($table, $values) { $colOK = $this->_getColumns($table); $query = $this->query('INSERT INTO ' . $table); $colQs = array(); $cols = array(); if (is_array($values)) { foreach ($values as $key => $val) { if (in_array($key, $colOK...
php
{ "resource": "" }
q238067
PDB.update
train
public function update($table, $values, $tail, $tailArgs = array()) { $colOK = $this->_getColumns($table); $query = $this->query('UPDATE ' . $table . ' SET'); $cols = array(); if (!($tail instanceof PDBquery)) { $tail = $this->query($tail, $tailArgs); }; ...
php
{ "resource": "" }
q238068
PDB.selectAtom
train
public function selectAtom($q, $args = array()) { $this->exec($q, $args); // FIXME: Test if it is indeed NULL return $this->_sth ? $this->_sth->fetchColumn() : false; }
php
{ "resource": "" }
q238069
PDB.selectList
train
public function selectList($q, $args = array()) { $this->exec($q, $args); return $this->_sth ? $this->_sth->fetchAll(\PDO::FETCH_COLUMN, 0) : false; }
php
{ "resource": "" }
q238070
PDB.selectSingleArray
train
public function selectSingleArray($q, $args = array()) { $this->exec($q, $args); return $this->_sth ? $this->_sth->fetch(\PDO::FETCH_ASSOC) : false; }
php
{ "resource": "" }
q238071
PDB.selectArray
train
public function selectArray($q, $args = array()) { $this->exec($q, $args); return $this->_sth ? $this->_sth->fetchAll(\PDO::FETCH_ASSOC) : false; }
php
{ "resource": "" }
q238072
PDB.selectArrayIndexed
train
public function selectArrayIndexed($q, $args = array()) { $this->exec($q, $args); if ($this->_sth) { $result = array(); while ($row = $this->_sth->fetch(\PDO::FETCH_ASSOC)) { $result[$row[key($row)]] = $row; }; return $result; }...
php
{ "resource": "" }
q238073
PDB.selectArrayPairs
train
public function selectArrayPairs($q, $args = array()) { $this->exec($q, $args); return $this->_sth ? $this->_sth->fetchAll(\PDO::FETCH_COLUMN | \PDO::FETCH_GROUP) : false; }
php
{ "resource": "" }
q238074
WhereCondition.andAdd
train
public function andAdd() { $args = func_get_args(); $value = array_shift($args); $params = []; while ($args) { $param = array_shift($args); if (is_array($param)) { $params = array_merge($params, $param); } else { $p...
php
{ "resource": "" }
q238075
WhereCondition.andNot
train
public function andNot() { $args = func_get_args(); call_user_func_array(array($this, 'andAdd'), $args); $value = array_pop($this->conditions); $value->not(); $this->add($value); return $this; }
php
{ "resource": "" }
q238076
WhereCondition.orAdd
train
public function orAdd() { $args = func_get_args(); $value = array_shift($args); $params = []; while ($args) { $param = array_shift($args); if (is_array($param)) { $params = array_merge($params, $param); } else { ...
php
{ "resource": "" }
q238077
WhereCondition.andNotIn
train
public function andNotIn($key, array $values) { if ($values) { $value = sprintf('%s NOT IN (%s)', $key, join(', ', array_fill(0, count($values), '?'))); return $this->andAdd($value, $values); } else { $value = '1'; return $this->andAdd($value, $values)...
php
{ "resource": "" }
q238078
WhereCondition.orIn
train
public function orIn($key, array $values) { if ($values) { $value = sprintf('%s IN (%s)', $key, join(', ', array_fill(0, count($values), '?'))); return $this->orAdd($value, $values); } else { $value = '0'; return $this->orAdd($value, $values); ...
php
{ "resource": "" }
q238079
WhereCondition.andBetween
train
public function andBetween($key, $min, $max) { $value = sprintf('%s BETWEEN ? AND ?', $key); return $this->andAdd($value, [$min, $max]); }
php
{ "resource": "" }
q238080
WhereCondition.andNotBetween
train
public function andNotBetween($key, $min, $max) { $value = sprintf('%s NOT BETWEEN ? AND ?', $key); return $this->andAdd($value, [$min, $max]); }
php
{ "resource": "" }
q238081
WhereCondition.orBetween
train
public function orBetween($key, $min, $max) { $value = sprintf('%s BETWEEN ? AND ?', $key); return $this->orAdd($value, [$min, $max]); }
php
{ "resource": "" }
q238082
WhereCondition.orNotBetween
train
public function orNotBetween($key, $min, $max) { $value = sprintf('%s NOT BETWEEN ? AND ?', $key); return $this->orAdd($value, [$min, $max]); }
php
{ "resource": "" }
q238083
WhereCondition.andLike
train
public function andLike($key, $like) { $value = sprintf('%s LIKE ?', $key); return $this->andAdd($value, [$like]); }
php
{ "resource": "" }
q238084
WhereCondition.andNotLike
train
public function andNotLike($key, $like) { $value = sprintf('%s NOT LIKE ?', $key); return $this->andAdd($value, [$like]); }
php
{ "resource": "" }
q238085
WhereCondition.orLike
train
public function orLike($key, $like) { $value = sprintf('%s LIKE ?', $key); return $this->orAdd($value, [$like]); }
php
{ "resource": "" }
q238086
WhereCondition.orNotLike
train
public function orNotLike($key, $like) { $value = sprintf('%s NOT LIKE ?', $key); return $this->orAdd($value, [$like]); }
php
{ "resource": "" }
q238087
InvalidArgumentValueException.constructException
train
private function constructException(array $details) { $this->details['argument_value_error'][$this->argument] = $this->details['argument_value_error']['ARG']; $this->details['argument_value_error'][$this->argument] = $details; unset($this->details['argument_value_error']['ARG']); }
php
{ "resource": "" }
q238088
FQuery.parseColumnNames
train
public function parseColumnNames($string, ContextAwareInterface $context = null) { $matchArray = []; preg_match_all("#~([a-zA-Z0-9_]\\.{0,1})+#", $string, $matchArray); $matchArray = array_unique($matchArray[0]); foreach ($matchArray as $match) { if($context){ ...
php
{ "resource": "" }
q238089
FQuery.execute
train
public function execute($config = null) { if(null == $config){ $pdo = Config::getDefault()->getPdo(); }else if($config instanceof \PDO){ $pdo = $config; }else if($config instanceof Config){ $pdo = $config->getPdo(); }else{ throw new Ba...
php
{ "resource": "" }
q238090
FQuery.getPdoStatement
train
public function getPdoStatement(\PDO $pdo) { $stmt = $pdo->prepare($this->getSqlString()); $bound = $this->getBoundValues(); foreach ($bound as $name => $bind) { $stmt->bindValue($name, $bind[0], $bind[1]); } return $stmt; }
php
{ "resource": "" }
q238091
FQuery.__doFQLTableNameStatic
train
public static function __doFQLTableNameStatic($path, $token = null, $escape = false) { if (null===$token) { $token=self::$DOT_TOKEN; } if ("this"===$path || empty($path)) { if($escape){ return "`this`"; }else{ return "this"...
php
{ "resource": "" }
q238092
DetailledJsonExceptionRequestHandler.handle
train
public function handle(ServerRequestInterface $request): ResponseInterface { $details = new Inspector($this->e); $contents = json_encode([ 'type' => get_class($details->inner()), 'message' => $details->inner()->getMessage(), 'context' => [ 'type' ...
php
{ "resource": "" }
q238093
Builder.compileWhereBasic
train
protected function compileWhereBasic($where) { extract($where); // Replace like with MongoRegex if ($operator == 'like') { $operator = '='; $regex = str_replace('%', '', $value); // Prepare regex if (substr($value, 0, 1) != '%') $regex = '^' . $regex; if (substr($value, -1) != '%') $r...
php
{ "resource": "" }
q238094
Builder.formatQuery
train
public function formatQuery(array $data, array $formatted = array()) { // Convert dot notation to multidimensional array elements. foreach ($data as $key => $value) { array_set($formatted, $key, $value); } return $formatted; }
php
{ "resource": "" }
q238095
Collection.getFirstNonEmptyElement
train
public static function getFirstNonEmptyElement($list, $default = null) { foreach ($list as $item) { if (empty($item) === false) { return $item; } } return $default; }
php
{ "resource": "" }
q238096
Collection.inCsv
train
public static function inCsv($item, $list, $delimiter = ',', $enclosure = '"', $escape = '\\') { return in_array($item, str_getcsv($list, $delimiter, $enclosure, $escape)); }
php
{ "resource": "" }
q238097
Route.i18n
train
public static function i18n($pattern, array $options = array()) { // Trim the pattern $pattern = rtrim($pattern, '/ '); // Do the default options $options = array_merge(array( "controller" => "\\ChickenWire\\I18n\\I18nController" ), $options); // Create basic route for all Route::match($pa...
php
{ "resource": "" }
q238098
Route.request
train
public static function request($request, &$httpStatus, &$urlParams) { // We will look for a best match $status = 404; $foundRoute = null; $foundParams = null; // Loop through routes foreach (self::$_routes as $route) { // Already done? if ($route->checked) continue; // Do the regex! ...
php
{ "resource": "" }
q238099
Route.replaceFields
train
public function replaceFields($models) { // Loop through my fields $url = $this->_pattern; foreach ($this->_patternVariables as $var) { // Look up $varName = $var[0] == '#' ? substr($var, 1) : $var; // Was there a dot (.) in it, signifying a different model? if (strstr($varName, '.')) ...
php
{ "resource": "" }