_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q254000 | MediaLink.parse | validation | public static function parse(&$string) {
$media = array(
"objects" => array(), //All @mentions, you can mention anytype of object
"hashes" => array(), //You can use any kind of hashes
"links" => array(), //Will attempt to fetch link descriptions where possible
);
... | php | {
"resource": ""
} |
q254001 | Dispatcher.dispatch | validation | public static function dispatch($eventName, Event $event)
{
if (null === self::$dispatcher) {
return $event;
}
self::$dispatcher->dispatch($eventName, $event);
DataLogger::log(sprintf('The "%s" event was dispatched', $eventName));
if ($event->getAbort()) {
... | php | {
"resource": ""
} |
q254002 | Browser.checkBrowsers | validation | protected function checkBrowsers()
{
return (
// well-known, well-used
// Special Notes:
// (1) Opera must be checked before FireFox due to the odd
// user agents used in some older versions of Opera
// (2) WebTV is strapped onto Internet Explo... | php | {
"resource": ""
} |
q254003 | Cookie.set | validation | public function set($name, $value, $expire = 0, $path = null, $domain = null, $secure = false, $httpOnly = false) {
/*
* La cookie expira al cerrar el navegador por defecto, pero si
* en $expire se pasa un -1 la cookie tendra una duracion de 1 año.
*/
if ($expire === -1) {
... | php | {
"resource": ""
} |
q254004 | Cookie.remove | validation | public function remove($name, $path = null, $domain = null, $secure = false, $httpOnly = false) {
if ($this->exists($name)) {
$expire = time() - (3600 * 24 * 365);
$this->set($name, '', $expire, $path, $domain, $secure, $httpOnly);
}
} | php | {
"resource": ""
} |
q254005 | Headers.add | validation | public function add(string $header): self
{
foreach ($this->getAll() as $tmp) {
if ($tmp === $header) {
throw new Exception("The '{$header}' header has already been added.");
}
}
$this->headerList[] = $header;
return self::$instance;
} | php | {
"resource": ""
} |
q254006 | Headers.addByHttpCode | validation | public function addByHttpCode(int $code): self
{
$serverProtocol = filter_input(
\INPUT_SERVER,
'SERVER_PROTOCOL',
\FILTER_SANITIZE_STRING
);
$protocol = !empty($serverProtocol) ? $serverProtocol : 'HTTP/1.1';
$sHeader = "{$protocol} {$code} ".se... | php | {
"resource": ""
} |
q254007 | Headers.run | validation | public function run(): void
{
$this->isRan = true;
foreach ($this->getAll() as $header) {
header($header);
}
} | php | {
"resource": ""
} |
q254008 | Registry.set | validation | public function set(string $key, $value): self
{
$this->store[$key] = $value;
return self::$instance;
} | php | {
"resource": ""
} |
q254009 | Registry.get | validation | public function get(string $key = '')
{
if (empty($key)) {
return $this->store;
} else {
return $this->store[$key] ?? null;
}
} | php | {
"resource": ""
} |
q254010 | Module.getDb | validation | public function getDb()
{
if (is_null($this->_db)) {
if (!isset($this->dbConfig['class'])) {
$this->dbConfig['class'] = 'cascade\components\dataInterface\connectors\db\Connection';
}
$this->_db = Yii::createObject($this->dbConfig);
$this->_db->... | php | {
"resource": ""
} |
q254011 | Email.authorize | validation | public function authorize(RecordInterface &$user, $remember = false)
{
// Call default authorize behaviour
if (parent::authorize($user, $remember)) {
// If remember flag is passed - save it
if ($remember) {
// Create token
$token = $user[$this-... | php | {
"resource": ""
} |
q254012 | Email.authorizeWithEmail | validation | public function authorizeWithEmail($hashedEmail, $hashedPassword, $remember = null, & $user = null)
{
// Status code
$result = new EmailStatus(0);
// Check if this email is registered
if (dbQuery($this->dbTable)->where($this->dbHashEmailField, $hashedEmail)->first($user)) {
... | php | {
"resource": ""
} |
q254013 | Email.register | validation | public function register($email, $hashedPassword = null, & $user = null, $valid = false)
{
// Status code
$result = new EmailStatus(0);
// Check if this email is not already registered
if (!dbQuery($this->dbTable)->cond($this->dbEmailField, $email)->first($user)) {
/**@v... | php | {
"resource": ""
} |
q254014 | Email.__async_authorize | validation | public function __async_authorize($hashEmail = null, $hashPassword = null)
{
$result = array('status' => '0');
// Get hashed email field by all possible methods
if (!isset($hashEmail)) {
if (isset($_POST) && isset($_POST[$this->dbHashEmailField])) {
$hashEmail = ... | php | {
"resource": ""
} |
q254015 | Email.__authorize | validation | public function __authorize($hashEmail = null, $hashPassword = null)
{
// Perform asynchronous authorization
$asyncResult = $this->__async_authorize($hashEmail, $hashPassword);
if ($asyncResult) {
}
} | php | {
"resource": ""
} |
q254016 | FileSystemMapper.read | validation | protected function read($namespace)
{
$file = $this->adapter->getFileName($namespace);
if (!$this->fileSystem->has($file)) {
return [];
}
return $this->adapter->onRead($this->fileSystem->read($file));
} | php | {
"resource": ""
} |
q254017 | FileSystemMapper.write | validation | protected function write($namespace, array $data)
{
$file = $this->adapter->getFileName($namespace);
$contents = $this->adapter->prepareForWriting($data);
if (!$this->fileSystem->has($file)) {
$this->fileSystem->write($file, $contents);
}
$this->fileSystem->updat... | php | {
"resource": ""
} |
q254018 | GridBuilder.render | validation | public function render(){
$sort=0;
$query=$this->request->getQuery();
if(isset($query['sort']) && isset($this->columns[$query['sort']])){
$sort=$query['sort'];
}
return $this->formatter->render($this->columns
,$this->getRecords()
,$this->dataManager->getTotalCount(),$this->limit,$this->page,$sort);
... | php | {
"resource": ""
} |
q254019 | Widget.getRefreshInstructions | validation | public function getRefreshInstructions()
{
$i = [];
$i['type'] = 'widget';
$i['systemId'] = $this->collectorItem->systemId;
$i['recreateParams'] = $this->recreateParams;
if ($this->section) {
$i['section'] = $this->section->systemId;
}
return $i;
... | php | {
"resource": ""
} |
q254020 | Widget.getState | validation | public function getState($key, $default = null)
{
return Yii::$app->webState->get($this->stateKeyName($key), $default);
} | php | {
"resource": ""
} |
q254021 | Widget.setState | validation | public function setState($key, $value)
{
return Yii::$app->webState->set($this->stateKeyName($key), $value);
} | php | {
"resource": ""
} |
q254022 | Encryptor.decrypt | validation | private function decrypt($encrypted, $appId)
{
try {
$key = $this->getAESKey();
$ciphertext = base64_decode($encrypted, true);
$iv = substr($key, 0, 16);
$decrypted = openssl_decrypt($ciphertext, 'aes-256-cbc', $key, OPENSSL_RAW_DATA | OPENSSL_NO_PADDING, $iv... | php | {
"resource": ""
} |
q254023 | ArrayIntersections.getAll | validation | public function getAll() {
if (is_null($this->intersections)) {
$this->intersections = [];
if ($this->arraysSize >= 2) {
$this->createIntersections();
}
}
return $this->intersections;
} | php | {
"resource": ""
} |
q254024 | ArrayIntersections.createIntersections | validation | protected function createIntersections() {
$totalNumberOfCombinations = min(pow(2, $this->arraysSize), $this->maxNumberOfCombinations);
$maskGenerator = new BitMaskGenerator($this->arraysSize, 2);
$i = 0;
$noresult = 0;
while ($i < $totalNumberOfCombinations && $noresult < $totalNumberOfCombinations... | php | {
"resource": ""
} |
q254025 | ArrayIntersections.isNoResultMask | validation | protected function isNoResultMask($mask) {
foreach ($this->noResultMasks as $noresultMask) {
if ($mask === $noresultMask) {
return TRUE; // @codeCoverageIgnore
}
if (($mask & $noresultMask) === $noresultMask) {
$this->noResultMasks[] = $mask;
return TRUE;
}
}
... | php | {
"resource": ""
} |
q254026 | ArrayIntersections.generateIntersection | validation | protected function generateIntersection($combinationMask) {
$combination = [];
foreach (str_split($combinationMask) as $key => $indicator) {
if ($indicator) {
$combination[] = $this->arrays[$this->arrayKeys[$key]];
}
}
$intersection = call_user_func_array('array_intersect_assoc', $co... | php | {
"resource": ""
} |
q254027 | Module.getConfig | validation | public function getConfig()
{
return [
'form_elements' => [
'aliases' => [
'checkbox' => Element\Checkbox::class,
'Checkbox' => Element\Checkbox::class,
'ckeditor' => Element\CkEditor::class,
... | php | {
"resource": ""
} |
q254028 | Request.getPut | validation | public static function getPut()
{
$aPut = array();
$rPutResource = fopen("php://input", "r");
while ($sData = fread($rPutResource, 1024)) {
$aSeparatePut = explode('&', $sData);
foreach($aSeparatePut as $sOne) {
$aOnePut = explode... | php | {
"resource": ""
} |
q254029 | Request.setStatus | validation | public static function setStatus($iCode)
{
if ($iCode === 200) { header('HTTP/1.1 200 Ok'); }
else if ($iCode === 201) { header('HTTP/1.1 201 Created'); }
else if ($iCode === 204) { header("HTTP/1.0 204 No Content"); }
else if ($iCode === 403) { header('HTTP/1.1 403 Forbidden'); }
else if ($iCode === 404)... | php | {
"resource": ""
} |
q254030 | DataItem.loadForeignObject | validation | protected function loadForeignObject()
{
if ($this->_isLoadingForeignObject) {
throw new RecursionException('Ran into recursion while loading foreign object');
}
$this->_isLoadingForeignObject = true;
if (isset($this->foreignPrimaryKey)) {
$foreignObject = $th... | php | {
"resource": ""
} |
q254031 | ViewFactory.createView | validation | public static function createView(
string $actionName,
?string $ctrlName = null
): ?View {
$viewsRoot = AppHelper::getInstance()->getComponentRoot('views');
$addPath = '';
if (!empty($ctrlName)) {
$addPath .= \DIRECTORY_SEPARATOR.strtolower($ctrlName);
}... | php | {
"resource": ""
} |
q254032 | ViewFactory.createLayout | validation | public static function createLayout(string $layoutName, View $view): ?Layout
{
$layoutsRoot = AppHelper::getInstance()->getComponentRoot('layouts');
$layoutFile = $layoutsRoot.\DIRECTORY_SEPARATOR
.strtolower($layoutName).'.php';
if (is_readable($layoutFile)) {
retur... | php | {
"resource": ""
} |
q254033 | ViewFactory.createSnippet | validation | public static function createSnippet(string $snptName): ?Snippet
{
$snptRoot = AppHelper::getInstance()->getComponentRoot('snippets');
$snptFile = $snptRoot.\DIRECTORY_SEPARATOR
.strtolower($snptName).'.php';
if (is_readable($snptFile)) {
return new Snippet($snptFile... | php | {
"resource": ""
} |
q254034 | DigitalOcean.create | validation | public function create($params = array())
{
$serverConfig = array_merge($this->defaults, $params);
try {
$response = $this->client->request->post($this->apiEndpoint."/droplets", ['json' => $serverConfig]);
if (202 != $this->client->getStatus($response)) {
th... | php | {
"resource": ""
} |
q254035 | DigitalOcean.delete | validation | public function delete($id)
{
try {
$response = $this->client->request->delete($this->apiEndpoint."/droplets/$id");
$status = $this->client->getStatus($response);
if (204 != $status) {
throw new Exception('Digital Ocean responded that it could not delete... | php | {
"resource": ""
} |
q254036 | DigitalOcean.images | validation | public function images($params)
{
try {
$response = $this->client->request->get($this->apiEndpoint.'/images'.$this->paramsToString($params));
$status = $this->client->getStatus($response);
if (200 != $status) {
throw new Exception('Digital Ocean was not ... | php | {
"resource": ""
} |
q254037 | IronMQ.clear | validation | public function clear($queue)
{
$this->client->request->post(
$this->apiEndpoint.'/projects/'.$this->params['project'].'/queues/'.$queue.'/clear'
);
} | php | {
"resource": ""
} |
q254038 | Text.mb_str_pad | validation | public function mb_str_pad($input, $length, $string = ' ', $type = STR_PAD_LEFT)
{
return str_pad($input, $length + strlen($input) - mb_strlen($input), $string, $type );
} | php | {
"resource": ""
} |
q254039 | SourceFile.getLines | validation | public function getLines($lazy = true, $raw = false)
{
if (is_null($this->_lines)) {
$file = $this->filePointer;
if (!$file) {
return false;
}
rewind($file);
$this->_lines = [];
$currentLineNumber = 0;
while ... | php | {
"resource": ""
} |
q254040 | SourceFile.getFilePointer | validation | public function getFilePointer()
{
if (!isset($this->_filePointer)) {
ini_set('auto_detect_line_endings', true);
$this->_filePointer = false;
$file = null;
if (isset($this->local) && file_exists($this->local)) {
$file = $this->local;
... | php | {
"resource": ""
} |
q254041 | SourceFile.getHeaders | validation | public function getHeaders()
{
if (!isset($this->_headers)) {
$this->_headers = $this->readLine(1);
if (!$this->_headers) {
$this->_headers = [];
}
}
return $this->_headers;
} | php | {
"resource": ""
} |
q254042 | MenuFactory.createItem | validation | public function createItem($name, array $options = array())
{
if (!empty($options['admin'])) {
$admin = $options['admin'];
if ( !$options['admin'] instanceof AdminInterface ) {
$admin = $this->container->get('sonata.admin.pool')->getAdminByAdminCode($admin);
... | php | {
"resource": ""
} |
q254043 | Paginator.getPage | validation | public function getPage($page = null)
{
if (is_null($page)) {
$page = $this->page;
}
list($offset, $size) = $this->getLimts($page);
$this->manager->limit($offset, $size);
return $this->manager->values();
} | php | {
"resource": ""
} |
q254044 | Web2All_Table_Collection_SimpleDataProvider.getADORecordSet | validation | public function getADORecordSet()
{
if (!$this->sql) {
// no sql set
throw new Exception('Web2All_Table_Collection_SimpleDataProvider::getADORecordSet: no SQL query set');
}
return $this->db->SelectLimit($this->sql,$this->limit,$this->offset,$this->params);
} | php | {
"resource": ""
} |
q254045 | Model.buildColumnPropertiesCache | validation | private static function buildColumnPropertiesCache()
{
// Get the calling child class, ensuring that the Model class was not used!
$class = self::getStaticChildClass();
// Create an AnnotationReader and get all of the annotations on properties of this class.
$annotations = new Annot... | php | {
"resource": ""
} |
q254046 | Model.getColumnName | validation | private static function getColumnName(string $name): ?string
{
// Get the calling child class, ensuring that the Model class was not used!
$class = self::getStaticChildClass();
// IF the column => property cache has not yet been built, or does not exist for this class...
if (self::$... | php | {
"resource": ""
} |
q254047 | Model.select | validation | public static function select(): Collection
{
// Ensure the database is connected!
$pdo = Database::connect();
// Get the calling child class, ensuring that the Model class was not used!
$class = self::getStaticChildClass();
// Get the table name from either a @TableNameAnn... | php | {
"resource": ""
} |
q254048 | Model.where | validation | public static function where(string $column, string $operator, $value): Collection
{
// Ensure the database is connected!
$pdo = Database::connect();
// Get the calling child class, ensuring that the Model class was not used!
$class = self::getStaticChildClass();
// Get the... | php | {
"resource": ""
} |
q254049 | Model.getPrimaryKey | validation | private static function getPrimaryKey(string $table): array
{
if (self::$primaryKeyCache !== null && array_key_exists($table, self::$primaryKeyCache))
return self::$primaryKeyCache[$table];
// Ensure the database is connected!
$pdo = Database::connect();
/** @noinspecti... | php | {
"resource": ""
} |
q254050 | Model.isPrimaryKey | validation | private static function isPrimaryKey(string $table, string $column): bool
{
return self::getPrimaryKey($table)["column_name"] === $column;
} | php | {
"resource": ""
} |
q254051 | Model.getForeignKeys | validation | private static function getForeignKeys(string $table): array
{
if (self::$foreignKeysCache !== null && array_key_exists($table, self::$foreignKeysCache))
return self::$foreignKeysCache[$table];
// Ensure the database is connected!
$pdo = Database::connect();
/** @noinsp... | php | {
"resource": ""
} |
q254052 | Model.getForeignKeysNames | validation | private static function getForeignKeysNames(string $table): array
{
if (self::$foreignKeysCache === null || !array_key_exists($table, self::$foreignKeysCache))
self::getForeignKeys($table);
return array_keys(self::$foreignKeysCache[$table]);
} | php | {
"resource": ""
} |
q254053 | Model.isForeignKey | validation | private static function isForeignKey(string $table, string $column): bool
{
return array_key_exists($column, self::getForeignKeys($table));
} | php | {
"resource": ""
} |
q254054 | Model.getNullables | validation | private static function getNullables(string $table): array
{
if (self::$nullablesCache !== null && array_key_exists($table, self::$nullablesCache))
return self::$nullablesCache[$table];
// Ensure the database is connected!
$pdo = Database::connect();
/** @noinspection S... | php | {
"resource": ""
} |
q254055 | Model.getNullableNames | validation | private static function getNullableNames(string $table): array
{
if (self::$nullablesCache === null || !array_key_exists($table, self::$nullablesCache))
self::getNullables($table);
return array_keys(self::$nullablesCache[$table]);
} | php | {
"resource": ""
} |
q254056 | Model.isNullable | validation | private static function isNullable(string $table, string $column): bool
{
// IF the nullables cache is not already built, THEN build it!
if (self::$nullablesCache === null || !array_key_exists($table, self::$nullablesCache))
self::getNullables($table);
// Return TRUE if the colu... | php | {
"resource": ""
} |
q254057 | Model.getColumns | validation | private static function getColumns(string $table): array
{
if (self::$columnsCache !== null && array_key_exists($table, self::$columnsCache))
return self::$columnsCache[$table];
// Ensure the database is connected!
$pdo = Database::connect();
/** @noinspection SqlResolv... | php | {
"resource": ""
} |
q254058 | ValueCache.fetchAll | validation | public function fetchAll() {
$list = [];
foreach($this->cache as $domain => $values) {
foreach($values as $key => $value)
$list[ sprintf("%s.%s", $domain!='<NULL>' ? $domain : '', $key) ] = $value;
}
return $list;
} | php | {
"resource": ""
} |
q254059 | CommandTransformer.transformCommandToMessage | validation | public function transformCommandToMessage($command)
{
if (!is_object($command)) {
throw CommandTransformationException::expectedObject($command);
}
if (!isset($this->commands[get_class($command)])) {
throw CommandTransformationException::unknownCommand($command, array... | php | {
"resource": ""
} |
q254060 | Installer.setPermission | validation | public static function setPermission(array $paths)
{
foreach ($paths as $path => $permission) {
echo "chmod('$path', $permission)...";
if (is_dir($path) || is_file($path)) {
chmod($path, octdec($permission));
echo "done.\n";
} else {
... | php | {
"resource": ""
} |
q254061 | Injector.execute | validation | public function execute(callable $callback, array $vars): Response
{
$arguments = $this->resolveDependencies($callback, $vars);
return call_user_func_array($callback, $arguments);
} | php | {
"resource": ""
} |
q254062 | Injector.resolveDependencies | validation | private function resolveDependencies(callable $callback, array $vars): array
{
$method = new \ReflectionMethod($callback[0], $callback[1]);
$dependencies = [];
foreach ($method->getParameters() as $parameter) {
if ($parameter->getClass() === null && !count($vars)) {
... | php | {
"resource": ""
} |
q254063 | BlockManager.resolveOptions | validation | protected function resolveOptions(array $options)
{
if ($this->optionsResolved) {
return;
}
$this->optionsResolver->clear();
$this->optionsResolver->setRequired(
array(
'blockname',
)
);
parent::resolveOptions($opt... | php | {
"resource": ""
} |
q254064 | BlockManager.createContributorDir | validation | protected function createContributorDir($sourceDir, array $options, $username)
{
if (null === $username) {
return;
}
$this->init($sourceDir, $options, $username);
if (is_dir($this->contributorDir)) {
return;
}
$this->filesystem->copy($this->p... | php | {
"resource": ""
} |
q254065 | BlockManager.addBlockToSlot | validation | protected function addBlockToSlot($dir, array $options)
{
$slot = $this->getSlotDefinition($dir);
$blocks = $slot["blocks"];
$blockName = $options["blockname"];
$position = $options["position"];
array_splice($blocks, $position, 0, $blockName);
$slot["next"] = str_rep... | php | {
"resource": ""
} |
q254066 | BlockManager.getSlotDefinition | validation | protected function getSlotDefinition($dir)
{
$slotsFilename = $this->getSlotDefinitionFile($dir);
return json_decode(FilesystemTools::readFile($slotsFilename), true);
} | php | {
"resource": ""
} |
q254067 | BlockManager.saveSlotDefinition | validation | protected function saveSlotDefinition($dir, array $slot)
{
$slotsFilename = $this->getSlotDefinitionFile($dir);
FilesystemTools::writeFile($slotsFilename, json_encode($slot), $this->filesystem);
} | php | {
"resource": ""
} |
q254068 | BlockManager.removeBlockFromSlotFile | validation | protected function removeBlockFromSlotFile(array $options, $targetDir = null)
{
$targetDir = $this->workDirectory($targetDir);
$slot = $this->getSlotDefinition($targetDir);
$blockName = $options["blockname"];
$tmp = array_flip($slot["blocks"]);
unset($tmp[$blockName]);
... | php | {
"resource": ""
} |
q254069 | TwigEngine.registerCustomFunctions | validation | protected function registerCustomFunctions()
{
$functionList = $this->functionGenerator->getFunctionList();
foreach ($functionList as $function) {
if (isset($function['name']) && isset($function['callable'])) {
$twigFunction = new Twig_SimpleFunction($function['name'], $... | php | {
"resource": ""
} |
q254070 | Compiler.setConfig | validation | public function setConfig($name, $value) {
if (is_null($name)) {
$this->_config = new ArrayStorage($value);
} else {
$this->_config->setDeepValue($name, $value);
}
return $this;
} | php | {
"resource": ""
} |
q254071 | Compiler.compileSource | validation | public function compileSource($source) {
$source = $this->stripComments($source);
$source = $this->saveLiterals($source);
$result = preg_replace_callback('#' . $this->_config['tokenStart'] . '(.*)' . $this->_config['tokenEnd'] . '#smU', array($this, 'onTokenFound'), $source);
$result = ... | php | {
"resource": ""
} |
q254072 | Compiler.onTokenFound | validation | private function onTokenFound($token) {
if (is_array($token)) $token = array_pop($token);
$token = trim($token);
$tokenParts = explode(' ', $token);
$tag = array_shift($tokenParts);
$params = implode(' ', $tokenParts);
if ($this->_blocks->has($tag)) {
... | php | {
"resource": ""
} |
q254073 | Compiler._processModifiers | validation | private function _processModifiers($expression) {
$mStart = '';
$mEnd = '';
$rawEcho = false;
/** process modifiers */
if (strpos($expression, '|') !== false && strpos($expression, '||') === false) {
$modifiers = explode('|', $expression);
$expressio... | php | {
"resource": ""
} |
q254074 | ServiceContainerCodeGenerator.generateConfigCreatorMethod | validation | private function generateConfigCreatorMethod(ConfigService $config)
{
$configClass = Util::normalizeFqcn($config->getClass());
$configData = var_export($config->getData(), true);
return <<<PHP
public function getAppConfig() : {$configClass}
{
if (isset(\$this->singletons[... | php | {
"resource": ""
} |
q254075 | ServiceContainerCodeGenerator.generatePureCreatorMethod | validation | private function generatePureCreatorMethod(ServiceDefinition $service) : string
{
$taggedAs = implode(', ', $service->getTags());
$classNormalized = $this->normalizeFqcn($service->getClass());
//// SINGLETON //////////////////////////////////////////////////////////////////////////... | php | {
"resource": ""
} |
q254076 | ServiceContainerCodeGenerator.generateFactoryCreatorMethod | validation | private function generateFactoryCreatorMethod(FactoredService $service) : string
{
$factoryMethod = $service->getFactoryMethod();
$taggedAs = implode(', ', $service->getTags());
$classNormalized = $this->normalizeFqcn($service->getClass());
$optional = $service->getFacto... | php | {
"resource": ""
} |
q254077 | Filesystem.makeDirectory | validation | public function makeDirectory($path, $mode = 0755, $recursive = false) {
if (!file_exists($path)) {
return mkdir($path, $mode, $recursive);
}
return true;
} | php | {
"resource": ""
} |
q254078 | SiteBuilder.build | validation | public function build()
{
$this->appDir = $this->rootDir . '/app';
$siteDir = $this->appDir . '/data/' . $this->siteName;
$siteConfigDir = $siteDir . '/config';
$pagesDir = $siteDir . '/pages/pages';
$rolesDir = $siteDir . '/roles';
$slotsDir = $siteDir . '/slots';
... | php | {
"resource": ""
} |
q254079 | FileManager.dir | validation | static public function dir($directory, $date = false)
{
if ($date) {
$directory = rtrim($directory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . self::getDateDirectory();
}
if (!is_dir($directory)) {
$umask = umask(0000);
if (@mkdir($directory, 0777, true... | php | {
"resource": ""
} |
q254080 | FileManager.generateFilename | validation | static public function generateFilename($directory, $extension, $length = 16)
{
do {
$name = \Extlib\Generator::generate($length);
$filepath = rtrim($directory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . sprintf('%s.%s', $name, $extension);
} while (file_exists($filepath));... | php | {
"resource": ""
} |
q254081 | FileManager.getMimeType | validation | static public function getMimeType($filePath, $default = 'application/octet-stream')
{
$mimeType = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $filePath);
if ($mimeType === false) {
$mimeType = $default;
}
return $mimeType;
} | php | {
"resource": ""
} |
q254082 | FileManager.recursiveDelete | validation | static public function recursiveDelete($path)
{
if (is_file($path)) {
return unlink($path);
}
$scans = glob(rtrim($path, '/') . '/*');
foreach ($scans as $scan) {
self::recursiveDelete($scan);
}
return rmdir($path);
} | php | {
"resource": ""
} |
q254083 | FileManager.removeFiles | validation | static public function removeFiles($directory)
{
$scan = glob(rtrim($directory, '/') . '/*');
foreach ($scan as $file) {
if (is_file($file)) {
unlink($file);
}
}
return true;
} | php | {
"resource": ""
} |
q254084 | ImportPeopleFromCSVCommand.addOptionShortcut | validation | protected function addOptionShortcut($name, $description, $default)
{
$this->addOption($name, null, InputOption::VALUE_OPTIONAL, $description, $default);
return $this;
} | php | {
"resource": ""
} |
q254085 | ImportPeopleFromCSVCommand.loadAnswerMatching | validation | protected function loadAnswerMatching()
{
if ($this->input->hasOption('load-choice-matching')) {
$fs = new Filesystem();
$filename = $this->input->getOption('load-choice-matching');
if (!$fs->exists($filename)) {
$this->logger->warning("The file $filename... | php | {
"resource": ""
} |
q254086 | ImportPeopleFromCSVCommand.processTextType | validation | protected function processTextType(
$value,
\Symfony\Component\Form\FormInterface $form,
\Chill\CustomFieldsBundle\Entity\CustomField $cf
)
{
$form->submit(array($cf->getSlug() => $value));
$value = $form->getData()[$cf->getSlug()];
... | php | {
"resource": ""
} |
q254087 | Router.runHttpErrorPage | validation | public function runHttpErrorPage(int $iError)
{
if (isset($_SERVER) && isset($_SERVER['HTTP_HOST'])) {
foreach (Config::get('route') as $sHost => $oHost) {
if ((!strstr($sHost, '/') && $sHost == $_SERVER['HTTP_HOST'])
|| (strstr($sHost, '/') && strstr($_SERV... | php | {
"resource": ""
} |
q254088 | Router._loadController | validation | private function _loadController($oControllerName, string $sActionName, array $aParams = array())
{
$aPhpDoc = PhpDoc::getPhpDocOfMethod($oControllerName, $sActionName);
if (isset($aPhpDoc['Cache'])) {
if (!isset($aPhpDoc['Cache']['maxage'])) { $aPhpDoc['Cache']['maxage'] = 0; }
... | php | {
"resource": ""
} |
q254089 | Router._getPage403 | validation | private function _getPage403()
{
var_dump(debug_backtrace());
header("HTTP/1.0 403 Forbidden");
if (isset($this->_oRoutes->e403)) {
$this->_oRoutes->e403->route = '/';
$_SERVER['REQUEST_URI'] = '/';
$this->_route($this->_oRoutes->e403, $_SERVER['REQUEST_URI'])... | php | {
"resource": ""
} |
q254090 | Router._getPage404 | validation | private function _getPage404()
{
header("HTTP/1.0 404 Not Found");
if (isset($this->_oRoutes->e404)) {
$this->_oRoutes->e404->route = '/';
$_SERVER['REQUEST_URI'] = '/';
$this->_route($this->_oRoutes->e404, $_SERVER['REQUEST_URI']);
}
exit;
... | php | {
"resource": ""
} |
q254091 | Router._checkCache | validation | private function _checkCache(\stdClass $oCache)
{
/**
* cache-control http
*/
$sHearderValidity = false;
$sHeader = "Cache-Control:";
if (isset($oCache->visibility) && ($oCache->visibility = 'public' || $oCache->visibility = 'private')) {
$sHearderVal... | php | {
"resource": ""
} |
q254092 | CustomerRepository.beforeDeleteById | validation | public function beforeDeleteById(
\Magento\Customer\Api\CustomerRepositoryInterface $subject,
$customerId
) {
$this->deleteDwnl($customerId);
$result = [$customerId];
return $result;
} | php | {
"resource": ""
} |
q254093 | Environment.symbol | validation | protected static function symbol($symbol) {
if ($symbol instanceof Symbol)
return [$symbol->symbol, $symbol->package];
throw new \UnexpectedValueException(sprintf("Unexpected value of type '%s'.", is_object($symbol) ? get_class($symbol) : gettype($symbol)));
} | php | {
"resource": ""
} |
q254094 | Environment.import | validation | public function import(Package $package, $id = null) {
$id = is_null($id) ? $package->id : $id;
//load symbols
$this->symbols = array_merge($package->symbols, $this->symbols);
//load macros
$this->macros = array_merge($package->macros, $this->macros);
//store package
$this->packages[$id] = $pa... | php | {
"resource": ""
} |
q254095 | Processor.process | validation | public function process(Pipeline\Pipeline $pipeline, $payload)
{
$runner = clone($this);
$runner->stages = $pipeline->getIterator();
return $runner->handle($payload);
} | php | {
"resource": ""
} |
q254096 | Worker.goWait | validation | function goWait($maxExecution = null)
{
# Go For Jobs
#
$jobExecution = 0; $sleep = 0;
while ( 1 )
{
if ( 0 == $executed = $this->goUntilEmpty() ) {
// List is Empty; Smart Sleep
$sleep += 100000;
usleep($sleep);
... | php | {
"resource": ""
} |
q254097 | Worker.performPayload | validation | function performPayload(iPayloadQueued $processPayload)
{
$triesCount = 0;
if ($processPayload instanceof FailedPayload) {
if ( $processPayload->getCountRetries() > $this->getMaxTries() )
throw new exPayloadMaxTriesExceed(
$processPayload
... | php | {
"resource": ""
} |
q254098 | Worker.giveBuiltInQueue | validation | function giveBuiltInQueue(iQueueDriver $queueDriver)
{
if ($this->builtinQueue)
throw new exImmutable(sprintf(
'Built-in Queue (%s) is given.'
, \Poirot\Std\flatten($this->builtinQueue)
));
$this->builtinQueue = $queueDriver;
return $... | php | {
"resource": ""
} |
q254099 | PageSavedListener.onPageSaved | validation | public function onPageSaved(PageSavedEvent $event)
{
$blocks = $event->getApprovedBlocks();
foreach ($blocks as $blockk) {
foreach ($blockk as $block) {
$this->pageProductionRenderer->renderBlock(json_encode($block));
}
}
$mediaFiles = array_un... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.