_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q238300
NodeValidator.validateByParent
train
public function validateByParent($nodeType, NodeInterface $parent = null) { if (!$nodeType) { return true; } $config = $this->getNodeTypeConfig($nodeType); if (null === $config) { return false; } if ((null !== $parent) && $parent->getType()) ...
php
{ "resource": "" }
q238301
Parser.filterEmptyLines
train
public function filterEmptyLines(array $lines) { return array_filter($lines, function ($line) { $line = trim($line); return $line !== '*' ? $line : false; }); }
php
{ "resource": "" }
q238302
DefinitionProvider.createForClasses
train
public function createForClasses(array $classNameToFiles): array { $definitionCollection = []; foreach ($classNameToFiles as $className => $file) { $definitionCollection[$className] = $this->collectDefinitionsForClass($className, $file); } return $definitionCollection; ...
php
{ "resource": "" }
q238303
DefinitionProvider.createForDocumentation
train
public function createForDocumentation(array $files): array { if (in_array(Constants::TEST_TYPE_DOCUMENTATION, $this->types)) { $definitions = []; foreach ($files as $file) { $key = $this->getTestGroupNameForDocumentationFile($file); $definitions[$key]...
php
{ "resource": "" }
q238304
Node.nodeToString
train
protected function nodeToString(string $indent = ''): string { $str = $indent . "--{$this->getName()}--\n"; foreach ($this->getChildren() as $child) { $str .= $child->nodeToString($indent . ' '); } return $str; }
php
{ "resource": "" }
q238305
AutoTablesExtension.renderTable
train
public function renderTable(\Twig_Environment $env, $args = array()) { $array = array(); $config = $this->fillModel($array); $array['deleteUrl'] = $this->fetchUrl($args, 'delete', $config->getDeleteRoute()); $array['tableId'] = $config->getId(); $array['transScope'] = $config->ge...
php
{ "resource": "" }
q238306
AutoTablesExtension.renderTableJs
train
public function renderTableJs(\Twig_Environment $env, $args = array()) { $array = array(); $config = $this->fillModel($array); $array['updateUrl'] = $this->fetchUrl($args, 'update', $config->getUpdateRoute()); $array['deleteUrl'] = $this->fetchUrl($args, 'delete', $config->getDeleteRout...
php
{ "resource": "" }
q238307
AutoTablesExtension.renderStylesheets
train
public function renderStylesheets(\Twig_Environment $env, $args = array()) { $frontendFramework = $this->fetchAutoTablesGlobalConfiguration()->getFrontendFramework(); return $this->render($env, 'twentystepsAutoTablesBundle:AutoTablesExtension:autoTableStylesheets.html.twig', array( ...
php
{ "resource": "" }
q238308
AutoTablesExtension.defineOptions
train
public function defineOptions(\Twig_Environment $env, $args) { $request = $this->requestStack->getCurrentRequest(); if ($request) { $config = $this->fetchAutoTablesConfiguration($args); $entities = $this->entityInspectionService->parseEntities($this->getParameter($args, 'entities...
php
{ "resource": "" }
q238309
AutoTablesExtension.checkIncludeJavascript
train
private function checkIncludeJavascript() { $request = $this->requestStack->getCurrentRequest(); $rtn = !$request->attributes->has($this::JS_INCLUDE_KEY); if (!$rtn) { $request->attributes->set($this::JS_INCLUDE_KEY, true); } return $rtn; }
php
{ "resource": "" }
q238310
CategoryRepository.getCategoriesPlain
train
public function getCategoriesPlain() : Collection { static $categories; if ($categories) { return $categories; } $categories = []; $languages = TransHelper::getAllLanguages(); foreach (Category::all() as $category) { $categoryData = [ ...
php
{ "resource": "" }
q238311
ExecHelper.replaceElementUsingLink
train
public function replaceElementUsingLink( $execMethod, $args = [ ], $targetDiv, $linkText, $anchorAttrs = [ ] ) { $url = $this->url( $execMethod, $args, true ); $attrs = [ ]; foreach ($anchorAttrs as $k => $v) { $attrs[ ] = "{$k}='{$v}'"; } $attrsStr = implode( ' '...
php
{ "resource": "" }
q238312
Mailer.send
train
public function send($to) { $message = Swift_Message::newInstance($this->subject) ->setFrom(array(MAIL_USERNAME => 'View Tuber')) ->setTo($to) ->setBody($this->body); if ($this->mailer->send($message)) { echo 'Sent'; } ...
php
{ "resource": "" }
q238313
YmlFileManager.loadYmlFile
train
public function loadYmlFile($fileName, $path) { $configDirectories = array(($path!=null)?$path:$this->rootDir); $locator = new FileLocator($configDirectories); $ymlFile = $locator->locate($fileName, null, true); $ymlDatas = Yaml::parse($ymlFile); $dataArray = array(); ...
php
{ "resource": "" }
q238314
BelongsTo.beforeSelect
train
public function beforeSelect(Select $event) { if ($this->isLazyLoaded()) { return; } $fields = $this->getFieldsPrefixed(); $table = $this->entityDescriptor->getTableName(); $relateTable = $this->getParentTableName(); $pmk = $this->getParentPrimaryKey(); ...
php
{ "resource": "" }
q238315
BelongsTo.afterSelect
train
public function afterSelect(Select $event) { if ($this->isLazyLoaded()) { return; } foreach ($event->getEntityCollection() as $index => $entity) { $row = $event->getData()[$index]; $entity->{$this->propertyName} = $this->getFromMap($row); } }
php
{ "resource": "" }
q238316
BelongsTo.getFieldsPrefixed
train
protected function getFieldsPrefixed() { $table = $this->getParentTableName(); $data = []; foreach ($this->getParentFields() as $field) { $data[] = "{$field->getField()} AS ". "{$table}_{$field->getField()}"; } return $data; }
php
{ "resource": "" }
q238317
BelongsTo.map
train
protected function map($dataRow) { $data = $this->getData($dataRow); $pmk = $this->getParentPrimaryKey(); $entity = (isset($data[$pmk]) && $data[$pmk]) ? $this->getParentEntityMapper()->createFrom($data) : null; return null == $entity ? null : $this->registerE...
php
{ "resource": "" }
q238318
BelongsTo.getData
train
protected function getData($dataRow) { $data = []; $relateTable = $this->getParentTableName(); $regexp = "/{$relateTable}_(?P<name>.+)/i"; foreach ($dataRow as $field => $value) { if (preg_match($regexp, $field, $matched)) { $data[$matched['name']] = $valu...
php
{ "resource": "" }
q238319
ehough_curly_Url.setUser
train
public function setUser($user) { $regex = '`^' . self::$_regexUser . '$`i'; if (preg_match_all($regex, $user, $matches) !== 1) { throw new InvalidArgumentException('User must match ' . $regex); } $this->_user = $user; }
php
{ "resource": "" }
q238320
ehough_curly_Url.setHost
train
public function setHost($host) { if (! (self::_isHostname($host) || self::_isIpAddress($host))) { throw new InvalidArgumentException("Invalid host ($host)"); } $this->_host = strtolower(trim($host)); }
php
{ "resource": "" }
q238321
ehough_curly_Url.setQueryVariables
train
public function setQueryVariables($array) { if (! is_array($array)) { throw new InvalidArgumentException('Must pass an array to setQueryVariables()'); } $parts = array(); foreach ($array as $name => $value) { $name = urlencode($name); if (! is...
php
{ "resource": "" }
q238322
ContainerObject._compareData
train
protected function _compareData($dataToCheck, $key, $originalData, $comparator) { if (is_callable($dataToCheck)) { return call_user_func_array($dataToCheck, [$key, $originalData, $this]); } return $this->_comparator($originalData, $dataToCheck, $comparator); }
php
{ "resource": "" }
q238323
ContainerObject.removeObjectError
train
public function removeObjectError($key = null) { $this->_genericDestroy($key, 'error_list'); $this->_hasErrors = false; return $this; }
php
{ "resource": "" }
q238324
ContainerObject.serialize
train
public function serialize($skipObjects = false) { $this->_prepareData(); $temporaryData = $this->toArray(); $data = ''; if ($skipObjects) { $temporaryData = $this->traveler( 'self::_skipObject', null, $temporaryD...
php
{ "resource": "" }
q238325
ContainerObject.get
train
public function get($key = null) { $this->_prepareData($key); $data = null; if (is_null($key)) { $data = $this->_DATA; } elseif (array_key_exists($key, $this->_DATA)) { $data = $this->_DATA[$key]; } if ($this->_getPreparationOn) { ...
php
{ "resource": "" }
q238326
ContainerObject.set
train
public function set($key, $data = null) { if (is_array($key)) { $this->appendArray($key); } else { $this->appendData($key, $data); } return $this; }
php
{ "resource": "" }
q238327
ContainerObject.returnOriginalData
train
public function returnOriginalData($key = null) { $this->_prepareData($key); $mergedData = array_merge($this->_DATA, $this->_originalDATA); $data = $this->_removeNewKeys($mergedData); if (array_key_exists($key, $data)) { return $data[$key]; } retu...
php
{ "resource": "" }
q238328
ContainerObject._comparator
train
protected function _comparator($dataOrigin, $dataCheck, $operator) { switch ($operator) { case '===': return $dataOrigin === $dataCheck; // no break, always will return boolean value case '!==': return $dataOrigin !== $dataCheck; ...
php
{ "resource": "" }
q238329
ContainerObject.destroy
train
public function destroy($key = null) { if (is_null($key)) { $this->_dataChanged = true; $mergedData = array_merge($this->_DATA, $this->_originalDATA); $this->_originalDATA = $this->_removeNewKeys($mergedData); $this->_DATA = []; } el...
php
{ "resource": "" }
q238330
ContainerObject.restore
train
public function restore($key = null) { if (is_null($key)) { $mergedData = array_merge($this->_DATA, $this->_originalDATA); $this->_DATA = $this->_removeNewKeys($mergedData); $this->_dataChanged = false; $this->_newKeys = []; } else {...
php
{ "resource": "" }
q238331
ContainerObject.toString
train
public function toString($separator = null) { if (!is_null($separator)) { $this->_separator = $separator; } $this->_prepareData(); return $this->__toString(); }
php
{ "resource": "" }
q238332
ContainerObject.toXml
train
public function toXml($addCdata = true, $dtd = false, $version = '1.0') { $this->_prepareData(); $xml = new Xml(['version' => $version]); $root = $xml->createElement('root'); $xml = $this->_arrayToXml($this->toArray(), $xml, $addCdata, $root); $xml->appendChild($roo...
php
{ "resource": "" }
q238333
ContainerObject.toStdClass
train
public function toStdClass() { $this->_prepareData(); $data = new stdClass(); foreach ($this->toArray() as $key => $val) { $data->$key = $val; } return $data; }
php
{ "resource": "" }
q238334
ContainerObject.keyDataChanged
train
public function keyDataChanged($key) { $data = $this->toArray($key); $originalData = $this->returnOriginalData($key); return $data !== $originalData; }
php
{ "resource": "" }
q238335
ContainerObject.traveler
train
public function traveler( $function, $methodAttributes = null, $data = null, $recursive = false ) { if (!$data) { $data =& $this->_DATA; } foreach ($data as $key => $value) { $isRecursive = is_array($value) && $recursive; ...
php
{ "resource": "" }
q238336
ContainerObject._recursiveTraveler
train
protected function _recursiveTraveler($function, $methodAttributes, $data) { foreach ($data as $key => $value) { if (is_array($value)) { $data[$key] = $this->_recursiveTraveler($function, $methodAttributes, $value); } else { $data[$key] = $this->_callU...
php
{ "resource": "" }
q238337
ContainerObject._callUserFunction
train
protected function _callUserFunction($function, $key, $value, $attributes) { if (is_callable($function)) { return call_user_func_array($function, [$key, $value, $this, $attributes]); } return $value; }
php
{ "resource": "" }
q238338
ContainerObject.mergeBlueObject
train
public function mergeBlueObject(Container $object) { $newData = $object->toArray(); foreach ($newData as $key => $value) { $this->appendData($key, $value); } $this->_dataChanged = true; return $this; }
php
{ "resource": "" }
q238339
ContainerObject.appendJson
train
public function appendJson($data) { $jsonData = json_decode($data, true); if (is_null($jsonData)) { $this->_errorsList['json_decode'] = 'Json cannot be decoded.'; $this->_hasErrors = true; return $this; } $this->appendArray($jsonData); i...
php
{ "resource": "" }
q238340
ContainerObject.appendSimpleXml
train
public function appendSimpleXml($data) { $loadedXml = simplexml_load_string($data); $jsonXml = json_encode($loadedXml); $jsonData = json_decode($jsonXml, true); $this->appendArray($jsonData); if ($this->_objectCreation) { return $this->_afterAp...
php
{ "resource": "" }
q238341
ContainerObject.appendXml
train
public function appendXml($data) { $xml = new Xml(); $xml->preserveWhiteSpace = false; $bool = @$xml->loadXML($data); if (!$bool) { $this->_errorsList['xml_load_error'] = $data; $this->_hasErrors ...
php
{ "resource": "" }
q238342
ContainerObject._xmlToArray
train
protected function _xmlToArray(DOMElement $data) { $temporaryData = []; /** @var $node DOMElement */ foreach ($data->childNodes as $node) { $nodeName = $this->_stringToIntegerKey($node->nodeName); $nodeData = []; $unSerializedData = ...
php
{ "resource": "" }
q238343
ContainerObject.appendArray
train
public function appendArray(array $arrayData) { foreach ($arrayData as $dataKey => $data) { $this->_putData($dataKey, $data); } if ($this->_objectCreation) { return $this->_afterAppendDataToNewObject(); } return $this; }
php
{ "resource": "" }
q238344
ContainerObject.appendData
train
public function appendData($key, $data) { $this->_putData($key, $data); if ($this->_objectCreation) { return $this->_afterAppendDataToNewObject(); } return $this; }
php
{ "resource": "" }
q238345
ContainerObject.appendStdClass
train
public function appendStdClass(stdClass $class) { $this->appendArray(get_object_vars($class)); if ($this->_objectCreation) { return $this->_afterAppendDataToNewObject(); } return $this; }
php
{ "resource": "" }
q238346
ContainerObject.appendSerialized
train
public function appendSerialized($data) { try { $data = Serializer::unserialize($data); } catch (ExceptionInterface $exception) { $this->_addException($exception); } if (is_object($data)) { $name = $this->_convertKeyNames(get_class($data)); ...
php
{ "resource": "" }
q238347
ContainerObject.appendIni
train
public function appendIni($data) { $array = parse_ini_string($data, $this->_processIniSection, INI_SCANNER_RAW); if ($array === false) { $this->_hasErrors = true; $this->_errorsList[] = 'parse_ini_string'; return $this; } $this->appendArray($arra...
php
{ "resource": "" }
q238348
ContainerObject.toIni
train
public function toIni() { $ini = ''; foreach ($this->toArray() as $key => $iniRow) { $this->_appendIniData($ini, $key, $iniRow); } return $ini; }
php
{ "resource": "" }
q238349
ContainerObject._appendIniData
train
protected function _appendIniData(&$ini, $key, $iniRow) { if ($this->_processIniSection && is_array($iniRow)) { $ini .= '[' . $key . ']' . "\n"; foreach ($iniRow as $rowKey => $rowData) { $ini .= $rowKey . ' = ' . $rowData . "\n"; } } else { ...
php
{ "resource": "" }
q238350
ContainerObject.appendCsv
train
public function appendCsv($data) { $counter = 0; $rows = str_getcsv($data, $this->_csvLineDelimiter); foreach ($rows as $row) { $rowData = str_getcsv( $row, $this->_csvDelimiter, $this->_csvEnclosure, $this...
php
{ "resource": "" }
q238351
ContainerObject.toCsv
train
public function toCsv() { $csv = ''; foreach ($this->toArray() as $csvRow) { if (is_array($csvRow)) { $data = implode($this->_csvDelimiter, $csvRow); } else { $data = $csvRow; } $csv .= $data . $this->_csvLineDelimiter...
php
{ "resource": "" }
q238352
ContainerObject._putData
train
protected function _putData($key, $data) { $bool = $this->_validateDataKey($key, $data); if (!$bool) { return $this; } $hasData = $this->has($key); if ($this->_setPreparationOn) { $data = $this->_dataPreparation( $key, ...
php
{ "resource": "" }
q238353
ContainerObject._validateDataKey
train
protected function _validateDataKey($key, $data) { $dataOkFlag = true; if (!$this->_validationOn) { return $dataOkFlag; } foreach ($this->_validationRules as $ruleKey => $ruleValue) { if (!preg_match($ruleKey, $key)) { continue; }...
php
{ "resource": "" }
q238354
ContainerObject._arrayToXml
train
protected function _arrayToXml($data, Xml $xml, $addCdata, $parent) { foreach ($data as $key => $value) { $key = str_replace(' ', '_', $key); $attributes = []; $data = ''; if (is_object($value)) { try { $data =...
php
{ "resource": "" }
q238355
ContainerObject._convertArrayDataToXml
train
protected function _convertArrayDataToXml( $value, $addCdata, Xml $xml, $key, $parent, array $attributes ) { $count = count($value) === 1; $isNotEmpty = !empty($attributes); $exist = array_key_exists(0, $value); if ($count &&...
php
{ "resource": "" }
q238356
ContainerObject._appendDataToNode
train
protected function _appendDataToNode($addCdata, Xml $xml, $key, $value) { if ($addCdata) { $cdata = $xml->createCDATASection($value); $element = $xml->createElement( $this->_integerToStringKey($key) ); $element->appendChild($cdata); ...
php
{ "resource": "" }
q238357
ContainerObject._genericPut
train
protected function _genericPut($key, $value, $type) { $listName = $this->_getCorrectList($type); if (is_array($key)) { $this->$listName = array_merge($this->$listName, $key); } else { $list = &$this->$listName; $list[$key] = $value; } ...
php
{ "resource": "" }
q238358
ContainerObject._genericDestroy
train
protected function _genericDestroy($key, $type) { $listName = $this->_getCorrectList($type); if ($key) { $list = &$this->$listName; unset ($list[$key]); } $this->$listName = []; return $this; }
php
{ "resource": "" }
q238359
ContainerObject._genericReturn
train
protected function _genericReturn($key, $type) { $listName = $this->_getCorrectList($type); switch (true) { case !$key: return $this->$listName; case array_key_exists($key, $this->$listName): $list = &$this->$listName; return ...
php
{ "resource": "" }
q238360
ContainerObject._dataPreparation
train
protected function _dataPreparation($key, $data, array $rulesList) { foreach ($rulesList as $ruleKey => $function) { switch (true) { case is_null($key): $data = $this->_prepareWholeData($ruleKey, $data, $function); break; ...
php
{ "resource": "" }
q238361
ContainerObject._prepareWholeData
train
protected function _prepareWholeData($ruleKey, array $data, $function) { foreach ($data as $key => $value) { if (preg_match($ruleKey, $key)) { $data[$key] = $this->_callUserFunction($function, $key, $value, null); } } return $data; }
php
{ "resource": "" }
q238362
ContainerObject.offsetSet
train
public function offsetSet($offset, $value) { if (is_null($offset)) { $offset = $this->_integerToStringKey($this->_integerKeysCounter++); } $this->_putData($offset, $value); return $this; }
php
{ "resource": "" }
q238363
ContainerObject._addException
train
protected function _addException(Exception $exception) { $this->_hasErrors = true; $this->_errorsList[$exception->getCode()] = [ 'message' => $exception->getMessage(), 'line' => $exception->getLine(), 'file' => $exception->getFile(), 'trace...
php
{ "resource": "" }
q238364
Controller.setTemplateFile
train
function setTemplateFile($file){ $this->_template->setTemplateFile(ROOT . DS . 'application' . DS . 'views' . DS . $file); }
php
{ "resource": "" }
q238365
ConfigTrait.getConfig
train
protected function getConfig($key = null) { if ($this->config === null) { $this->setConfig(); } if (null === $key) { return $this->config; } if (!array_key_exists($key, $this->config)) { throw new InvalidArgumentException("key: '" . $key ...
php
{ "resource": "" }
q238366
iauAper13.Aper13
train
public static function Aper13($ut11, $ut12, iauASTROM &$astrom) { IAU::Aper(IAU::Era00($ut11, $ut12), $astrom); /* Finished. */ }
php
{ "resource": "" }
q238367
Router.autoResolve
train
private static function autoResolve($arsUrlValueList) { $sController = 'Index'; $sAction = 'index'; $arsParamList = array(); foreach ($arsUrlValueList as $nIndexValue => $sUrlValue) { if ($nIndexValue == 0) { $sController = $sUrlValue; } elseif...
php
{ "resource": "" }
q238368
Router.checkRoute
train
private static function checkRoute($arcUrlSeparator, $arsUrlValue) { $aroRouteList = RouteCollection::getAll(); if (empty($aroRouteList)) { return false; } foreach ($aroRouteList as $oRoute) { // Get route $sRoute = $oRoute->getRoute(); ...
php
{ "resource": "" }
q238369
Router.checkController
train
private static function checkController() { $bSetFallback = false; $sControllerNamespace = Configuration::read('application.namespace') . '\Controller\\' . self::getController(); if (class_exists($sControllerNamespace) === false) { $bSetFallback = true; } if (meth...
php
{ "resource": "" }
q238370
Router.listSeparator
train
private static function listSeparator($sUrl) { $armSeparatorPosition = array(); foreach (RouteCollection::getSeparator() as $cSeparator) { $sUrlSearch = $sUrl; while ($nSeparatorPosition = strrpos($sUrlSearch, $cSeparator)) { $armSeparatorPosition[$nSeparatorP...
php
{ "resource": "" }
q238371
Router.listValue
train
private static function listValue($sUrl) { $sRegexSeparator = implode('', RouteCollection::getSeparator()); $sRegexSeparator = preg_quote($sRegexSeparator); $arsListValue = preg_split("{[" . $sRegexSeparator . "]}", $sUrl); array_shift($arsListValue); return $arsListValue; ...
php
{ "resource": "" }
q238372
Router.removeLastSeparator
train
private static function removeLastSeparator($sUrl) { $cLastChar = substr($sUrl, -1); if (in_array($cLastChar, RouteCollection::getSeparator())) { $sUrl = substr($sUrl, 0, -1); } return $sUrl; }
php
{ "resource": "" }
q238373
Router.resolve
train
public static function resolve() { // Get current URL $oRequest = new Request(); $sUrl = $oRequest->url(); // Set default separator if (Configuration::check('routing.default_separator') === true) { $cDefaultSeparator = Configuration::read('routing.default_separato...
php
{ "resource": "" }
q238374
RoutesInfo.showRoutes
train
public static function showRoutes($moduleUid = '', $app = null, $echo = false) { if (empty($app)) { $app = Yii::$app; } $urlMan = $app->urlManager; $result = ''; foreach ($urlMan->rules as $rule) { if (empty($moduleUid)) { $result .= st...
php
{ "resource": "" }
q238375
RoutesInfo.showRoute
train
public static function showRoute($rule, $echo = false, $showPattern = false) { $result = ''; switch ($rule::className()) { case WebUrlRule::className(): $result .= '' . "'" . htmlspecialchars($rule->name) . "'" . ($showPattern ? " (" ...
php
{ "resource": "" }
q238376
MWebfile.marshall
train
public function marshall($usePreamble = true) { $out = ""; $attributes = $this->getAttributes(); if ($usePreamble) { $out .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; } $out .= "<object classname=\"" . static::$m__sClassName . "\">\n"; foreac...
php
{ "resource": "" }
q238377
MWebfile.getAttributes
train
public static function getAttributes($onlyAttributesOfSimpleDatatypes = false) { $oSelfReflection = new \ReflectionClass(static::$m__sClassName); $oPropertyArray = $oSelfReflection->getProperties( \ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED | ...
php
{ "resource": "" }
q238378
MWebfile.getClassInformation
train
public static function getClassInformation() { $returnValue = "<classinformation>\n"; $returnValue .= "\t<author>simpleserv.de</author>\n"; $returnValue .= "\t<classname>" . static::$m__sClassName . "</classname>\n"; $returnValue .= "\t<attributes>\n"; $attributes =...
php
{ "resource": "" }
q238379
MWebfile.getDataset
train
public function getDataset() { $dataset = array(); $attributes = $this->getAttributes(); foreach ($attributes as $attribute) { $attributeName = $attribute->getName(); $attribute->setAccessible(true); $attributeValue = $attribute->getValue($thi...
php
{ "resource": "" }
q238380
Session.set
train
public function set(string $variableName = null, $variableValue = null): Session { if ($variableName === null) { throw new BadMethodCallException('Variable name must be specified'); } if ($variableName === '_MFREG_') { throw new InvalidArgumentException('_MFREG_ varia...
php
{ "resource": "" }
q238381
Configuration.setConfiguration
train
public static function setConfiguration($config) { if(!is_array($config)) throw new ConfigurationException('Configuration needs to be an array'); if(array_key_exists('primaryGSLSNode')) self::$primaryGSLSNode = $config['primaryGSLSNode']; if(array_key_exists('secondaryGSLSNode')) self::$secondaryGSLSNode =...
php
{ "resource": "" }
q238382
ArrayExtractionHelper.ExtractDistinctValues
train
public function ExtractDistinctValues($array) { foreach ($array as $key => $value) { $valueIsArray = is_array($value); $valueIsAlreadyExtracted = in_array($value, $this->List); $keyIsExtracted = in_array($key, $this->List); if (!$valueIsArray && !$valueIsAlreadyEx...
php
{ "resource": "" }
q238383
Base.run
train
public function run() { $config = $this->config; try { $this->getFluent()->getPdo()->beginTransaction(); $this->tree->getFluent()->getPdo()->exec("LOCK TABLES $config[table] WRITE;"); $return = $this->doRun(); $this->getFluent()->getPdo()->commit(); ...
php
{ "resource": "" }
q238384
Base.getNodesBetween
train
protected function getNodesBetween($min, $max) { $config = $this->config; $query = $this->tree->table() ->select(NULL)// fetch only id ->select("$config[id] AS id") ->where("($config[lft] >= :min AND $config[lft] <= :max) OR ($config[rgt] >= :min AND $...
php
{ "resource": "" }
q238385
Base.updateDepths
train
protected function updateDepths($nodes, $value) { $config = $this->config; $this->getFluent() ->update($config['table']) ->set($config['dpt'], new FluentLiteral("$config[dpt] + $value")) ->where($config['id'], $nodes) ->execute(); }
php
{ "resource": "" }
q238386
Base.updateNodeParent
train
protected function updateNodeParent($nodeId, $parent) { $config = $this->config; $this->getFluent() ->update($config['table']) ->set($config['prt'], $parent) ->where($config['id'], $nodeId) ->execute(); }
php
{ "resource": "" }
q238387
Pagination.paging
train
public function paging($records, $pageURL, $start = 0, $maxshown = 50, $numpagesshown = 11, $arrows = true, $additional = array()) { self::$pageURL = $pageURL; $this->queryString = $additional; if ($records > $maxshown) { self::$current = $start >= 1 ? intval($start) : 1; ...
php
{ "resource": "" }
q238388
Pagination.buildLink
train
protected function buildLink($link, $page, $current = false) { return '<li'.(!empty($this->getLiClass()) || ($current === true && !empty($this->getLiActiveClass())) ? ' class="'.trim($this->getLiClass().(($current === true && !empty($this->getLiActiveClass())) ? ' '.$this->getLiActiveClass() : '').'"') : '').'>...
php
{ "resource": "" }
q238389
Pagination.buildQueryString
train
protected function buildQueryString($page) { $pageInfo = is_numeric($page) ? ['page' => $page] : []; return http_build_query(array_filter(array_merge($pageInfo, $this->queryString)), '', '&amp;'); }
php
{ "resource": "" }
q238390
Pagination.getPage
train
protected function getPage($records, $maxshown, $numpages) { $show = floor($numpages / 2); if (self::$lastpage > $numpages) { self::$page = (self::$current > $show ? (self::$current - $show) : 1); if (self::$current < (self::$lastpage - $show)) { self::$lastpage =...
php
{ "resource": "" }
q238391
Pagination.preLinks
train
protected function preLinks($arrows = true) { $paging = ''; if (self::$current != 1 && $arrows) { if (self::$current != 2) { $paging .= $this->buildLink('', '&laquo;'); } $paging .= $this->buildLink((self::$current - 1), '&lt;'); } return $paging; }
php
{ "resource": "" }
q238392
Pagination.postLinks
train
protected function postLinks($arrows = true) { $paging = ''; if (self::$current != self::$totalPages && $arrows) { $paging .= $this->buildLink((self::$current + 1), '&gt;'); if (self::$current != (self::$totalPages - 1)) { $paging .= $this->buildLink(self::$totalPages, '&raquo;')...
php
{ "resource": "" }
q238393
SkeDate.events
train
public function events(int $iMemberId = null, bool $bPublicEvents = false) { $aReturn = []; $this->oModel->forMember($iMemberId)->public($bPublicEvents); foreach ($this->oModel->fetch($this->strDate) as $aEvent) $aReturn[] = new SkeVent($aEvent); return $aReturn; }
php
{ "resource": "" }
q238394
Config_File.find_file
train
protected function find_file($cache = true) { if (($this->file[0] === '/' or (isset($this->file[1]) and $this->file[1] === ':')) and is_file($this->file)) { $paths = array($this->file); } else { $paths = array_merge( \Finder::search('config/'.\Fuel::$env, $this->file, $this->ext, true, $cache), ...
php
{ "resource": "" }
q238395
Redirect.toRoute
train
public function toRoute($name, array $params = []) { $url = $this->getUrl()->fromRoute($name, $params); return $this->toUrl($url); }
php
{ "resource": "" }
q238396
Redirect.toUrl
train
public function toUrl($url, $statusCode = 302) { $server = $this->getServer(); $response = $server->getResponse(false) ->withHeader('Location', $url) ->withStatus($statusCode); return $response; }
php
{ "resource": "" }
q238397
Dispatcher.checkNavigator
train
public function checkNavigator() { // can we find th' darned controller? if (!$this->checkControllerExists()) { $this->setNotFound(); return; } // merge the feckin params if (array_key_exists('params', $this->config) && is_array($this->config['params'...
php
{ "resource": "" }
q238398
Dispatcher.setNotFound
train
private function setNotFound() { $this->config['controller_name'] = class_exists('\App\Controller\ErrorController') ? '\App\Controller\ErrorController' : '\Bone\Mvc\Controller'; $this->config['action_name'] = 'notFoundAction'; $this->config['controller'] = 'error'; $this->config['act...
php
{ "resource": "" }
q238399
DataCollection.get
train
public function get($key, $default = null) { if (isset($this->contents[$key])) { return $this->contents[$key]; } return $default; }
php
{ "resource": "" }