_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q237300
ARepository.setLimit
train
public function setLimit($limit) { if (!isset($this->_persistence) || !($this->_persistence instanceof IPersistance)) { throw new Exception("Repository Exception : No existe la interfaz de la persistencia o no implementa la interfaz IPersistance."); } $this->_persistence->setLim...
php
{ "resource": "" }
q237301
PageDataManager.setPage
train
public function setPage(PageDataModel $pageModel) { $pageModel ->setModified(new \DateTime()) ->setEntityManager($this) ->save(); return true; }
php
{ "resource": "" }
q237302
PageDataManager.getPage
train
public function getPage($stub) { $this->logger->addNotice(print_r($this->cfg->getAll(), 1)); $stmtManager = $this->getStatementManager(Simple::class); /** @var Select $stmtBuilder */ $stmtBuilder = $stmtManager->getStatementBuilder(Select::class); /** @var PageCollection $...
php
{ "resource": "" }
q237303
PageDataManager.getPages
train
public function getPages(ECParams $params) { $stmtManager = $this->getStatementManager(Simple::class); /** @var Select $stmtBuilder */ $stmtBuilder = $stmtManager->getStatementBuilder(Select::class); /** @var PageCollection $collection */ $collection = $stmtManager->setStat...
php
{ "resource": "" }
q237304
Coverage.output
train
public function output() { $data = [ 'classes' => [], 'files' => [], ]; foreach ($this->processed as $type => $classes) { foreach ($classes as $name => $values) { $covered = $values['covered']; $total = $values['total'];...
php
{ "resource": "" }
q237305
Coverage.isCovered
train
private function isCovered($file) { return in_array($file, $this->includedFiles) && !in_array($file, $this->excludedFiles) && isset($this->covered[$file]); }
php
{ "resource": "" }
q237306
Coverage.processRawData
train
private function processRawData() { // Get the raw data from Xdebug $data = xdebug_get_code_coverage(); // Create an array for storing processed coverage data $processed = [ 'classes' => [], 'files' => [], ]; // Loop through each of the fil...
php
{ "resource": "" }
q237307
UOID.createUOID
train
public static function createUOID($gid = NULL, $id = NULL) { if($gid == NULL) $gid = Sonic::getContextGlobalID(); if($id == NULL) $id = Random::getUniqueRandom(); $uoid = $gid . UOID::SEPARATOR . $id; return $uoid; }
php
{ "resource": "" }
q237308
UOID.isValid
train
public static function isValid($uoid) { $uoid = explode(UOID::SEPARATOR, $uoid); if(count($uoid) != 2) return false; // check GID if(!GID::isValid($uoid[0])) return false; // check id if(!preg_match("/^[a-zA-Z0-9]+$/", $uoid[1]) || strlen($uoid[1]) != 16) { return false; ...
php
{ "resource": "" }
q237309
ArticleListForm.AddArticlePageSelector
train
private function AddArticlePageSelector() { $name = 'ArticlePage'; $this->articlePageSelector = new PageSelector($name, Trans($this->Label($name)), $this->articleList->GetArticlePage()); $this->articlePageSelector->SetSite($this->Page()->GetSite()); $this->E...
php
{ "resource": "" }
q237310
ArticleListForm.SaveElement
train
protected function SaveElement() { $this->articleList->SetArticlePage($this->articlePageSelector->GetPage()); $archiveCat = explode('-', $this->Value('ArchiveCategory')); $this->CleanPageArticleLists(); if (count($archiveCat) == 1) { $this->SaveArchivePage($archiveCat[0])...
php
{ "resource": "" }
q237311
ArticleListForm.SaveArchivePage
train
private function SaveArchivePage($archiveID) { $archive = Archive::Schema()->ByID($archiveID); if ($archive) { $archive->SetPage($this->Page()); $archive->Save(); } }
php
{ "resource": "" }
q237312
ArticleListForm.SaveCategoryPage
train
private function SaveCategoryPage($categoryID) { $category = Category::Schema()->ByID($categoryID); if ($category) { $category->SetPage($this->Page()); $category->Save(); } }
php
{ "resource": "" }
q237313
HasManyEmbedded.inProperty
train
public static function inProperty( string $name, DeserializesCollections $collection, Deserializes $item, string $key = 'key' ): MapsProperty { return new self($name, $collection, $item, $key); }
php
{ "resource": "" }
q237314
Application._configure
train
protected function _configure() { // Create my settings object $this->config = new Core\Configuration(); // Define some paths define("CHICKENWIRE_PATH", dirname(__FILE__)); define("APP_PATH", APP_ROOT . "/Application"); define("CONFIG_PATH", APP_PATH . "/Config"); define("CONTROLLER_PATH", APP...
php
{ "resource": "" }
q237315
Application._loadModules
train
protected function _loadModules() { // Check module directories $dh = opendir(MODULE_PATH); while (false !== ($filename = readdir($dh))) { // Directory? if (is_dir(MODULE_PATH . "/" . $filename) && !preg_match('/^\./', $filename)) { // Load the module Module::load($filename); } ...
php
{ "resource": "" }
q237316
ArrayTrait.set
train
public function set($path = null, $value = null) { if ($path === null) { $this->data = $value; return $this; } $at =& $this->data; $keys = explode(".", $path); $keyCount = count($keys); for ($i=0; $i < $keyCount; $i++) { if (($ke...
php
{ "resource": "" }
q237317
ArrayTrait.get
train
public function get($key = null, $default = null) { $return = $this->data; if ($key !== null) { $keys = explode('.', $key); foreach ($keys as $key) { if (isset($return[(string) $key])) { $return = $return[$key]; } else { $return = $default; break; } } } return $return; }
php
{ "resource": "" }
q237318
Maker.makePhar
train
protected function makePhar() { $phar = new Phar($this->filePhar, 0, $this->alias); $phar->setSignatureAlgorithm(\Phar::SHA1); $phar->startBuffering(); // Adicionar arquivos $this->addFiles($phar); // Adicionar arquivo bin $this->addBinFile($phar); ...
php
{ "resource": "" }
q237319
Maker.makeBat
train
protected function makeBat() { $content = $this->files->get(__DIR__ . '/../stubs/bat.stub'); $content = str_replace('DubbyAlias', $this->alias, $content); $this->files->put($this->fileBat, $content); }
php
{ "resource": "" }
q237320
Maker.resetPhar
train
protected function resetPhar() { if ($this->files->exists($this->filePhar)) { $this->files->delete($this->filePhar); } if ($this->files->exists($this->fileBat)) { $this->files->delete($this->fileBat); } }
php
{ "resource": "" }
q237321
Maker.setName
train
public function setName($name) { $this->name = $name; $this->alias = $name . '.phar'; $this->filePhar = $this->files->combine($this->pathBase, $this->alias); $this->fileBat = $this->files->combine($this->pathBase, $name . '.bat'); }
php
{ "resource": "" }
q237322
Maker.addFiles
train
public function addFiles(Phar $phar) { $finder = new Finder(); $finder->files() ->ignoreVCS(true) ->name('*.php') ->name('*.stub') ->exclude('Tests') ->exclude('tests') ->exclude('/storage') ->exclude('/config') ...
php
{ "resource": "" }
q237323
Maker.addFile
train
private function addFile(Phar $phar, SplFileInfo $file, $strip = false) { // Forçar tirar espaços de PHP. $strip = ($file->getExtension() == 'php') ? true : $strip; $this->fireEvent($file->getRealPath()); $path = str_replace($this->pathBase, '', $file->getRealPath()); $cont...
php
{ "resource": "" }
q237324
Maker.addBinFile
train
protected function addBinFile(Phar $phar) { $fileBin = $this->files->combine($this->pathBase, $this->fileNameBin); if (! $this->files->exists($fileBin)) { return; } $this->fireEvent('BIN: file main'); $content = $this->files->get($fileBin); $content = pr...
php
{ "resource": "" }
q237325
Maker.addStub
train
protected function addStub(Phar $phar) { $this->fireEvent('STUB'); // Add warning once the phar is older than 30 days $defineTime = ''; if (array_key_exists('package_version', $this->params)) { $warningTime = time() + 30 * 86400; $defineTime = "define('PHAR_D...
php
{ "resource": "" }
q237326
Maker.addLicence
train
protected function addLicence(Phar $phar) { $file = $this->files->combine($this->pathBase, 'LICENSE'); if (! $this->files->exists($file)) { return; } $this->fireEvent('LICENCE'); $this->addFile($phar, new SplFileInfo($file), false); }
php
{ "resource": "" }
q237327
Maker.addUpdateFile
train
protected function addUpdateFile(Phar $phar) { $file = $this->files->combine($this->pathBase, 'update.json'); if ($this->files->exists($file)) { $this->addFile($phar, new SplFileInfo($file), false); } }
php
{ "resource": "" }
q237328
Maker.stripWhitespace
train
private function stripWhitespace($source) { // Verificar se token_get_all existe if (! function_exists('token_get_all')) { return $source; } $output = ''; foreach (token_get_all($source) as $token) { if (is_string($token)) { $output .=...
php
{ "resource": "" }
q237329
FiltersTable.findFilterDataBySlug
train
public function findFilterDataBySlug(Query $query, array $options) { if (!isset($options['request']) || get_class($options['request']) !== ServerRequest::class) { user_error('The request query option must exist and must be of type Cake\Http\ServerRequest.'); } $encryptedFilterDa...
php
{ "resource": "" }
q237330
FiltersTable.createFilterForFilterData
train
public function createFilterForFilterData(ServerRequest $request, array $filterData) { $charlist = 'abcdefghikmnopqrstuvwxyz'; do { $slug = ''; for ($i = 0; $i < 14; $i++) { $slug .= substr($charlist, rand(0, 31), 1); } } while ($this->_sl...
php
{ "resource": "" }
q237331
FiltersTable._pluginCondition
train
protected function _pluginCondition(ServerRequest $request) { if ($request->getParam('plugin') !== null) { return [$this->getAlias() . '.plugin' => $request->getParam('plugin')]; } return [$this->getAlias() . '.plugin IS NULL']; }
php
{ "resource": "" }
q237332
FiltersTable._slugExists
train
protected function _slugExists($slug, ServerRequest $request) { $existingSlug = $this->find('all') ->select($this->getAlias() . '.slug') ->where([ $this->getAlias() . '.slug' => $slug, $this->getAlias() . '.controller' => $request->getParam('controller...
php
{ "resource": "" }
q237333
FiltersTable._findEncryptedFilterData
train
protected function _findEncryptedFilterData(Query $query, ServerRequest $request) { return $query ->select($this->getAlias() . '.filter_data') ->where([ $this->getAlias() . '.controller' => $request->getParam('controller'), $this->getAlias() . '.action...
php
{ "resource": "" }
q237334
HttpRequest.determineMethod
train
private function determineMethod(array $server): string { $mapping = [ 'GET' => self::METHOD_GET, 'POST' => self::METHOD_POST, 'PUT' => self::METHOD_PUT, 'PATCH' => self::METHOD_PATCH, 'DELETE' => self::METHOD_DELETE, 'HEAD' => self::ME...
php
{ "resource": "" }
q237335
HttpRequest.determineHeader
train
private function determineHeader(array $server): MapInterface { $header = new Map(); foreach ($server as $name => $value) { if (strpos($name, 'HTTP_') === 0) { $name = substr($name, 5); $name = explode('_', $name); $name = array_map('strto...
php
{ "resource": "" }
q237336
HttpRequest.determinePath
train
private function determinePath(array $server): string { $path = ''; if (strpos($server['SCRIPT_NAME'], 'index.php') !== false) { $path = str_replace('index.php', '', $server['SCRIPT_NAME']); } $parts = explode('?', $server['REQUEST_URI']); $length = 0; i...
php
{ "resource": "" }
q237337
HttpRequest.determineRemoteIpAddress
train
private function determineRemoteIpAddress(array $server): string { if (array_key_exists('HTTP_X_FORWARDED_FOR', $server) && filter_var($server['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP)) { return $server['HTTP_X_FORWARDED_FOR']; } elseif (array_key_exists('HTTP_CLIENT_IP', $server) && ...
php
{ "resource": "" }
q237338
HttpRequest.narrowArray
train
private function narrowArray(array $array, string $key = null) { if ($key) { $key .= '--'; } $result = []; foreach ($array as $index => $value) { if (is_array($value)) { $result = array_merge($result, $this->narrowArray($value, $key . $index)...
php
{ "resource": "" }
q237339
ModuleController.Index
train
public function Index($Module, $AppFolder = '', $DeliveryType = '') { if (!$DeliveryType) $this->DeliveryType(DELIVERY_TYPE_VIEW); $ModuleClassExists = class_exists($Module); if ($ModuleClassExists) { // Make sure that the class implements Gdn_IModule $ReflectionClas...
php
{ "resource": "" }
q237340
PatternResolver.replace
train
public function replace($patternName, Siteroot $siteroot, ElementVersion $elementVersion, $language) { if (!isset($this->patterns[$patternName])) { $pattern = '%p'; } else { $pattern = $this->patterns[$patternName]; } return $this->replacePattern($pattern, $s...
php
{ "resource": "" }
q237341
PatternResolver.replacePattern
train
public function replacePattern($pattern, Siteroot $siteroot, ElementVersion $elementVersion, $language) { $replace = [ '%s' => $siteroot->getTitle(), '%b' => $elementVersion->getBackendTitle($language), '%p' => $elementVersion->getPageTitle($language), '%n' =>...
php
{ "resource": "" }
q237342
AddAliasHandler.handle
train
public function handle(Client $client, $index, $alias, $replace = false) { $client ->getIndex($index) ->addAlias($alias, $replace) ; }
php
{ "resource": "" }
q237343
NavigationController.getModuleSortCallback
train
private function getModuleSortCallback() { return function (ModuleInterface $left, ModuleInterface $right) { return strcmp($left->getName(), $right->getName()); }; }
php
{ "resource": "" }
q237344
Form.validate
train
protected function validate() { $this->isValid = true; foreach ($this->getWritableBearer()->getWritables() as $name => $writable) { if ($writable instanceof FieldInterface) { $writable->validate(); } } foreach ($this->getWritableBearer()->get...
php
{ "resource": "" }
q237345
League.create
train
public static function create(array $data): League { $league = new League(); parent::fill($data, $league); return $league; }
php
{ "resource": "" }
q237346
MySQL_DBWorker.field_count
train
public function field_count() { if ($this->statement) { return $this->statement->field_count; } if (!$this->mysqli_result) { return false; } return $this->mysqli_result->field_count; }
php
{ "resource": "" }
q237347
PermissionsDataSourceDoctrine.hasPermissionForId
train
public function hasPermissionForId($id) { try { $em = $this->entityManager->getDoctrineEntityManager(); $permission = $em->getRepository('\\Zepi\\Core\\AccessControl\\Entity\\Permission')->find($id); if ($permission !== null) { return true; ...
php
{ "resource": "" }
q237348
PermissionsDataSourceDoctrine.hasAccess
train
public function hasAccess($accessEntityUuid, $accessLevel) { // Do not check the database if we haven't all data if ($accessEntityUuid == '' || $accessLevel == '') { return false; } try { $queryBuilder = $this->entityManager->getQueryBuilder(); ...
php
{ "resource": "" }
q237349
PermissionsDataSourceDoctrine.getPermissionsRawForUuid
train
public function getPermissionsRawForUuid($accessEntityUuid) { // Do not check the database if we haven't all data if ($accessEntityUuid == '') { return array(); } try { $em = $this->entityManager->getDoctrineEntityManager(); $permissions = $em...
php
{ "resource": "" }
q237350
PermissionsDataSourceDoctrine.getPermissionsForUuid
train
public function getPermissionsForUuid($accessEntityUuid) { // Do not check the database if we haven't all data if ($accessEntityUuid == '') { return array(); } try { $accessLevels = $this->getPermissionsRawForUuid($accessEntityUuid); $acc...
php
{ "resource": "" }
q237351
PermissionsDataSourceDoctrine.revokePermissions
train
public function revokePermissions($accessLevel) { // Do not revoke the permissions if we haven't all data if ($accessLevel == '') { return false; } try { $em = $this->entityManager->getDoctrineEntityManager(); $permissions = $em->getRepository...
php
{ "resource": "" }
q237352
CollectivePresenter.prepare
train
protected function prepare() { $active = app('antares.memory')->get("extensions.active"); $memory = app('antares.memory')->make('tests'); $tests = $memory->all(); $return = []; foreach ($tests as $index => $data) { if (!isset($data['executor'])) { ...
php
{ "resource": "" }
q237353
Message.removeHeader
train
protected function removeHeader($name) { if (! $this->hasHeader($name)) { return false; } $value = $this->getHeader($name); unset($this->headers[$name]); return $value; }
php
{ "resource": "" }
q237354
Router.add
train
public function add($query, $resource, array $meta = []) { $query = static::clean($query); list($method, $uri) = explode(' ', $query); $this->routes[$query] = new Route($method, $uri, $resource, $meta); return $this; }
php
{ "resource": "" }
q237355
Router.parse
train
public function parse($class, array $meta = []) { $methods = get_class_methods($class); foreach($methods as $method) { $query = Annotation::ofMethod($class, $method, 'uri'); if($query) { $this->add($query, [$class, $method], $meta); } } ...
php
{ "resource": "" }
q237356
Router.mount
train
public function mount($prefix, RouterInterface $router, array $meta = []) { $prefix = '/' . trim($prefix, '/'); foreach($router->routes() as $route) { $route->uri = $prefix . $route->uri; $route->meta = array_merge($route->meta, $meta); $query = static::clean($rou...
php
{ "resource": "" }
q237357
Router.reverse
train
public function reverse($resource, array $params = []) { // search in all routes if($key = array_search($resource, $this->routes)) { $route = $this->routes[$key]; $route->params = $params; return $route; } }
php
{ "resource": "" }
q237358
Translate.textDomain
train
public function textDomain( $textDomain = self::DEFAULT_TEXT_DOMAIN, $locale = null ) { $translator = $this->getTranslator(); $locale = $locale ?: $translator->getLocale(); if ( ! isset( $translator->myMessages[$textDomain][$locale] ) ) { ...
php
{ "resource": "" }
q237359
Ldap.searchAll
train
public function searchAll($filter, array $attributes = []) { $ldap = $this->getResource(); // $ds is a valid link identifier (see ldap_connect) ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); $cookie = ''; $result = []; do { ldap_control_paged_result($ldap, self::PAGE_SIZE, true, $cookie); S...
php
{ "resource": "" }
q237360
ErrorCollectionObjectNormalizer.appendCollectionAttributes
train
public function appendCollectionAttributes( array $data, ErrorCollection $error, string $format, array $context ): array { $innerError = new ErrorResource( $error->getMessage(), $error->getReason(), $error->getPath(), $error->ge...
php
{ "resource": "" }
q237361
SingletonEvent.addSingleton
train
public function addSingleton( string $name, $singleton ): self { $name = Str::studly($name); if( isset($this->ci[$name]) ) { throw new \InvalidArgumentException("Duplicated class name '{$name}' for singleton instance object"); } $this->ci[$name] = $singleton; return $this; }
php
{ "resource": "" }
q237362
Uri.get
train
public function get(bool $isRawUrl = false): string { if ($this->sourceChanged) { return $this->getAbsolute($isRawUrl); } return $this->getRelative($isRawUrl); }
php
{ "resource": "" }
q237363
Xml.getConfigurationSources
train
public function getConfigurationSources(ConfigInterface $conf) { if ($conf->hasOption('config-file')) { $file = $conf->getOption('config-file'); if (isset($file)) { if (!strstr($file, '/')) { $file = $conf->getOption('config-dir').$file; ...
php
{ "resource": "" }
q237364
Process.triggerEvent
train
public function triggerEvent($event, Payload $payload): string { return $this->state($payload->state())->triggerEvent($event, $payload); }
php
{ "resource": "" }
q237365
Tag.setAttribute
train
public function setAttribute($key, $value) { $key = strtolower($key); if ( ! is_array($value)) { $value = [ 'value' => $value, 'doubleQuote' => true, ]; } $this->attr[$key] = $value; return $this; }
php
{ "resource": "" }
q237366
Tag.getAttribute
train
public function getAttribute($key) { if ( ! isset($this->attr[$key])) { return null; } $value = $this->attr[$key]['value']; if (is_string($value) && ! is_null($this->encode)) { // convert charset $this->attr[$key]['value'] = $this->encode->convert(...
php
{ "resource": "" }
q237367
AbstractConfig.setDefaults
train
private static function setDefaults() { if (!self::$defaults) { self::$defaults = [self::CFG_CSS_PATH => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'error.min.css...
php
{ "resource": "" }
q237368
Article.mountById
train
function mountById($id) { $db = new Db(); if ($this->where != false || $this->where != '') { $where = ' AND '.$this->where; } $res = $db->query('SELECT * FROM '.$this->table.' WHERE id = :id '.$where, [':id'=>0 + $id]); if (isset($res[0])) { $this->...
php
{ "resource": "" }
q237369
Article.requestNew
train
function requestNew() { $db = new Db; //Search from first register with [article.status] 5 and [article.editdate] <= datetime - 24 hours. $result = $db->query('SELECT MIN(id)id, (SELECT MAX(id+1) FROM article)nid FROM article WHERE...
php
{ "resource": "" }
q237370
Article.getAll
train
function getAll() { foreach ($this as $k => $v) { if ($k == 'table' || $k == 'where') { continue; } $data[$k] = $v; } return $data; }
php
{ "resource": "" }
q237371
Article.save
train
function save() { if ($this->id != false || $this->id != 0) { return $this->update(); } else { return $this->insert(); } }
php
{ "resource": "" }
q237372
Article.clearDir
train
function clearDir() { $dir = _WWW.$this->patch.$this->id.'/'; foreach (scandir($dir) as $file) { if ($file == '.' || $file == '..') { continue; } unlink($dir.$file); } }
php
{ "resource": "" }
q237373
Database_PDO_Connection.driver_name
train
public function driver_name() { // Make sure the database is connected $this->_connection or $this->connect(); // Getting driver name return $this->_connection->getAttribute(\PDO::ATTR_DRIVER_NAME); }
php
{ "resource": "" }
q237374
Database_PDO_Connection.set_charset
train
public function set_charset($charset) { // Make sure the database is connected $this->_connection or $this->connect(); // Set Charset for SQL Server connection if (strtolower($this->driver_name()) == 'sqlsrv') { $this->_connection->setAttribute(\PDO::SQLSRV_ATTR_ENCODING, \PDO::SQLSRV_ENCODING_SYSTEM); ...
php
{ "resource": "" }
q237375
Database_PDO_Connection.escape
train
public function escape($value) { // Make sure the database is connected $this->_connection or $this->connect(); $result = $this->_connection->quote($value); // poor-mans workaround for the fact that not all drivers implement quote() if (empty($result)) { $result = "'".str_replace("'", "''", $value)."'"...
php
{ "resource": "" }
q237376
StylesheetHelper.init
train
public function init(?string $configuration = 'stylesheets'): void { $config = Core::i()->config->getConfiguration($configuration); foreach ($config as $script) { $this->append($script); } }
php
{ "resource": "" }
q237377
StylesheetHelper.prepend
train
public function prepend(): void { $script = $this->parseArgs(func_get_args()); if ($script !== false) { array_unshift($this->members, $script); } }
php
{ "resource": "" }
q237378
StylesheetHelper.append
train
public function append(): void { $script = $this->parseArgs(func_get_args()); if ($script !== false) { array_push($this->members, $script); } }
php
{ "resource": "" }
q237379
StylesheetHelper.makeLink
train
private function makeLink($args) { if (!isset($args['href'])) { Core::i()->log->warning('Unable to add stylesheet, no href attribute.'); return false; } if (!isset($args['rel'])) { $args['rel'] = 'stylesheet'; } if (!isset($args['type']) &&...
php
{ "resource": "" }
q237380
CachingFactory.build
train
public function build($name = null) { $caching = new Caching(); $caching->setStack(new DebugStack()); if ($this->debug && isset($this->debugDriver)) { $caching->setDriver($this->resolveDriver($this->debugDriver)); return $caching; } if (null === $na...
php
{ "resource": "" }
q237381
CachingFactory.resolveDriver
train
protected function resolveDriver($name) { if ( ! isset($this->drivers[$name]) || ! $this->container->has($this->drivers[$name])) { throw new \RuntimeException(sprintf( 'Caching driver "%s" does not exist or is not registered as a service.', $name )); ...
php
{ "resource": "" }
q237382
TensideApiDocHandler.convertField
train
private function convertField($array) { $result = []; // Copy over well known keys. foreach (static::$convertFields as $key) { if (isset($array[$key])) { $result[$key] = $array[$key]; } } if (isset($array['dataType'])) { $...
php
{ "resource": "" }
q237383
TensideApiDocHandler.convertChildren
train
private function convertChildren($array, $result) { if (isset($array['children'])) { foreach ($array['children'] as $key => $value) { $result['children'][$key] = $this->convertField($value); if (isset($result['children'][$key]['required'])) { $...
php
{ "resource": "" }
q237384
TensideApiDocHandler.inferType
train
public function inferType($type) { if (DataTypes::isPrimitive($type)) { return $type; } elseif (DataTypes::COLLECTION === strtolower($type)) { return $type; } return DataTypes::STRING; }
php
{ "resource": "" }
q237385
User.findIdentities
train
public static function findIdentities($ids, $scope = null) { $query = static::find()->where(['id' => $ids]); if ($scope !== null) { if (is_array($scope)) { foreach ($scope as $value) { $query->$value(); } } else { ...
php
{ "resource": "" }
q237386
User.delete
train
public function delete(){ if(!($this->id == 1 && $this->module->cantDeleteRoot == true)){ if ($this->status == self::STATUS_DELETED) { Yii::$app->authManager->revokeAll($this->getId()); parent::delete(); } else { $this->status = self::STATU...
php
{ "resource": "" }
q237387
GeoDataProvider.calculate
train
public function calculate(Calculator $calculator, $inputValuesGrid) { $outputValuesGrid = []; foreach ($inputValuesGrid as $date => $inputValues) { $outputValuesGrid[$date] = $calculator->calculate($this, new \DateTime($date, $this->dataTimeZone), $inputValues); } return ...
php
{ "resource": "" }
q237388
Reflection.getProperties
train
public function getProperties($properties){ $values= array(); foreach ($properties as $key) { $values[$key]= $this->getProperty($key); } return $values; }
php
{ "resource": "" }
q237389
Reflection.setProperties
train
public function setProperties($properties, $create = FALSE){ foreach ($properties as $key => $value) { $this->setProperty($key, $value, $create); } }
php
{ "resource": "" }
q237390
StandardWebIOModule.configureDependencyInjection
train
public function configureDependencyInjection(DependencyInjectionContainer $dic, array $moduleConfig, array $globalConfig) { $dic->alias(InputProcessor::class, StandardInputProcessor::class); $dic->alias(OutputProcessor::class, StandardOutputProcessor::class); $dic->setClassParameters(InputProcessor:...
php
{ "resource": "" }
q237391
ArrayDumper.dump
train
public function dump(array $input, string $outerIndent = ''): string { $this->indentLength = StringHelper::lengthUtf8($this->indent); return $this->dumpArray( $input, $outerIndent, StringHelper::lengthUtf8($outerIndent) ); }
php
{ "resource": "" }
q237392
ArrayDumper.dumpValue
train
protected function dumpValue($value): string { if (null === $value) { return 'null'; } if (false === $value) { return 'false'; } if (true === $value) { return 'true'; } if (\is_int($value) || \is_float($value)) { ...
php
{ "resource": "" }
q237393
ArrayDumper.dumpArray
train
protected function dumpArray(array $input, string $indent, int $outerLineLength): string { if (!$input) { return '[]'; } if ($outerLineLength < $this->lineLength) { $dump = $this->tryDumpList($input, $outerLineLength, 1); if (null !== $dump) { ...
php
{ "resource": "" }
q237394
ArrayDumper.tryDumpList
train
protected function tryDumpList(array $input, int $outerLineLength, int $level): ?string { if ($level > $this->listDepthLimit) { return null; } $dump = '['; $total_length = $outerLineLength + 1; $index = 0; foreach ($input as $key => $value) { ...
php
{ "resource": "" }
q237395
Encoder.encodeSingleResource
train
protected function encodeSingleResource( \FreeFW\Interfaces\ApiResponseInterface $p_api_response ) : \FreeFW\JsonApi\V1\Model\ResourceObject { $resource = new \FreeFW\JsonApi\V1\Model\ResourceObject( $p_api_response->getApiType(), $p_api_response->getApiId() ); ...
php
{ "resource": "" }
q237396
Encoder.encode
train
public function encode( \FreeFW\Interfaces\ApiResponseInterface $p_api_response ) : \FreeFW\JsonApi\V1\Model\Document { $document = new \FreeFW\JsonApi\V1\Model\Document(); if ($p_api_response->hasErrors()) { /** * @var \FreeFW\Core\Error $oneError */ ...
php
{ "resource": "" }
q237397
Migrator.table
train
public function table() { return $this->database ? $this->laravel['db']->connection($this->database)->table(config('database.migrations')) : $this->laravel['db']->table(config('database.migrations')); }
php
{ "resource": "" }
q237398
ReaderManager.get
train
public static function get(string $type): AbstractReader { if (!\array_key_exists($type, static::$invokableClasses)) { throw new InvalidArgumentException('Unsupported config file type: '.$type); } return new static::$invokableClasses[$type]; }
php
{ "resource": "" }
q237399
RepositoryAncestorCriteriaTrait.pushAncestor
train
public function pushAncestor($ancestor) { if (is_string($ancestor)) { $ancestor = new $ancestor; } if (!$ancestor instanceof AncestorCriteriaInterface) { throw new RepositoryException("Class " . get_class($ancestor) . " must be an instance of Aruberuto\\Repository\\Co...
php
{ "resource": "" }