_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q252500 | Casings.pascal2snake | validation | public static function pascal2snake(string $pascal): string
{
preg_match_all('/((?:^|[A-Z])[a-z]+)/', $pascal, $matches);
if($matches !== null && count($matches) > 1 && count($matches[1]) > 1)
{
$nameParts = $matches[1];
$nameParts = array_map("lcfirst", $nameParts);... | php | {
"resource": ""
} |
q252501 | Casings.snake2pascal | validation | public static function snake2pascal(string $snake): string
{
$nameParts = explode("_", $snake);
$nameParts = array_map("ucfirst", $nameParts);
return implode("", $nameParts);
} | php | {
"resource": ""
} |
q252502 | RemotableCollection.add | validation | public function add(MethodInterface $method)
{
if ($this->isUnique($method)) {
$this->collection[] = $method;
} else {
throw new ExtDirectException("Remotable methodname {$method->getAnnotatedName()} already exists, but have to be unique");
}
} | php | {
"resource": ""
} |
q252503 | Console.main | validation | public static function main($argv, ContainerInterface $container = null)
{
$output = self::cyanLine($argv);
$app = new Application('');
$app->add(new MigrateMakeCommand());
$app->add(new MigrateUpCommand($container));
$app->add(new MigrateDownCommand());
$app->add(ne... | php | {
"resource": ""
} |
q252504 | Collection.isUnique | validation | protected function isUnique($instance)
{
foreach ($this->getCollection() as $entry) {
if ($entry->getAnnotatedName() === $instance->getAnnotatedName()) {
return false;
}
}
return true;
} | php | {
"resource": ""
} |
q252505 | Load.repeat | validation | public function repeat(&$property, $repeatTag, $classes = '', $outerTag = false, $outerClasses = '')
{
if (isset($property)) {
$output = '';
if ($outerTag) { $output .= '<'.$outerTag.' class="'.$outerClasses.'">'; }
if (is_array($property)) {
foreach ($pro... | php | {
"resource": ""
} |
q252506 | Load.model | validation | public function model($pathname) {
$fullPath = $this->config['pathToModels'] .
$this->getPath($pathname) .
$this->config['modelsPrefix'] .
$this->getName($pathname) .
$this->config['modelsPostfix'] .
'.php';
... | php | {
"resource": ""
} |
q252507 | Load.library | validation | public function library($pathname, &$caller = false, $exposeToView = false) {
$name = $this->getName($pathname);
$path = $this->getPath($pathname);
// If a reference to the calling object was passed, set an instance of
// the library as one of its members.
if ($caller) ... | php | {
"resource": ""
} |
q252508 | Load.view | validation | public function view($pathname = '', $data = false, $return = false) {
if (is_array($data) || is_object($data)) {
foreach ($data as $key => $value) {
$$key = $value;
}
}
// If no pathname specified, grab template name.
if ($pathname == '') {
... | php | {
"resource": ""
} |
q252509 | Creator.new | validation | public static function new(
string $type = 'default',
string $path = Migrate::DEFAULT_PATH,
$notify = NotifyInterface::LOGGER
): Creator
{
$fs = new Filesystem(new Local($path));
$note = NotifyFactory::create($notify);
return new static(CreatorFactory::create($ty... | php | {
"resource": ""
} |
q252510 | Neuron_GameServer_Map_Pathfinder.getPath | validation | public function getPath
(
Neuron_GameServer_Map_Location $start,
Neuron_GameServer_Map_Location $end
)
{
// Start here :-)
$x1 = $start[0];
$y1 = $start[1];
$x2 = $end[0];
$y2 = $end[1];
if (!$this->isPassable ($x2, $y2))
{
return false;
}
$astar = $this->astar ($start, $end);
... | php | {
"resource": ""
} |
q252511 | Engine.display | validation | public function display($template, array $vars = array())
{
if (null === ($path = $this->locator->locate($template))) {
throw TemplateNotFoundException::format(
'The template "%s" does not exist.',
$template
);
}
$this->renderInScope(
... | php | {
"resource": ""
} |
q252512 | Engine.render | validation | public function render($template, array $vars = array())
{
ob_start();
try {
$this->display($template, $vars);
} catch (Exception $exception) {
ob_end_clean();
throw $exception;
}
return ob_get_clean();
} | php | {
"resource": ""
} |
q252513 | Caller.handleResponseContent | validation | protected function handleResponseContent(ResponseInterface $response, $contentType = null)
{
$contents = $response->getBody()->getContents();
if (!$contentType) {
$contentTypeHeaderLine = $response->getHeaderLine('Content-Type');
if (stripos($contentTypeHeaderLine, 'applica... | php | {
"resource": ""
} |
q252514 | HttpMethodsClient.sendRequest | validation | public function sendRequest(RequestInterface $request)
{
$this->lastOperation = new Operation($request);
$response = parent::sendRequest($request);
$this->lastOperation->setResponse($response);
return $response;
} | php | {
"resource": ""
} |
q252515 | Migrate.install | validation | public function install(): Migrate
{
Whois::print($this->getNotify());
// Create a migration table in the
// database if it does not exist.
$this->exists() || $this->migrationRepository->createRepository();
return $this;
} | php | {
"resource": ""
} |
q252516 | ExtDirectResponse.buildResponse | validation | protected function buildResponse()
{
$res = array();
$res['type'] = $this->getParameters()->getType();
$res['tid'] = $this->getParameters()->getTid();
$res['action'] = $this->getParameters()->getAction();
$res['method'] = $this->getParameters()->getMethod();
$res['res... | php | {
"resource": ""
} |
q252517 | PurchaseResponse.getMessage | validation | public function getMessage()
{
$response = [];
if ($messages = $this->data->query('/Message/Body/Errors')->array()) {
foreach ($messages as $message) {
$response[] = $message->textContent;
}
}
return count($response) ? implode(', ', $response... | php | {
"resource": ""
} |
q252518 | MigrationCreator.getStubs | validation | protected function getStubs(?string $table = null, bool $create = false): iterable
{
if (is_null($table)) {
yield M::TYPE_UP => $this->stubs->read('blank.sql.stub');
yield M::TYPE_DOWN => $this->stubs->read('blank.sql.stub');
return;
}
$first = [M::TYPE_U... | php | {
"resource": ""
} |
q252519 | MigrationCreator.populateStub | validation | protected function populateStub(string $filename, string $stub, ?string $table = null): string
{
$search = ['{name}', '{table}'];
$replace = [$filename, $table ?: 'dummy_table'];
return str_replace($search, $replace, $stub);
} | php | {
"resource": ""
} |
q252520 | EmailUtilities.applyDataToView | validation | public static function applyDataToView($view, $data)
{
// do placeholder replacement, currently {xxx}
if (!empty($data)) {
foreach ($data as $name => $value) {
if (is_string($value)) {
// replace {xxx} in subject
$view = str_replace... | php | {
"resource": ""
} |
q252521 | PhpErrorUtil.getErrorString | validation | public static function getErrorString( int $errno )
{
$errno = intval($errno);
$errors = array(
E_ERROR => 'E_ERROR',
E_WARNING => 'E_WARNING',
E_PARSE => 'E_PARSE',
E_NOTICE => 'E_NOTIC... | php | {
"resource": ""
} |
q252522 | NumberGenerator.getFloat | validation | public function getFloat($min, $max)
{
if ($min > $max) {
throw new InvalidArgumentException('Min cannot be greater than max');
}
$random01 = \mt_rand() / \mt_getrandmax();
// [0, 1] -> [min, max]:
// y = (max - min) * x + min
return ($max - $min) * $ran... | php | {
"resource": ""
} |
q252523 | Model._populate | validation | public function _populate($record = null, $db = false, $loadMap = false)
{
// In order to stop unnecessary recursive issetExtended() checks while doing initial hydrating of model.
$this->model_hydrating = true;
// If this model is having a custom DB object passed into it,
// then we'll use ... | php | {
"resource": ""
} |
q252524 | Model._populateAttributes | validation | protected function _populateAttributes($record)
{
foreach ($this->model_attributes as $key => $def) {
// If the data is present in the DB, assign to model.
// Otherwise ignore any data returned from the DB that isn't defined in the model.
if (isset($record[$this->getFieldName($key)]))... | php | {
"resource": ""
} |
q252525 | Model._populateNonModelData | validation | protected function _populateNonModelData($record)
{
$nonObjectData = array_diff_key($record, $this->model_attributes);
if (count($nonObjectData) > 0) {
foreach ($nonObjectData as $key => $value) {
// Note that if the model is using custom field names, this will result in a piece of da... | php | {
"resource": ""
} |
q252526 | Model.isPlaceholder | validation | public function isPlaceholder($attributeName)
{
// Ref this model's attributes in a shorter variable.
$def = $this->model_attributes[$attributeName];
if (isset($def['models']) || (isset($def['model']) && isset($def['usesRefTable']))) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q252527 | Model._getQueryObjectForRelation | validation | protected function _getQueryObjectForRelation($attribute)
{
// Setup
$def = $this->model_attributes[$attribute];
// If not a model relationship, just return an adaptor for this model
if (!isset($def['model']) && !isset($def['models'])) {
return $this->getDbAdaptor();
}
... | php | {
"resource": ""
} |
q252528 | Model._getCustomValue | validation | protected function _getCustomValue($attributeName, $query, $loadMap = false)
{
$def = $this->model_attributes[$attributeName];
$result = $this->_getRelation($attributeName, $query, $loadMap); //$this->_getAttributeData($attributeName, $query, $loadMap);
if (!$result) {
$result = $query->f... | php | {
"resource": ""
} |
q252529 | Model._getRelation | validation | protected function _getRelation($attributeName, $query = false, $loadMap = false, $record = false)
{
// Grab attribute definition
$def = $this->model_attributes[$attributeName];
$result = false;
if (isset($def['models'])) {
$result = $this->_getModels($attributeName, $def['mod... | php | {
"resource": ""
} |
q252530 | Model._getModel | validation | protected function _getModel($attributeName, $relatedObjName = false, $query = false, $loadMap = false, $record = false)
{
$def = $this->model_attributes[$attributeName];
$result = null;
if ($relatedObjName) {
// If a LoadMap is present, and explicit fetching of the data isn't enabled, a... | php | {
"resource": ""
} |
q252531 | Model._getModels | validation | protected function _getModels($attributeName, $relatedObjName = false, $query = false, $loadMap = false)
{
$def = $this->model_attributes[$attributeName];
$result = [];
if ($relatedObjName) {
// If the relationship is one-to-many.
if (isset($def['via'])) {
$result = $thi... | php | {
"resource": ""
} |
q252532 | Model._getAttributeDataWhenSet | validation | protected function _getAttributeDataWhenSet($attributeName, $query = false, $loadMap = false, $record = false)
{
// Check if the stored data is numeric.
// If it's not, then we don't need to worry about it being a
// class reference that we need to fetch.
if (is_numeric($this->model_data[$a... | php | {
"resource": ""
} |
q252533 | Model._getAttributeDataWhenUnset | validation | protected function _getAttributeDataWhenUnset($attributeName, $query = false, $loadMap = false, $record = false)
{
// If the attribute isn't the primary key of our current model, do dynamic fetch.
if ($attributeName != $this->getPrimaryKey()) {
// If the attribute is defined as a m... | php | {
"resource": ""
} |
q252534 | Model._getAttributeData | validation | protected function _getAttributeData($name, $query = false, $loadMap = false, $record = false)
{
///////////////////////////////////////////////////////////////////////
// -------------------------------------
// If the model DB data is already set.
// -------------------------------------
... | php | {
"resource": ""
} |
q252535 | Model.getDataAttributes | validation | public function getDataAttributes($excludeExtended = false)
{
$attributes = new \Cora\Collection();
foreach ($this->model_attributes as $key => $def) {
if (!isset($def['model']) && !isset($def['models'])) {
$attributes->add($key);
}
}
if (is... | php | {
"resource": ""
} |
q252536 | Model.getAttributeValue | validation | public function getAttributeValue($name, $convertDates = true)
{
if (isset($this->model_data[$name])) {
$result = $this->model_data[$name];
if ($result instanceof \DateTime && $convertDates == true) {
$result = $result->format('Y-m-d H:i:s');
}
... | php | {
"resource": ""
} |
q252537 | Model.getAttributeValueExtended | validation | public function getAttributeValueExtended($name, $convertDates = true)
{
if (isset($this->model_data[$name])) {
$result = $this->model_data[$name];
if ($result instanceof \DateTime && $convertDates == true) {
$result = $result->format('Y-m-d H:i:s');
}
... | php | {
"resource": ""
} |
q252538 | Model._getModelsFromTableColumn | validation | protected function _getModelsFromTableColumn($attributeName, $objName, $relationColumnName, $query = false, $loadMap = false)
{
// Figure out the unique identifying field of the model we want to grab.
$relatedObj = $this->fetchRelatedObj($objName);
$idField = $relatedObj->getPrimaryKey();
/... | php | {
"resource": ""
} |
q252539 | Model.getModelsFromCustomRelationship | validation | public function getModelsFromCustomRelationship($attributeName, $objName, $query = false, $loadMap = false)
{
// Create a repository for the related object.
$repo = \Cora\RepositoryFactory::make($objName, false, false, false, $this->model_db);
// Grab a Query Builder object for the connect... | php | {
"resource": ""
} |
q252540 | Model.getFullClassName | validation | function getFullClassName($class = false)
{
if ($class == false) { $class = $this; }
$className = get_class($class);
if ($pos = strpos($className, '\\')) return substr($className, $pos + 1);
return $className;
} | php | {
"resource": ""
} |
q252541 | Model._fetchData | validation | protected function _fetchData($name)
{
$gateway = new \Cora\Gateway($this->getDbAdaptor(), $this->getTableName(), $this->getPrimaryKey());
return $gateway->fetchData($this->getFieldName($name), $this);
} | php | {
"resource": ""
} |
q252542 | Model.getFieldName | validation | public function getFieldName($attributeName)
{
if (isset($this->model_attributes[$attributeName]['field'])) {
return $this->model_attributes[$attributeName]['field'];
}
return $attributeName;
} | php | {
"resource": ""
} |
q252543 | Model.loadAll | validation | public function loadAll()
{
$this->data->id = $this->id;
foreach ($this->model_attributes as $key => $value) {
$temp = $this->$key;
}
} | php | {
"resource": ""
} |
q252544 | ReaderAbstract.checkPath | validation | protected static function checkPath(/*# string */ $path)
{
if (!file_exists($path)) {
throw new NotFoundException(
Message::get(Message::MSG_PATH_NOTFOUND, $path),
Message::MSG_PATH_NOTFOUND
);
}
if (!is_readable($path)) {
... | php | {
"resource": ""
} |
q252545 | Sanitizer.name | validation | public static function name($string = null)
{
if (!$string) return null;
// Convert to lowercase, set UTF-8 character encoding, trim and return CamelCased string
return trim(ucwords(mb_strtolower(trim($string), "UTF-8")));
} | php | {
"resource": ""
} |
q252546 | Sanitizer.email | validation | public static function email($email = null, $errorMsg = null)
{
if (!$email) return null;
// Convert to lowercase and set UTF-8 character encoding
$email = trim(mb_strtolower(trim($email), "UTF-8"));
// Validate email address
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) ... | php | {
"resource": ""
} |
q252547 | Neuron_GameServer_Mappers_PlayerMapper.getDataFromId | validation | public static function getDataFromId ($id)
{
$db = Neuron_Core_Database::__getInstance ();
$id = intval ($id);
$r = $db->getDataFromQuery ($db->customQuery
("
SELECT
*
FROM
n_players
WHERE
n_players.plid = '".$id."'
"));
if (count ($r) == 1)
{
return $r[0];
}
return nu... | php | {
"resource": ""
} |
q252548 | ApiClient.sendMessage | validation | public function sendMessage(
$chatId,
$text,
$disableWebPagePreview = null,
$replyToMessageId = null,
$replyMarkup = null
) {
$response = $this->apiRequest("sendMessage", [
"chat_id" => $chatId,
"text" => $text,
"disable_web_page_pr... | php | {
"resource": ""
} |
q252549 | ApiClient.entityFromBody | validation | public function entityFromBody($body, $entity)
{
$json = $this->decodeJson($body);
return $entity->populate($json);
} | php | {
"resource": ""
} |
q252550 | SeedCreator.populateStub | validation | protected function populateStub(string $stub, ?string $class = null): string
{
return str_replace('{class}', $this->getName($class), $stub);
} | php | {
"resource": ""
} |
q252551 | MappingTrait.setMappings | validation | public static function setMappings(
array $messages,
/*# bool */ $manual = true
) {
$class = get_called_class();
if ($manual) {
// set default
static::$messages = $messages;
// status changed
self::setStatus();
} else {
... | php | {
"resource": ""
} |
q252552 | MappingTrait.getMessage | validation | protected static function getMessage(/*# int */ $code)/*# : string */
{
$mapping = static::getMappings();
if (isset($mapping[$code])) {
return $mapping[$code];
}
return (string) $code;
} | php | {
"resource": ""
} |
q252553 | Consumer.buildAuthString | validation | public static function buildAuthString(array $data)
{
$str = array();
foreach ($data as $k => $v) {
$str[] = self::urlEncode($k) . '="' . self::urlEncode($v) . '"';
}
return implode(', ', $str);
} | php | {
"resource": ""
} |
q252554 | Consumer.buildBasestring | validation | public static function buildBasestring($method, Url $url, array $data)
{
$base = array();
$base[] = self::urlEncode(self::getNormalizedMethod($method));
$base[] = self::urlEncode(self::getNormalizedUrl($url));
$base[] = self::urlEncode(self::getNormalizedParameters($data));
... | php | {
"resource": ""
} |
q252555 | Consumer.getNormalizedUrl | validation | public static function getNormalizedUrl(Url $url)
{
$scheme = $url->getScheme();
$host = $url->getHost();
$port = $url->getPort();
$path = $url->getPath();
// no port for 80 (http) and 443 (https)
if ((($port == 80 || empty($port)) && strcasecmp($scheme, 'http'... | php | {
"resource": ""
} |
q252556 | Consumer.getNormalizedParameters | validation | public static function getNormalizedParameters(array $data)
{
$params = array();
$keys = array_map('PSX\Oauth\Consumer::urlEncode', array_keys($data));
$values = array_map('PSX\Oauth\Consumer::urlEncode', array_values($data));
$data = array_combine($keys, $values);
uks... | php | {
"resource": ""
} |
q252557 | Neuron_GameServer_Credits.handleUseRequest | validation | public function handleUseRequest ($data, $transactionId, $transactionKey)
{
if (!$this->objCredits) {
return null;
}
if (isset ($_POST['transaction_id']) && isset ($_POST['transaction_secret']))
{
$valid = $this->objCredits->isRequestValid ($_POST['transaction_id'], $_POST['transaction_secret']);
if... | php | {
"resource": ""
} |
q252558 | NotifyLogger.note | validation | public function note(string $message): void
{
$this->logger->log($this->level, strip_tags($message));
} | php | {
"resource": ""
} |
q252559 | AbstractRequest.getBaseData | validation | public function getBaseData()
{
$data = new FluidXml(false);
$message = $data->addChild('Message', ['version' => $this->getApiVersion()], true);
$header = $message->addChild('Header', true);
$header->addChild('Time', $this->getTime());
$itentity = $header->addChild('Identi... | php | {
"resource": ""
} |
q252560 | Neuron_Auth_MySQLConnection.query | validation | function query($sql, $params = array())
{
$db = Neuron_DB_Database::getInstance ();
$sql = $this->printf ($sql, $params);
if ($this->debug)
{
echo $sql . "<br><br>";
}
try
{
//echo $sql . "<br><br>";
$data = $db->query ($... | php | {
"resource": ""
} |
q252561 | Neuron_Auth_MySQLConnection.getOne | validation | function getOne($sql, $params = array())
{
//echo 'get one --- ';
$data = $this->query ($sql, $params);
if (count ($data) > 0)
{
$data = array_values ($data[0]);
return $data[0];
}
return false;
} | php | {
"resource": ""
} |
q252562 | Neuron_Auth_MySQLConnection.getRow | validation | function getRow($sql, $params = array())
{
//echo 'get row --- ';
$data = $this->query ($sql, $params);
$row = false;
if (count ($data) > 0)
{
$row = $data[0];
}
//var_dump ($row);
//echo '<br><br>';
return $row;
} | php | {
"resource": ""
} |
q252563 | ExtDirectRequest.getAnnotationClassForAction | validation | protected function getAnnotationClassForAction($requestAction)
{
/** @var array $actions */
$actions = $this->getActions();
/** @var ClassInterface $action */
foreach ($actions as $action) {
if ($action->getAnnotatedName() === $requestAction) {
return $ac... | php | {
"resource": ""
} |
q252564 | ExtDirectRequest.getAnnotationMethodForMethod | validation | protected function getAnnotationMethodForMethod(ClassInterface $class, $requestMethod)
{
/** @var MethodInterface $method */
foreach ($class->getMethods() as $method) {
if ($method->getAnnotatedName() === $requestMethod) {
return $method;
}
}
... | php | {
"resource": ""
} |
q252565 | ConversionTrait.convertCase | validation | public static function convertCase(
/*# string */ $string,
/*# string */ $toCase
)/*# string */ {
// break into lower case words
$str = strtolower(ltrim(
preg_replace(['/[A-Z]/', '/[_]/'], [' $0', ' '], $string)
));
switch (strtoupper($toCase)) {
... | php | {
"resource": ""
} |
q252566 | ConversionTrait.hasSuffix | validation | public static function hasSuffix(
/*# string */ $string,
/*# string */ $suffix
)/*# : bool */ {
$len = strlen($suffix);
if ($len && substr($string, - $len) === $suffix) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q252567 | ConversionTrait.removeSuffix | validation | public static function removeSuffix(
/*# string */ $string,
/*# string */ $suffix
)/*# string */ {
if (static::hasSuffix($string, $suffix)) {
return substr($string, 0, - strlen($suffix));
}
return $string;
} | php | {
"resource": ""
} |
q252568 | Base.getLocations | validation | public function getLocations()
{
if (is_null($this->_locations)) {
$this->_locations = $this->determineLocations();
}
return $this->_locations;
} | php | {
"resource": ""
} |
q252569 | Base.setFormField | validation | public function setFormField($value)
{
if (is_array($value)) {
if (is_null($this->formFieldClass)) {
throw new Exception("DB Field incorrectly set up. What is the form class?");
}
if (is_null($this->_formField)) {
$config = $value;
... | php | {
"resource": ""
} |
q252570 | Base.getHuman | validation | public function getHuman()
{
if (is_null($this->_human)) {
$this->_human = HumanFieldDetector::test($this->fieldSchema);
}
return $this->_human;
} | php | {
"resource": ""
} |
q252571 | Base.getMultiline | validation | public function getMultiline()
{
if (is_null($this->_multiline)) {
$this->_multiline = MultilineDetector::test($this->fieldSchema);
}
return $this->_multiline;
} | php | {
"resource": ""
} |
q252572 | Base.setModel | validation | public function setModel($value)
{
$this->_model = $value;
if (is_object($value) && $this->_attributes) {
$this->_model->attributes = $this->_attributes;
}
return true;
} | php | {
"resource": ""
} |
q252573 | Base.setAttributes | validation | public function setAttributes($value)
{
$this->_attributes = $value;
if ($this->model) {
$this->_model->attributes = $value;
}
} | php | {
"resource": ""
} |
q252574 | Base.setFormat | validation | public function setFormat($value)
{
if (is_array($value)) {
if (!isset($value['class'])) {
$value['class'] = $this->determineFormatClass();
}
$value['field'] = $this;
$value = Yii::createObject($value);
}
$this->_format = $value... | php | {
"resource": ""
} |
q252575 | Base.getFormattedValue | validation | public function getFormattedValue()
{
if ($this->format instanceof BaseFormat) {
$formattedValue = $this->format->get();
} elseif (is_callable($this->format) || (is_array($this->format) && !empty($this->format[0]) && is_object($this->format[0]))) {
$formattedValue = $this->ev... | php | {
"resource": ""
} |
q252576 | Base.getFormValue | validation | public function getFormValue()
{
if ($this->format instanceof BaseFormat) {
$formValue = $this->format->getFormValue();
} elseif (is_callable($this->format) || (is_array($this->format) && !empty($this->format[0]) && is_object($this->format[0]))) {
$formValue = $this->evaluate... | php | {
"resource": ""
} |
q252577 | Generator.getBaseNamespace | validation | public function getBaseNamespace()
{
if (!empty($this->moduleSet) && isset(Yii::$app->extensions[$this->moduleSet])) {
$bsClass = Yii::$app->extensions[$this->moduleSet]['bootstrap'];
$bsReflector = new \ReflectionClass(new $bsClass());
return $bsReflector->getNamespaceN... | php | {
"resource": ""
} |
q252578 | Generator.getMigrationClassName | validation | public function getMigrationClassName()
{
$postfix = '_initial_' . $this->tableName;
if (is_dir($this->migrationDirectory)) {
$searchExisting = FileHelper::findFiles($this->migrationDirectory, ['only' => [$postfix . '.php']]);
if (!empty($searchExisting)) {
re... | php | {
"resource": ""
} |
q252579 | Generator.getPrimaryKeyLocation | validation | public function getPrimaryKeyLocation($table)
{
// if multiple, put the primary key in the indicies section
$count = 0;
foreach ($table->columns as $column) {
if ($column->isPrimaryKey) {
$count++;
}
if ($count > 1) {
return... | php | {
"resource": ""
} |
q252580 | Generator.getModuleSetModules | validation | public function getModuleSetModules()
{
if (empty($this->moduleSet) || !isset(Yii::$app->extensions[$this->moduleSet])) {
return '';
}
$bsClass = Yii::$app->extensions[$this->moduleSet]['bootstrap'];
$p = [];
$bs = new $bsClass();
$modules = $bs->getModule... | php | {
"resource": ""
} |
q252581 | Generator.generateRules | validation | public function generateRules($table)
{
$types = [];
$lengths = [];
foreach ($table->columns as $column) {
if ($column->autoIncrement) {
continue;
}
if (!$column->allowNull && $column->defaultValue === null && !$column->isPrimaryKey) {
... | php | {
"resource": ""
} |
q252582 | Generator.getModelMap | validation | public function getModelMap()
{
$m = [];
$search = [];
foreach ($this->searchModels as $path => $namespace) {
$files = FileHelper::findFiles(Yii::getAlias($path), ['only' => ['.php']]);
foreach ($files as $file) {
$baseName = strstr(basename($file), '.... | php | {
"resource": ""
} |
q252583 | FormBuilder.setDesigner | validation | public function setDesigner(Designer $designer){
$this->designer=$designer;
$this->designer->build($this);
} | php | {
"resource": ""
} |
q252584 | FormBuilder.addField | validation | public function addField(FormField $field){
$this->fields[]=$field;
if($field->getName()==null){
$field->setName('name_'.count($this->fields));
}
if($field->getId()==null){
$field->setId('id_'.count($this->fields));
}
if($field instanceof FileField){
$this->formTags['enctype']='multipart/form-d... | php | {
"resource": ""
} |
q252585 | FormBuilder.removeField | validation | public function removeField($name){
for($i=0; $i<count($this->fields); $i++){
if($this->fields[$i]->getName()==$name){
array_splice($this->fields,$i,1);
break;
}
}
} | php | {
"resource": ""
} |
q252586 | FormBuilder.render | validation | public function render(){
$html=$this->formatter->renderFormBegin($this->formTags);
foreach($this->fields as $field){
$html.=$this->formatter->renderField($field);
}
$html.=$this->renderSubmit();
$html.=$this->renderEnd();
return $html;
} | php | {
"resource": ""
} |
q252587 | FormBuilder.renderFields | validation | public function renderFields(){
$html='';
foreach($this->fields as $field){
$html.=$this->formatter->renderField($field);
}
return $html;
} | php | {
"resource": ""
} |
q252588 | FormBuilder.renderField | validation | public function renderField($name){
$html='';
$field=$this->getField($name);
$html.=$this->formatter->renderField($field);
return $html;
} | php | {
"resource": ""
} |
q252589 | FormBuilder.getField | validation | public function getField($name){
foreach($this->fields as $field){
if($field->getName()==$name)
return $field;
}
throw new FieldNotFoundException($name);
} | php | {
"resource": ""
} |
q252590 | FormBuilder.setData | validation | public function setData($data){
$data=$this->transformer->encode($data);
foreach($this->fields as $field){
if(isset($data[$field->getName()])){
$field->setData($data[$field->getName()]);
}
}
} | php | {
"resource": ""
} |
q252591 | FormBuilder.getData | validation | public function getData(){
$data=[];
foreach($this->fields as $field){
if(preg_match('/^(.*?)(\[.*\])$/',$field->getName(),$result)){
if($result[2]==''){
//FIXME autoincrement field
}
else{
if(!preg_match_all("/\[(.*?)\]/", $result[2], $resultDeep)){
throw new \Exception('Invalid fie... | php | {
"resource": ""
} |
q252592 | FormBuilder.submit | validation | public function submit(Request $request){
$this->isConfirmed=false;
if($this->formTags['method']=='post' && $request->getType()=='POST'){
$this->isConfirmed=true;
}
$query=$request->getQuery();
if(count($this->fields)>0 && $this->formTags['method']=='get' && isset($query[$this->fields[0]->getName()])){
... | php | {
"resource": ""
} |
q252593 | FormBuilder.getErrors | validation | public function getErrors(){
$errors=[];
foreach($this->fields as $field){
if(!$field->isValid()){
$errors[]=['field'=>$field->getLabel(),'message'=>$field->getError()];
}
}
return $errors;
} | php | {
"resource": ""
} |
q252594 | Phase1.compress | validation | private function compress($dwnlSnap, $pv, $calcId)
{
$in = new \Praxigento\Core\Data();
$in->set(PPhase1::IN_DWNL_PLAIN, $dwnlSnap);
$in->set(PPhase1::IN_PV, $pv);
$in->set(PPhase1::IN_CALC_ID, $calcId);
$in->set(PPhase1::IN_KEY_CALC_ID, EBonDwnl::A_CALC_REF);
$in->se... | php | {
"resource": ""
} |
q252595 | LazyObjectsFactory.generateProxy | validation | private function generateProxy($className)
{
if (isset($this->checkedClasses[$className])) {
return $this->checkedClasses[$className];
}
$proxyParameters = array(
'className' => $className,
'factory' => get_class($this),
... | php | {
"resource": ""
} |
q252596 | Form.getValue | validation | public function getValue($name = null)
{
if ($this->has($name)) {
return $this->get($name)->getValue();
}
return parent::getValue();
} | php | {
"resource": ""
} |
q252597 | Form.getInputFilter | validation | public function getInputFilter()
{
if ($this->filter) {
return $this->filter;
}
$specifications = [];
if ($this->object && $this->object instanceof InputFilterProviderInterface) {
$specifications = $this->object->getInputFilterSpecification();
}
... | php | {
"resource": ""
} |
q252598 | PermalinkManager.add | validation | public function add($blockFile, $blockContent)
{
$this->removeBlock($blockFile);
$blockPermalinks = $this->fetchPermalinksFromBlock($blockContent, $blockFile);
if (!empty($blockPermalinks)) {
$this->permalinks = array_merge_recursive($this->permalinks, $blockPermalinks);
... | php | {
"resource": ""
} |
q252599 | PermalinkManager.removeBlock | validation | public function removeBlock($blockFile)
{
foreach ($this->permalinks as $permalink => $associatedBlocks) {
$tmp = array_flip($associatedBlocks);
unset($tmp[$blockFile]);
if (empty($tmp)) {
unset($this->permalinks[$permalink]);
continue;
... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.