_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q241600 | YiiRequirementChecker.checkUploadMaxFileSize | validation | function checkUploadMaxFileSize($min = null, $max = null)
{
$postMaxSize = ini_get('post_max_size');
$uploadMaxFileSize = ini_get('upload_max_filesize');
if ($min !== null) {
$minCheckResult = $this->compareByteSize($postMaxSize, $min, '>=') && $this->compareByteSize($uploadMaxFi... | php | {
"resource": ""
} |
q241601 | YiiRequirementChecker.normalizeRequirement | validation | function normalizeRequirement($requirement, $requirementKey = 0)
{
if (!is_array($requirement)) {
$this->usageError('Requirement must be an array!');
}
if (!array_key_exists('condition', $requirement)) {
$this->usageError("Requirement '{$requirementKey}' has no condit... | php | {
"resource": ""
} |
q241602 | GridView.renderErrors | validation | public function renderErrors()
{
if ($this->filterModel instanceof Model && $this->filterModel->hasErrors()) {
return Html::errorSummary($this->filterModel, $this->filterErrorSummaryOptions);
}
return '';
} | php | {
"resource": ""
} |
q241603 | GridView.getClientOptions | validation | protected function getClientOptions()
{
$filterUrl = isset($this->filterUrl) ? $this->filterUrl : Yii::$app->request->url;
$id = $this->filterRowOptions['id'];
$filterSelector = "#$id input, #$id select";
if (isset($this->filterSelector)) {
$filterSelector .= ', ' . $this... | php | {
"resource": ""
} |
q241604 | GridView.renderItems | validation | public function renderItems()
{
$caption = $this->renderCaption();
$columnGroup = $this->renderColumnGroup();
$tableHeader = $this->showHeader ? $this->renderTableHeader() : false;
$tableBody = $this->renderTableBody();
$tableFooter = false;
$tableFooterAfterBody = f... | php | {
"resource": ""
} |
q241605 | GridView.renderCaption | validation | public function renderCaption()
{
if (!empty($this->caption)) {
return Html::tag('caption', $this->caption, $this->captionOptions);
}
return false;
} | php | {
"resource": ""
} |
q241606 | GridView.renderColumnGroup | validation | public function renderColumnGroup()
{
foreach ($this->columns as $column) {
/* @var $column Column */
if (!empty($column->options)) {
$cols = [];
foreach ($this->columns as $col) {
$cols[] = Html::tag('col', '', $col->options);
... | php | {
"resource": ""
} |
q241607 | GridView.renderTableFooter | validation | public function renderTableFooter()
{
$cells = [];
foreach ($this->columns as $column) {
/* @var $column Column */
$cells[] = $column->renderFooterCell();
}
$content = Html::tag('tr', implode('', $cells), $this->footerRowOptions);
if ($this->filterPosi... | php | {
"resource": ""
} |
q241608 | GridView.renderFilters | validation | public function renderFilters()
{
if ($this->filterModel !== null) {
$cells = [];
foreach ($this->columns as $column) {
/* @var $column Column */
$cells[] = $column->renderFilterCell();
}
return Html::tag('tr', implode('', $cel... | php | {
"resource": ""
} |
q241609 | GridView.renderTableBody | validation | public function renderTableBody()
{
$models = array_values($this->dataProvider->getModels());
$keys = $this->dataProvider->getKeys();
$rows = [];
foreach ($models as $index => $model) {
$key = $keys[$index];
if ($this->beforeRow !== null) {
$ro... | php | {
"resource": ""
} |
q241610 | ViewFinderTrait.getViewNames | validation | public function getViewNames($schema = '', $refresh = false)
{
if (!isset($this->_viewNames[$schema]) || $refresh) {
$this->_viewNames[$schema] = $this->findViewNames($schema);
}
return $this->_viewNames[$schema];
} | php | {
"resource": ""
} |
q241611 | QueryTrait.isEmpty | validation | protected function isEmpty($value)
{
return $value === '' || $value === [] || $value === null || is_string($value) && trim($value) === '';
} | php | {
"resource": ""
} |
q241612 | Controller.isColorEnabled | validation | public function isColorEnabled($stream = \STDOUT)
{
return $this->color === null ? Console::streamSupportsAnsiColors($stream) : $this->color;
} | php | {
"resource": ""
} |
q241613 | Controller.stderr | validation | public function stderr($string)
{
if ($this->isColorEnabled(\STDERR)) {
$args = func_get_args();
array_shift($args);
$string = Console::ansiFormat($string, $args);
}
return fwrite(\STDERR, $string);
} | php | {
"resource": ""
} |
q241614 | Controller.getOptionValues | validation | public function getOptionValues($actionID)
{
// $actionId might be used in subclasses to provide properties specific to action id
$properties = [];
foreach ($this->options($this->action->id) as $property) {
$properties[$property] = $this->$property;
}
return $pro... | php | {
"resource": ""
} |
q241615 | Controller.getPassedOptionValues | validation | public function getPassedOptionValues()
{
$properties = [];
foreach ($this->_passedOptions as $property) {
$properties[$property] = $this->$property;
}
return $properties;
} | php | {
"resource": ""
} |
q241616 | Controller.getActionArgsHelp | validation | public function getActionArgsHelp($action)
{
$method = $this->getActionMethodReflection($action);
$tags = $this->parseDocCommentTags($method);
$params = isset($tags['param']) ? (array) $tags['param'] : [];
$args = [];
/** @var \ReflectionParameter $reflection */
for... | php | {
"resource": ""
} |
q241617 | Controller.parseDocCommentDetail | validation | protected function parseDocCommentDetail($reflection)
{
$comment = strtr(trim(preg_replace('/^\s*\**( |\t)?/m', '', trim($reflection->getDocComment(), '/'))), "\r", '');
if (preg_match('/^\s*@\w+/m', $comment, $matches, PREG_OFFSET_CAPTURE)) {
$comment = trim(substr($comment, 0, $matches... | php | {
"resource": ""
} |
q241618 | MultipartFormDataParser.getByteSize | validation | private function getByteSize($verboseSize)
{
if (empty($verboseSize)) {
return 0;
}
if (is_numeric($verboseSize)) {
return (int) $verboseSize;
}
$sizeUnit = trim($verboseSize, '0123456789');
$size = trim(str_replace($sizeUnit, '', $verboseSize)... | php | {
"resource": ""
} |
q241619 | ErrorHandler.renderException | validation | protected function renderException($exception)
{
if (Yii::$app->has('response')) {
$response = Yii::$app->getResponse();
// reset parameters of response to avoid interference with partially created response data
// in case the error occurred while sending the response.
... | php | {
"resource": ""
} |
q241620 | ErrorHandler.renderCallStackItem | validation | public function renderCallStackItem($file, $line, $class, $method, $args, $index)
{
$lines = [];
$begin = $end = 0;
if ($file !== null && $line !== null) {
$line--; // adjust line number from one-based to zero-based
$lines = @file($file);
if ($line < 0 || ... | php | {
"resource": ""
} |
q241621 | ErrorHandler.renderCallStack | validation | public function renderCallStack($exception)
{
$out = '<ul>';
$out .= $this->renderCallStackItem($exception->getFile(), $exception->getLine(), null, null, [], 1);
for ($i = 0, $trace = $exception->getTrace(), $length = count($trace); $i < $length; ++$i) {
$file = !empty($trace[$i]... | php | {
"resource": ""
} |
q241622 | ErrorHandler.createServerInformationLink | validation | public function createServerInformationLink()
{
$serverUrls = [
'http://httpd.apache.org/' => ['apache'],
'http://nginx.org/' => ['nginx'],
'http://lighttpd.net/' => ['lighttpd'],
'http://gwan.com/' => ['g-wan', 'gwan'],
'http://iis.net/' => ['iis'... | php | {
"resource": ""
} |
q241623 | ErrorHandler.argumentsToString | validation | public function argumentsToString($args)
{
$count = 0;
$isAssoc = $args !== array_values($args);
foreach ($args as $key => $value) {
$count++;
if ($count >= 5) {
if ($count > 5) {
unset($args[$key]);
} else {
... | php | {
"resource": ""
} |
q241624 | ErrorHandler.getExceptionName | validation | public function getExceptionName($exception)
{
if ($exception instanceof \yii\base\Exception || $exception instanceof \yii\base\InvalidCallException || $exception instanceof \yii\base\InvalidParamException || $exception instanceof \yii\base\UnknownMethodException) {
return $exception->getName();... | php | {
"resource": ""
} |
q241625 | ImageValidator.validateImage | validation | protected function validateImage($image)
{
if (false === ($imageInfo = getimagesize($image->tempName))) {
return [$this->notImage, ['file' => $image->name]];
}
list($width, $height) = $imageInfo;
if ($width == 0 || $height == 0) {
return [$this->notImage, ['... | php | {
"resource": ""
} |
q241626 | Sort.getOrders | validation | public function getOrders($recalculate = false)
{
$attributeOrders = $this->getAttributeOrders($recalculate);
$orders = [];
foreach ($attributeOrders as $attribute => $direction) {
$definition = $this->attributes[$attribute];
$columns = $definition[$direction === SORT... | php | {
"resource": ""
} |
q241627 | Sort.getAttributeOrders | validation | public function getAttributeOrders($recalculate = false)
{
if ($this->_attributeOrders === null || $recalculate) {
$this->_attributeOrders = [];
if (($params = $this->params) === null) {
$request = Yii::$app->getRequest();
$params = $request instanceof... | php | {
"resource": ""
} |
q241628 | Sort.setAttributeOrders | validation | public function setAttributeOrders($attributeOrders, $validate = true)
{
if ($attributeOrders === null || !$validate) {
$this->_attributeOrders = $attributeOrders;
} else {
$this->_attributeOrders = [];
foreach ($attributeOrders as $attribute => $order) {
... | php | {
"resource": ""
} |
q241629 | Sort.getAttributeOrder | validation | public function getAttributeOrder($attribute)
{
$orders = $this->getAttributeOrders();
return isset($orders[$attribute]) ? $orders[$attribute] : null;
} | php | {
"resource": ""
} |
q241630 | Sort.link | validation | public function link($attribute, $options = [])
{
if (($direction = $this->getAttributeOrder($attribute)) !== null) {
$class = $direction === SORT_DESC ? 'desc' : 'asc';
if (isset($options['class'])) {
$options['class'] .= ' ' . $class;
} else {
... | php | {
"resource": ""
} |
q241631 | ActiveRecord.loadDefaultValues | validation | public function loadDefaultValues($skipIfSet = true)
{
foreach (static::getTableSchema()->columns as $column) {
if ($column->defaultValue !== null && (!$skipIfSet || $this->{$column->name} === null)) {
$this->{$column->name} = $column->defaultValue;
}
}
... | php | {
"resource": ""
} |
q241632 | ActiveRecord.filterValidAliases | validation | protected static function filterValidAliases(Query $query)
{
$tables = $query->getTablesUsedInFrom();
$aliases = array_diff(array_keys($tables), $tables);
return array_map(function ($alias) {
return preg_replace('/{{([\w]+)}}/', '$1', $alias);
}, array_values($aliases))... | php | {
"resource": ""
} |
q241633 | ActiveRecord.filterCondition | validation | protected static function filterCondition(array $condition, array $aliases = [])
{
$result = [];
$db = static::getDb();
$columnNames = static::filterValidColumnNames($db, $aliases);
foreach ($condition as $key => $value) {
if (is_string($key) && !in_array($db->quoteSql($... | php | {
"resource": ""
} |
q241634 | ActiveRecord.filterValidColumnNames | validation | protected static function filterValidColumnNames($db, array $aliases)
{
$columnNames = [];
$tableName = static::tableName();
$quotedTableName = $db->quoteTableName($tableName);
foreach (static::getTableSchema()->getColumnNames() as $columnName) {
$columnNames[] = $column... | php | {
"resource": ""
} |
q241635 | ActiveRecord.updateAll | validation | public static function updateAll($attributes, $condition = '', $params = [])
{
$command = static::getDb()->createCommand();
$command->update(static::tableName(), $attributes, $condition, $params);
return $command->execute();
} | php | {
"resource": ""
} |
q241636 | ActiveRecord.updateAllCounters | validation | public static function updateAllCounters($counters, $condition = '', $params = [])
{
$n = 0;
foreach ($counters as $name => $value) {
$counters[$name] = new Expression("[[$name]]+:bp{$n}", [":bp{$n}" => $value]);
$n++;
}
$command = static::getDb()->createComma... | php | {
"resource": ""
} |
q241637 | ActiveRecord.deleteAll | validation | public static function deleteAll($condition = null, $params = [])
{
$command = static::getDb()->createCommand();
$command->delete(static::tableName(), $condition, $params);
return $command->execute();
} | php | {
"resource": ""
} |
q241638 | ActiveRecord.getTableSchema | validation | public static function getTableSchema()
{
$tableSchema = static::getDb()
->getSchema()
->getTableSchema(static::tableName());
if ($tableSchema === null) {
throw new InvalidConfigException('The table does not exist: ' . static::tableName());
}
ret... | php | {
"resource": ""
} |
q241639 | ActiveRecord.delete | validation | public function delete()
{
if (!$this->isTransactional(self::OP_DELETE)) {
return $this->deleteInternal();
}
$transaction = static::getDb()->beginTransaction();
try {
$result = $this->deleteInternal();
if ($result === false) {
$tra... | php | {
"resource": ""
} |
q241640 | ActiveRecord.deleteInternal | validation | protected function deleteInternal()
{
if (!$this->beforeDelete()) {
return false;
}
// we do not check the return value of deleteAll() because it's possible
// the record is already deleted in the database and thus the method will return 0
$condition = $this->get... | php | {
"resource": ""
} |
q241641 | BaseMarkdown.process | validation | public static function process($markdown, $flavor = null)
{
$parser = static::getParser($flavor);
return $parser->parse($markdown);
} | php | {
"resource": ""
} |
q241642 | BaseMarkdown.processParagraph | validation | public static function processParagraph($markdown, $flavor = null)
{
$parser = static::getParser($flavor);
return $parser->parseParagraph($markdown);
} | php | {
"resource": ""
} |
q241643 | BaseHtmlPurifier.process | validation | public static function process($content, $config = null)
{
$configInstance = \HTMLPurifier_Config::create($config instanceof \Closure ? null : $config);
$configInstance->autoFinalize = false;
$purifier = \HTMLPurifier::instance($configInstance);
$purifier->config->set('Cache.Serializ... | php | {
"resource": ""
} |
q241644 | Cors.overrideDefaultSettings | validation | public function overrideDefaultSettings($action)
{
if (isset($this->actions[$action->id])) {
$actionParams = $this->actions[$action->id];
$actionParamsKeys = array_keys($actionParams);
foreach ($this->cors as $headerField => $headerValue) {
if (in_array($h... | php | {
"resource": ""
} |
q241645 | Cors.prepareHeaders | validation | public function prepareHeaders($requestHeaders)
{
$responseHeaders = [];
// handle Origin
if (isset($requestHeaders['Origin'], $this->cors['Origin'])) {
if (in_array($requestHeaders['Origin'], $this->cors['Origin'], true)) {
$responseHeaders['Access-Control-Allow-... | php | {
"resource": ""
} |
q241646 | Cors.addCorsHeaders | validation | public function addCorsHeaders($response, $headers)
{
if (empty($headers) === false) {
$responseHeaders = $response->getHeaders();
foreach ($headers as $field => $value) {
$responseHeaders->set($field, $value);
}
}
} | php | {
"resource": ""
} |
q241647 | Request.getIsFlash | validation | public function getIsFlash()
{
$userAgent = $this->headers->get('User-Agent', '');
return stripos($userAgent, 'Shockwave') !== false
|| stripos($userAgent, 'Flash') !== false;
} | php | {
"resource": ""
} |
q241648 | Request.getBodyParams | validation | public function getBodyParams()
{
if ($this->_bodyParams === null) {
if (isset($_POST[$this->methodParam])) {
$this->_bodyParams = $_POST;
unset($this->_bodyParams[$this->methodParam]);
return $this->_bodyParams;
}
$rawCont... | php | {
"resource": ""
} |
q241649 | Request.get | validation | public function get($name = null, $defaultValue = null)
{
if ($name === null) {
return $this->getQueryParams();
}
return $this->getQueryParam($name, $defaultValue);
} | php | {
"resource": ""
} |
q241650 | Request.getHostInfo | validation | public function getHostInfo()
{
if ($this->_hostInfo === null) {
$secure = $this->getIsSecureConnection();
$http = $secure ? 'https' : 'http';
if ($this->headers->has('X-Forwarded-Host')) {
$this->_hostInfo = $http . '://' . trim(explode(',', $this->heade... | php | {
"resource": ""
} |
q241651 | Request.setHostInfo | validation | public function setHostInfo($value)
{
$this->_hostName = null;
$this->_hostInfo = $value === null ? null : rtrim($value, '/');
} | php | {
"resource": ""
} |
q241652 | Request.utf8Encode | validation | private function utf8Encode($s)
{
$s .= $s;
$len = \strlen($s);
for ($i = $len >> 1, $j = 0; $i < $len; ++$i, ++$j) {
switch (true) {
case $s[$i] < "\x80": $s[$j] = $s[$i]; break;
case $s[$i] < "\xC0": $s[$j] = "\xC2"; $s[++$j] = $s[$i]; break;
... | php | {
"resource": ""
} |
q241653 | Request.getPort | validation | public function getPort()
{
if ($this->_port === null) {
$serverPort = $this->getServerPort();
$this->_port = !$this->getIsSecureConnection() && $serverPort !== null ? $serverPort : 80;
}
return $this->_port;
} | php | {
"resource": ""
} |
q241654 | Request.setPort | validation | public function setPort($value)
{
if ($value != $this->_port) {
$this->_port = (int) $value;
$this->_hostInfo = null;
}
} | php | {
"resource": ""
} |
q241655 | Request.setSecurePort | validation | public function setSecurePort($value)
{
if ($value != $this->_securePort) {
$this->_securePort = (int) $value;
$this->_hostInfo = null;
}
} | php | {
"resource": ""
} |
q241656 | Request.getAcceptableContentTypes | validation | public function getAcceptableContentTypes()
{
if ($this->_contentTypes === null) {
if ($this->headers->get('Accept') !== null) {
$this->_contentTypes = $this->parseAcceptHeader($this->headers->get('Accept'));
} else {
$this->_contentTypes = [];
... | php | {
"resource": ""
} |
q241657 | Request.getAcceptableLanguages | validation | public function getAcceptableLanguages()
{
if ($this->_languages === null) {
if ($this->headers->has('Accept-Language')) {
$this->_languages = array_keys($this->parseAcceptHeader($this->headers->get('Accept-Language')));
} else {
$this->_languages = []... | php | {
"resource": ""
} |
q241658 | Request.getETags | validation | public function getETags()
{
if ($this->headers->has('If-None-Match')) {
return preg_split('/[\s,]+/', str_replace('-gzip', '', $this->headers->get('If-None-Match')), -1, PREG_SPLIT_NO_EMPTY);
}
return [];
} | php | {
"resource": ""
} |
q241659 | Request.getCookies | validation | public function getCookies()
{
if ($this->_cookies === null) {
$this->_cookies = new CookieCollection($this->loadCookies(), [
'readOnly' => true,
]);
}
return $this->_cookies;
} | php | {
"resource": ""
} |
q241660 | Request.validateCsrfTokenInternal | validation | private function validateCsrfTokenInternal($clientSuppliedToken, $trueToken)
{
if (!is_string($clientSuppliedToken)) {
return false;
}
$security = Yii::$app->security;
return $security->compareString($security->unmaskToken($clientSuppliedToken), $security->unmaskToken($... | php | {
"resource": ""
} |
q241661 | Block.run | validation | public function run()
{
$block = ob_get_clean();
if ($this->renderInPlace) {
echo $block;
}
$this->view->blocks[$this->getId()] = $block;
} | php | {
"resource": ""
} |
q241662 | OracleMutex.init | validation | public function init()
{
parent::init();
if (strncmp($this->db->driverName, 'oci', 3) !== 0 && strncmp($this->db->driverName, 'odbc', 4) !== 0) {
throw new InvalidConfigException('In order to use OracleMutex connection must be configured to use Oracle database.');
}
} | php | {
"resource": ""
} |
q241663 | ActiveField.begin | validation | public function begin()
{
if ($this->form->enableClientScript) {
$clientOptions = $this->getClientOptions();
if (!empty($clientOptions)) {
$this->form->attributes[] = $clientOptions;
}
}
$inputID = $this->getInputId();
$attribute =... | php | {
"resource": ""
} |
q241664 | ActiveField.hiddenInput | validation | public function hiddenInput($options = [])
{
$options = array_merge($this->inputOptions, $options);
$this->adjustLabelFor($options);
$this->parts['{input}'] = Html::activeHiddenInput($this->model, $this->attribute, $options);
return $this;
} | php | {
"resource": ""
} |
q241665 | ActiveField.adjustLabelFor | validation | protected function adjustLabelFor($options)
{
if (!isset($options['id'])) {
return;
}
$this->_inputId = $options['id'];
if (!isset($this->labelOptions['for'])) {
$this->labelOptions['for'] = $options['id'];
}
} | php | {
"resource": ""
} |
q241666 | ActiveField.addErrorClassIfNeeded | validation | protected function addErrorClassIfNeeded(&$options)
{
// Get proper attribute name when attribute name is tabular.
$attributeName = Html::getAttributeName($this->attribute);
if ($this->model->hasErrors($attributeName)) {
Html::addCssClass($options, $this->form->errorCssClass);
... | php | {
"resource": ""
} |
q241667 | Module.getInstance | validation | public static function getInstance()
{
$class = get_called_class();
return isset(Yii::$app->loadedModules[$class]) ? Yii::$app->loadedModules[$class] : null;
} | php | {
"resource": ""
} |
q241668 | Module.setInstance | validation | public static function setInstance($instance)
{
if ($instance === null) {
unset(Yii::$app->loadedModules[get_called_class()]);
} else {
Yii::$app->loadedModules[get_class($instance)] = $instance;
}
} | php | {
"resource": ""
} |
q241669 | Module.init | validation | public function init()
{
if ($this->controllerNamespace === null) {
$class = get_class($this);
if (($pos = strrpos($class, '\\')) !== false) {
$this->controllerNamespace = substr($class, 0, $pos) . '\\controllers';
}
}
} | php | {
"resource": ""
} |
q241670 | Module.getUniqueId | validation | public function getUniqueId()
{
return $this->module ? ltrim($this->module->getUniqueId() . '/' . $this->id, '/') : $this->id;
} | php | {
"resource": ""
} |
q241671 | Module.getBasePath | validation | public function getBasePath()
{
if ($this->_basePath === null) {
$class = new \ReflectionClass($this);
$this->_basePath = dirname($class->getFileName());
}
return $this->_basePath;
} | php | {
"resource": ""
} |
q241672 | Module.getModule | validation | public function getModule($id, $load = true)
{
if (($pos = strpos($id, '/')) !== false) {
// sub-module
$module = $this->getModule(substr($id, 0, $pos));
return $module === null ? null : $module->getModule(substr($id, $pos + 1), $load);
}
if (isset($this... | php | {
"resource": ""
} |
q241673 | Module.getModules | validation | public function getModules($loadedOnly = false)
{
if ($loadedOnly) {
$modules = [];
foreach ($this->_modules as $module) {
if ($module instanceof self) {
$modules[] = $module;
}
}
return $modules;
}
... | php | {
"resource": ""
} |
q241674 | Module.setModules | validation | public function setModules($modules)
{
foreach ($modules as $id => $module) {
$this->_modules[$id] = $module;
}
} | php | {
"resource": ""
} |
q241675 | Module.isIncorrectClassNameOrPrefix | validation | private function isIncorrectClassNameOrPrefix($className, $prefix)
{
if (!preg_match('%^[a-z][a-z0-9\\-_]*$%', $className)) {
return true;
}
if ($prefix !== '' && !preg_match('%^[a-z0-9_/]+$%i', $prefix)) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q241676 | Module.beforeAction | validation | public function beforeAction($action)
{
$event = new ActionEvent($action);
$this->trigger(self::EVENT_BEFORE_ACTION, $event);
return $event->isValid;
} | php | {
"resource": ""
} |
q241677 | Module.afterAction | validation | public function afterAction($action, $result)
{
$event = new ActionEvent($action);
$event->result = $result;
$this->trigger(self::EVENT_AFTER_ACTION, $event);
return $event->result;
} | php | {
"resource": ""
} |
q241678 | CompareValidator.compareValues | validation | protected function compareValues($operator, $type, $value, $compareValue)
{
if ($type === self::TYPE_NUMBER) {
$value = (float) $value;
$compareValue = (float) $compareValue;
} else {
$value = (string) $value;
$compareValue = (string) $compareValue;
... | php | {
"resource": ""
} |
q241679 | Component.__isset | validation | public function __isset($name)
{
$getter = 'get' . $name;
if (method_exists($this, $getter)) {
return $this->$getter() !== null;
}
// behavior property
$this->ensureBehaviors();
foreach ($this->_behaviors as $behavior) {
if ($behavior->canGetP... | php | {
"resource": ""
} |
q241680 | Component.hasProperty | validation | public function hasProperty($name, $checkVars = true, $checkBehaviors = true)
{
return $this->canGetProperty($name, $checkVars, $checkBehaviors) || $this->canSetProperty($name, false, $checkBehaviors);
} | php | {
"resource": ""
} |
q241681 | Component.canGetProperty | validation | public function canGetProperty($name, $checkVars = true, $checkBehaviors = true)
{
if (method_exists($this, 'get' . $name) || $checkVars && property_exists($this, $name)) {
return true;
} elseif ($checkBehaviors) {
$this->ensureBehaviors();
foreach ($this->_behavi... | php | {
"resource": ""
} |
q241682 | Component.hasMethod | validation | public function hasMethod($name, $checkBehaviors = true)
{
if (method_exists($this, $name)) {
return true;
} elseif ($checkBehaviors) {
$this->ensureBehaviors();
foreach ($this->_behaviors as $behavior) {
if ($behavior->hasMethod($name)) {
... | php | {
"resource": ""
} |
q241683 | Component.hasEventHandlers | validation | public function hasEventHandlers($name)
{
$this->ensureBehaviors();
foreach ($this->_eventWildcards as $wildcard => $handlers) {
if (!empty($handlers) && StringHelper::matchWildcard($wildcard, $name)) {
return true;
}
}
return !empty($this->_... | php | {
"resource": ""
} |
q241684 | Component.off | validation | public function off($name, $handler = null)
{
$this->ensureBehaviors();
if (empty($this->_events[$name]) && empty($this->_eventWildcards[$name])) {
return false;
}
if ($handler === null) {
unset($this->_events[$name], $this->_eventWildcards[$name]);
... | php | {
"resource": ""
} |
q241685 | Component.trigger | validation | public function trigger($name, Event $event = null)
{
$this->ensureBehaviors();
$eventHandlers = [];
foreach ($this->_eventWildcards as $wildcard => $handlers) {
if (StringHelper::matchWildcard($wildcard, $name)) {
$eventHandlers = array_merge($eventHandlers, $ha... | php | {
"resource": ""
} |
q241686 | Component.getBehavior | validation | public function getBehavior($name)
{
$this->ensureBehaviors();
return isset($this->_behaviors[$name]) ? $this->_behaviors[$name] : null;
} | php | {
"resource": ""
} |
q241687 | Component.detachBehaviors | validation | public function detachBehaviors()
{
$this->ensureBehaviors();
foreach ($this->_behaviors as $name => $behavior) {
$this->detachBehavior($name);
}
} | php | {
"resource": ""
} |
q241688 | Component.attachBehaviorInternal | validation | private function attachBehaviorInternal($name, $behavior)
{
if (!($behavior instanceof Behavior)) {
$behavior = Yii::createObject($behavior);
}
if (is_int($name)) {
$behavior->attach($this);
$this->_behaviors[] = $behavior;
} else {
if ... | php | {
"resource": ""
} |
q241689 | LinkPager.renderPageButtons | validation | protected function renderPageButtons()
{
$pageCount = $this->pagination->getPageCount();
if ($pageCount < 2 && $this->hideOnSinglePage) {
return '';
}
$buttons = [];
$currentPage = $this->pagination->getPage();
// first page
$firstPageLabel = $th... | php | {
"resource": ""
} |
q241690 | FileCache.init | validation | public function init()
{
parent::init();
$this->cachePath = Yii::getAlias($this->cachePath);
if (!is_dir($this->cachePath)) {
FileHelper::createDirectory($this->cachePath, $this->dirMode, true);
}
} | php | {
"resource": ""
} |
q241691 | BaseJson.encode | validation | public static function encode($value, $options = 320)
{
$expressions = [];
$value = static::processData($value, $expressions, uniqid('', true));
set_error_handler(function () {
static::handleJsonError(JSON_ERROR_SYNTAX);
}, E_WARNING);
$json = json_encode($value, ... | php | {
"resource": ""
} |
q241692 | QueryBuilder.prepareInsertSelectSubQuery | validation | protected function prepareInsertSelectSubQuery($columns, $schema, $params = [])
{
if (!is_array($columns->select) || empty($columns->select) || in_array('*', $columns->select)) {
throw new InvalidArgumentException('Expected select query object with enumerated (named) parameters');
}
... | php | {
"resource": ""
} |
q241693 | QueryBuilder.update | validation | public function update($table, $columns, $condition, &$params)
{
list($lines, $params) = $this->prepareUpdateSets($table, $columns, $params);
$sql = 'UPDATE ' . $this->db->quoteTableName($table) . ' SET ' . implode(', ', $lines);
$where = $this->buildWhere($condition, $params);
retur... | php | {
"resource": ""
} |
q241694 | QueryBuilder.delete | validation | public function delete($table, $condition, &$params)
{
$sql = 'DELETE FROM ' . $this->db->quoteTableName($table);
$where = $this->buildWhere($condition, $params);
return $where === '' ? $sql : $sql . ' ' . $where;
} | php | {
"resource": ""
} |
q241695 | QueryBuilder.dropPrimaryKey | validation | public function dropPrimaryKey($name, $table)
{
return 'ALTER TABLE ' . $this->db->quoteTableName($table)
. ' DROP CONSTRAINT ' . $this->db->quoteColumnName($name);
} | php | {
"resource": ""
} |
q241696 | QueryBuilder.dropColumn | validation | public function dropColumn($table, $column)
{
return 'ALTER TABLE ' . $this->db->quoteTableName($table)
. ' DROP COLUMN ' . $this->db->quoteColumnName($column);
} | php | {
"resource": ""
} |
q241697 | QueryBuilder.dropForeignKey | validation | public function dropForeignKey($name, $table)
{
return 'ALTER TABLE ' . $this->db->quoteTableName($table)
. ' DROP CONSTRAINT ' . $this->db->quoteColumnName($name);
} | php | {
"resource": ""
} |
q241698 | QueryBuilder.dropUnique | validation | public function dropUnique($name, $table)
{
return 'ALTER TABLE ' . $this->db->quoteTableName($table)
. ' DROP CONSTRAINT ' . $this->db->quoteColumnName($name);
} | php | {
"resource": ""
} |
q241699 | QueryBuilder.dropCheck | validation | public function dropCheck($name, $table)
{
return 'ALTER TABLE ' . $this->db->quoteTableName($table)
. ' DROP CONSTRAINT ' . $this->db->quoteColumnName($name);
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.