_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q267000
Kernel.shutdown
test
public function shutdown(&$arg = null, $callback = null) { if ($this->getDebug() &&
php
{ "resource": "" }
q267001
Kernel.handles
test
public function handles(Request $request) { if (!$this->is_booted) { $this->boot(); } $this->getContainer()->set('request', $request); $this->getContainer()->get('router')->setUrl($request->buildUrl()); $mode_data = $this->getMode(true); if (isset($mode_da...
php
{ "resource": "" }
q267002
Kernel.distribute
test
public function distribute() { if (!$this->is_booted) { $this->boot(); } $req = $this->getContainer()->get('request');
php
{ "resource": "" }
q267003
Kernel.initBundle
test
public function initBundle($space, $dir) { $bundle = new \CarteBlanche\App\Bundle($space, $dir);
php
{ "resource": "" }
q267004
Kernel.addBootError
test
public function addBootError($string) { $this->boot_errors[] = $string; if ($this->getMode()==='dev') {
php
{ "resource": "" }
q267005
Kernel.initConstantPath
test
public function initConstantPath($cst, $path_ref, $must_exists = false, $must_be_writable = false) { if (defined($cst)) { $this->addPath($path_ref, constant($cst), $must_exists, $must_be_writable); } else {
php
{ "resource": "" }
q267006
Kernel.addPath
test
public function addPath($name, $value, $must_exists = false, $must_be_writable = false) { $config = $this->getContainer()->get('config'); if ($must_exists) { $realpath = $this->getAbsolutePath($value); if (!empty($realpath)) { $value = $realpath; }...
php
{ "resource": "" }
q267007
Kernel.getPath
test
public function getPath($name, $full_path = false) { $config = $this->getContainer()->get('config'); $path = $config->getRegistry()->getStackEntry($name, null, 'paths');
php
{ "resource": "" }
q267008
Kernel.getAbsolutePath
test
public function getAbsolutePath($path) { $root = $this->getPath('root_path'); if (empty($root)) { return null; } if (empty($path)) { return $root; } if (0===substr_count($path, $root)) {
php
{ "resource": "" }
q267009
Kernel.whoAmI
test
public function whoAmI() { $cmd = new \Library\Command; $whoami = $cmd->run('whoami');
php
{ "resource": "" }
q267010
Kernel.__setMode
test
private function __setMode($mode = 'dev') { $config = $this->getContainer()->get('config'); $mode_data = $config->get('carte_blanche.modes', array(), 'app'); if (array_key_exists($mode, $mode_data)) { $this->mode = strtolower($mode); } else { $this->mode = is...
php
{ "resource": "" }
q267011
Kernel.__loadDefaultConfig
test
private function __loadDefaultConfig() { $app_cfgfile = __DIR__.'/../../../config/'.self::CARTE_BLANCHE_CONFIG_FILE; if (!file_exists($app_cfgfile)) {
php
{ "resource": "" }
q267012
AssetManager.init
test
public function init() { parent::init(); $this->basePath = Reaction::$app->getAlias($this->basePath); if (!is_dir($this->basePath)) { throw new InvalidConfigException("The directory does not exist: {$this->basePath}"); } elseif (!is_writable($this->basePath)) { ...
php
{ "resource": "" }
q267013
AssetManager.loadBundle
test
protected function loadBundle($name, $config = [], $publish = true) { if (!isset($config['class'])) { $config['class'] = $name;
php
{ "resource": "" }
q267014
AssetManager.getConverter
test
public function getConverter() { if ($this->_converter === null) { $this->_converter = Reaction::create(AssetConverter::class); } elseif (is_array($this->_converter) || is_string($this->_converter)) { if (is_array($this->_converter) && !isset($this->_converter['class'])) { ...
php
{ "resource": "" }
q267015
AssetManager.hash
test
protected function hash($path) { if (is_callable($this->hashCallback)) { return call_user_func($this->hashCallback, $path); }
php
{ "resource": "" }
q267016
AbstractMail.addReplytos
test
public function addReplytos(array $reply_tos) { foreach ($reply_tos as $key => $val) { if
php
{ "resource": "" }
q267017
liteAuth.newUser
test
public function newUser($user, $pass, $email = '', $fname = '', $sname = '' , $admin = False){ $hash = password_hash($pass, PASSWORD_BCRYPT);
php
{ "resource": "" }
q267018
liteAuth.resumeSession
test
public function resumeSession($authtoken) { if( $id = $this->db->get($this->prefix.'authtokens', 'user_id',
php
{ "resource": "" }
q267019
PokeCalculator.calculate
test
public function calculate($expression) { $translatedExpression = $this->translate($expression); $result = eval('return '.$translatedExpression.';');
php
{ "resource": "" }
q267020
Ifsta.urlUserDetails
test
public function urlUserDetails(\League\OAuth2\Client\Token\AccessToken $token)
php
{ "resource": "" }
q267021
Mapper.raw
test
public function raw($sql, array $values = [], $class = null) { return $this->execute($sql, $values, function(\PDOStatement $statement) use($class) { if($statement->columnCount() > 0) { return $class
php
{ "resource": "" }
q267022
Html.csrfMetaTags
test
public static function csrfMetaTags(RequestApplicationInterface $app) { $encoding = $app->charset; if ($app->reqHelper->enableCsrfValidation) { return static::tag('meta', '', ['name'
php
{ "resource": "" }
q267023
Html.label
test
public static function label($content, $for = null, $options = [], $encoding = null) { $options['for'] = $for;
php
{ "resource": "" }
q267024
Html.button
test
public static function button($content = 'Button', $options = [], $encoding = null) { if (!isset($options['type'])) { $options['type'] = 'button';
php
{ "resource": "" }
q267025
Html.submitButton
test
public static function submitButton($content = 'Submit', $options = [], $encoding = null) { $options['type'] = 'submit';
php
{ "resource": "" }
q267026
Html.submitInput
test
public static function submitInput($label = 'Submit', $options = [], $encoding = null) { $options['type'] = 'submit';
php
{ "resource": "" }
q267027
Html.resetInput
test
public static function resetInput($label = 'Reset', $options = [], $encoding = null) { $options['type'] = 'reset'; $options['value']
php
{ "resource": "" }
q267028
Html.hiddenInput
test
public static function hiddenInput($name, $value = null, $options = [], $encoding
php
{ "resource": "" }
q267029
Html.passwordInput
test
public static function passwordInput($name, $value = null, $options = [], $encoding
php
{ "resource": "" }
q267030
Html.processBooleanInputOptions
test
protected static function processBooleanInputOptions($name, &$options) { if(isset($options['label'])) { $options['labelOptions'] = isset($options['labelOptions']) ? $options['labelOptions'] : []; Html::addCssClass($options['labelOptions'], ['widget' => 'form-check-label']); } ...
php
{ "resource": "" }
q267031
Time.setHours
test
public function setHours(int $hours): void { $this->timeElementsAreValid($hours,
php
{ "resource": "" }
q267032
Time.setMinutes
test
public function setMinutes(int $minutes): void { $this->timeElementsAreValid($this->hours,
php
{ "resource": "" }
q267033
Time.setSeconds
test
public function setSeconds(int $seconds): void { $this->timeElementsAreValid($this->hours,
php
{ "resource": "" }
q267034
Time.timeElementsAreValid
test
private function timeElementsAreValid($hours, $minutes, $seconds): bool { $exception = new \InvalidArgumentException( \sprintf('Invalid time "%02d:%02d:%02d".', $hours, $minutes, $seconds) ); if ((int)\sprintf('%d%02d%02d', $hours, $minutes, $seconds) > 240000) { thr...
php
{ "resource": "" }
q267035
FlyFilesystem.write
test
public function write(string $path, string $contents): bool
php
{ "resource": "" }
q267036
FlyFilesystem.writeStream
test
public function writeStream(string $path, $resource): bool
php
{ "resource": "" }
q267037
FlyFilesystem.update
test
public function update(string $path, string $contents): bool
php
{ "resource": "" }
q267038
FlyFilesystem.updateStream
test
public function updateStream(string $path, $resource): bool
php
{ "resource": "" }
q267039
FlyFilesystem.put
test
public function put(string $path, string $contents): bool
php
{ "resource": "" }
q267040
FlyFilesystem.putStream
test
public function putStream(string $path, $resource): bool {
php
{ "resource": "" }
q267041
FlyFilesystem.rename
test
public function rename(string $path, string $newPath): bool
php
{ "resource": "" }
q267042
FlyFilesystem.copy
test
public function copy(string $path, string $newPath): bool
php
{ "resource": "" }
q267043
FlyFilesystem.metadata
test
public function metadata(string $path): ? array { $metadata = $this->flySystem->getMetadata($path);
php
{ "resource": "" }
q267044
FlyFilesystem.mimetype
test
public function mimetype(string $path): ? string { $mimetype = $this->flySystem->getMimetype($path);
php
{ "resource": "" }
q267045
FlyFilesystem.size
test
public function size(string $path): ? int { $size = $this->flySystem->getSize($path);
php
{ "resource": "" }
q267046
FlyFilesystem.timestamp
test
public function timestamp(string $path): ? int { $timestamp = $this->flySystem->getTimestamp($path);
php
{ "resource": "" }
q267047
FlyFilesystem.visibility
test
public function visibility(string $path): ? string { $visibility = $this->flySystem->getVisibility($path);
php
{ "resource": "" }
q267048
FlyFilesystem.setVisibility
test
public function setVisibility(string $path, Visibility $visibility): bool
php
{ "resource": "" }
q267049
FlyFilesystem.setVisibilityPublic
test
public function setVisibilityPublic(string $path): bool {
php
{ "resource": "" }
q267050
FlyFilesystem.setVisibilityPrivate
test
public function setVisibilityPrivate(string $path): bool {
php
{ "resource": "" }
q267051
FlyFilesystem.listContents
test
public function listContents(string $directory = null, bool $recursive =
php
{ "resource": "" }
q267052
FlyFilesystem.localAdapter
test
protected function localAdapter(): Local { return self::$adapters['local'] ?? self::$adapters['local'] = new Local(
php
{ "resource": "" }
q267053
FlyFilesystem.s3Adapter
test
protected function s3Adapter(): AwsS3Adapter { if (isset(self::$adapters['s3'])) { return self::$adapters['s3']; } $config = $this->app->config()['filesystem']['adapters']['s3']; $clientConfig = [ 'credentials' => [ 'key' => $config['...
php
{ "resource": "" }
q267054
UrlManager.processRequest
test
protected function processRequest() { if (!Reaction::$app->getI18n()->detectLanguageByUrl) { return; } $langPrefixes = Reaction::$app->getI18n()->languagePrefixes; $rawUrl = trim($this->app->reqHelper->getPathInfo(), '/'); $requestPrefix = ''; $rawUrlParts...
php
{ "resource": "" }
q267055
JmsSerializerContentNegotiation.deserializeRequest
test
public function deserializeRequest($className) { $request = $this->app["request_stack"]->getCurrentRequest(); return $this->app["serializer"]->deserialize(
php
{ "resource": "" }
q267056
Model.checkAccess
test
private static function checkAccess($object,$errorMessage){ if(is_string($object)){ $className = $object; $object = null; }else{ $className = get_class($object); } if(TransactionManager::isSuperUser()){ return true; } $hasAccess = fals...
php
{ "resource": "" }
q267057
DocBlock.parseBlock
test
protected function parseBlock($block) { $lines = array_filter(array_map(function($line) { $line = trim($line); if (strpos($line, "/**") !== false or strpos($line, "*/") !== false) { return null;
php
{ "resource": "" }
q267058
Directory.path
test
public static function path(string $path = null): ? string { return $path &&
php
{ "resource": "" }
q267059
AbstractApi.getAuthenticationObject
test
protected function getAuthenticationObject() { if ($this->authObject == null) { if (strlen($this->login) <= 0 || strlen($this->password) <= 0) { throw new NullPointerException("Login or Password is not set.");
php
{ "resource": "" }
q267060
AbstractApi.getDataFromUrl
test
protected function getDataFromUrl($url) { $auth = $this->getAuthenticationObject(); $process = curl_init($url); curl_setopt($process, CURLOPT_HEADER, 0); // setting the authentication header curl_setopt($process, CURLOPT_HTTPHEADER, array( "Authorization:...
php
{ "resource": "" }
q267061
AbstractApi.parseJsonData
test
protected function parseJsonData($data) { if ($data != FALSE) { // check, if raw answer is requestedd if ($this->getRawAnswer()) { return $data; } $json_data = json_decode($data, TRUE); if (isset($json_data["errors"])) ...
php
{ "resource": "" }
q267062
AbstractApi.getAll
test
public function getAll() { // build url $url = $this->base_url . $this->url; // get data from server $data = $this->getDataFromUrl($url);
php
{ "resource": "" }
q267063
EntityRepositoryTrait.getEntityAlias
test
public function getEntityAlias() { if (!$this->entityAlias) { $className = $this->getClassName(); $reflectionCLass = new ReflectionClass($className); if (is_string($reflectionCLass->getConstant('ALIAS_NAME'))) { $entityAlias = $reflectionCLass->getC...
php
{ "resource": "" }
q267064
EntityRepositoryTrait.createQueryBuilder
test
public function createQueryBuilder($alias = null, $indexBy = null) { return
php
{ "resource": "" }
q267065
EntityRepositoryTrait.createResultSetMappingBuilder
test
public function createResultSetMappingBuilder($alias = null) { if (!$alias) { $alias = $this->getEntityAlias(); } $resultSet = new ResultSetMappingBuilder( $this->getEntityManager(), ResultSetMappingBuilder::COLUMN_RENAMING_INCREMENT
php
{ "resource": "" }
q267066
EntityRepositoryTrait.findAllIdentifiers
test
public function findAllIdentifiers() { $metadata = $this->getClassMetadata(); $identifiers = $metadata->getIdentifier();
php
{ "resource": "" }
q267067
EntityRepositoryTrait.min
test
public function min($column) { $qb = $this->createQueryBuilder();
php
{ "resource": "" }
q267068
EntityRepositoryTrait.paginate
test
public function paginate($page = 1, $perPage = null) { $perPage = $perPage ?: $this->getMaxResults(); $qb = $this->createQueryBuilder();
php
{ "resource": "" }
q267069
EntityRepositoryTrait.isEntity
test
public function isEntity($entity) { return is_object($entity)
php
{ "resource": "" }
q267070
EntityRepositoryTrait.getIdentifier
test
protected function getIdentifier($entity, $single = false) { $this->validateEntity($entity, __METHOD__); $entityClass = ClassUtils::getClass($entity); $entityManager = $this->getEntityManager(); $metadata = $entityManager->getClassMetadata($entityClass); $metadata->v...
php
{ "resource": "" }
q267071
EntityRepositoryTrait.validateEntity
test
protected function validateEntity($entity, $method) { if (!$this->isEntity($entity)) { throw new Exception\InvalidArgumentException( sprintf( '%s expects parameter 1 to be a valid entity
php
{ "resource": "" }
q267072
EntityRepositoryTrait.toArray
test
public function toArray($entity) { $entityManager = $this->getEntityManager(); $unitOfWork = $entityManager->getUnitOfWork(); $classMetadata = $this->getClassMetadata(); $result = []; foreach ($unitOfWork->getOriginalEntityData($entity) as $field => $value) { ...
php
{ "resource": "" }
q267073
FileValidator.filterFiles
test
private function filterFiles(array $files) { $result = []; //\React\Http\Io\UploadedFile::class; foreach ($files as $fileName => $file) { if
php
{ "resource": "" }
q267074
FileValidator.getSizeLimit
test
public function getSizeLimit() { // Get the lowest between post_max_size and upload_max_filesize, log a warning if the first is < than the latter $limit = $this->sizeToBytes(ini_get('upload_max_filesize')); $postLimit = $this->sizeToBytes(ini_get('post_max_size')); if ($postLimit > 0...
php
{ "resource": "" }
q267075
BagTrait.has
test
public function has($key) { return (isset($this->bag[$key]) ||
php
{ "resource": "" }
q267076
NativeKernel.handle
test
public function handle(Input $input, Output $output): int { $exitCode = 1; try { $exitCode = $this->console->dispatch($input, $output); } catch (Throwable $exception) {
php
{ "resource": "" }
q267077
NativeKernel.terminate
test
public function terminate(Input $input, int $exitCode): void { $this->app->events()->trigger( ConsoleKernelTerminate::class,
php
{ "resource": "" }
q267078
CategoryComponent.accountCategories
test
public function accountCategories(Account $account) { $this->dataCollection->add('account', $account); $categoryMapper = new CategoryMapper(Database::get('money'));
php
{ "resource": "" }
q267079
WebApp.run
test
public function run() { try { $this->init(); $this->executeController(); } catch (\Exception
php
{ "resource": "" }
q267080
WebApp.init
test
private function init() { $timeZone = $this->appConfig->getTimeZone(); if (!empty($timeZone)) {
php
{ "resource": "" }
q267081
ThrowPromise.execute
test
public function execute(array $args, FunctionProphecy $function) { if (is_string($this->exception)) { $classname = $this->exception; $reflection = new ReflectionClass($classname); $constructor = $reflection->getConstructor();
php
{ "resource": "" }
q267082
Field.toArray
test
public function toArray() { return [ 'name' => $this->name, 'title' => $this->title, 'type' => $this->type,
php
{ "resource": "" }
q267083
DbManager.init
test
public function init() { parent::init(); $this->db = Instance::ensure($this->db, DatabaseInterface::class); if ($this->cache !== null) {
php
{ "resource": "" }
q267084
DbManager.getChildrenList
test
protected function getChildrenList() { return (new Query())->from($this->itemChildTable) ->all($this->db) ->then( function($rows) { $parents = []; foreach ($rows as $row) {
php
{ "resource": "" }
q267085
DbManager.detectLoop
test
protected function detectLoop($parent, $child) { if ($child->name === $parent->name) { return reject(true); } return $this->getChildren($child->name) ->then(function($children) use ($parent) { $promises = []; foreach ($children as $gra...
php
{ "resource": "" }
q267086
DbManager.invalidateCache
test
public function invalidateCache() { $this->_checkAccessAssignments = []; if ($this->cache !== null) { $this->items = null; $this->rules = null;
php
{ "resource": "" }
q267087
DoctrineMigrationRepository.getLastBatchNumber
test
public function getLastBatchNumber() { $result = $this->getEntities()->createQueryBuilder() ->select('o, MAX(o.batch) as
php
{ "resource": "" }
q267088
Response.html
test
public static function html($content = null, $code = 200, array $headers = []) { return new
php
{ "resource": "" }
q267089
Response.json
test
public static function json($content = null, $code = 200, array $headers = []) { return new
php
{ "resource": "" }
q267090
Response.template
test
public static function template($template, array $vars = [], $code = 200, array $headers = []) { return
php
{ "resource": "" }
q267091
ControllerService.others
test
protected static function others(FileManager $fileManager, array &$parameters) { if (in_array( static::explain($parameters, 'Do you want to create Model layer?', '[y/n]'), static::POSITIVES) ) { $fileManager->execute('model'); }
php
{ "resource": "" }
q267092
Zend_Filter_Compress.getAdapter
test
public function getAdapter() { if ($this->_adapter instanceof Zend_Filter_Compress_CompressInterface) { return $this->_adapter; } $adapter = $this->_adapter; $options = $this->getAdapterOptions(); if (!class_exists($adapter)) { if (Zend_Loader::isRea...
php
{ "resource": "" }
q267093
Zend_Filter_Compress.setAdapter
test
public function setAdapter($adapter) { if ($adapter instanceof Zend_Filter_Compress_CompressInterface) { $this->_adapter = $adapter; return $this; } if (!is_string($adapter)) { throw new Zend_Filter_Exception('Invalid
php
{ "resource": "" }
q267094
AbstractRoutes.setPrefix
test
private static function setPrefix(array $config) { if(array_key_exists('prefix', $config)) { static::$prefix = $config['prefix'];
php
{ "resource": "" }
q267095
Request.getValue
test
private function getValue($name) { if (!$this->serverAccessor->contains($name)) { return null;
php
{ "resource": "" }
q267096
DefaultController.indexAction
test
public function indexAction($offset = 0, $limit = 5, $table = null, $show = null) { return array(self::$views_dir.'hello', array(
php
{ "resource": "" }
q267097
DefaultController.installAction
test
public function installAction() { $_altdb = $this->getContainer()->get('request')->getUrlArg('altdb'); $SQLITE = $this->getContainer()->get('database'); $tables = \CarteBlanche\Library\AutoObject\AutoObjectMapper::getObjectsStructure( $_altdb ); if (!empty($tables)) { $in...
php
{ "resource": "" }
q267098
DefaultController.bootErrorAction
test
public function bootErrorAction(array $errors = null) { $session = $this->getContainer()->get('session'); $original_errors = $session->has('boot_errors') ? $session->get('boot_errors') : $errors;
php
{ "resource": "" }
q267099
VarDumper.getSerializer
test
private static function getSerializer() { if (!isset(static::$_serializer)) { $superClosure = new
php
{ "resource": "" }