_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q266400
RequestHelper.getRawBody
test
public function getRawBody() { if ($this->_rawBody === null) {
php
{ "resource": "" }
q266401
RequestHelper.getBodyParams
test
public function getBodyParams() { if ($this->_bodyParams === null) { $reactMethod = strtoupper($this->reactRequest->getMethod()); $reactBody = $this->reactRequest->getParsedBody(); if ($reactMethod === 'POST' && isset($reactBody[$this->methodParam])) { $this->_bodyParams = $reactBody; unset($this->_bodyParams[$this->methodParam]); return $this->_bodyParams; } $rawContentType = $this->getContentType(); if (($pos = strpos($rawContentType, ';')) !== false) { // e.g. text/html; charset=UTF-8 $contentType = substr($rawContentType, 0, $pos); } else { $contentType = $rawContentType; } if (isset($this->parsers[$contentType])) { $parser = Reaction::create($this->parsers[$contentType]); if (!($parser instanceof RequestParserInterface)) { throw new InvalidConfigException("The '$contentType' request parser is invalid. It must implement the Reaction\\Web\\RequestParserInterface."); } $this->_bodyParams = $parser->parse($this->getRawBody(), $rawContentType); } elseif (isset($this->parsers['*'])) { $parser = Reaction::create($this->parsers['*']);
php
{ "resource": "" }
q266402
RequestHelper.getHostInfo
test
public function getHostInfo() { if ($this->_hostInfo === null) { $secure = $this->getIsSecureConnection(); $http = $secure ? 'https' : 'http'; $serverName = $this->getServerParam('SERVER_NAME'); if ($this->getHeaders()->has('X-Forwarded-Host')) { $this->_hostInfo = $http . '://' . $this->getHeaders()->get('X-Forwarded-Host'); } elseif ($this->getHeaders()->has('Host')) { $this->_hostInfo = $http . '://' . $this->getHeaders()->get('Host'); } elseif (isset($serverName)) { $this->_hostInfo =
php
{ "resource": "" }
q266403
RequestHelper.getScriptUrl
test
public function getScriptUrl() { $server = $this->getServerParams(); if ($this->_scriptUrl === null) { $scriptFile = $this->getScriptFile(); $scriptName = basename($scriptFile); if (isset($server['SCRIPT_NAME']) && basename($server['SCRIPT_NAME']) === $scriptName) { $this->_scriptUrl = $server['SCRIPT_NAME']; } elseif (isset($server['PHP_SELF']) && basename($server['PHP_SELF']) === $scriptName) { $this->_scriptUrl = $server['PHP_SELF']; } elseif (isset($server['ORIG_SCRIPT_NAME']) && basename($server['ORIG_SCRIPT_NAME']) === $scriptName) { $this->_scriptUrl = $server['ORIG_SCRIPT_NAME']; } elseif (isset($server['PHP_SELF']) && ($pos = strpos($server['PHP_SELF'], '/' . $scriptName)) !== false) {
php
{ "resource": "" }
q266404
RequestHelper.getServerParams
test
public function getServerParams() { if (!isset($this->_serverParams)) { $this->_serverParams = Reaction\Helpers\ArrayHelper::merge($this->getDefaultServerParams(),
php
{ "resource": "" }
q266405
RequestHelper.getAcceptableContentTypes
test
public function getAcceptableContentTypes() { if ($this->_contentTypes === null) { if ($this->getHeaders()->get('Accept') !== null) {
php
{ "resource": "" }
q266406
RequestHelper.getAcceptableLanguages
test
public function getAcceptableLanguages() { if ($this->_languages === null) { if ($this->getHeaders()->has('Accept-Language')) { /** @var string $acceptLangHeader */ $acceptLangHeader = $this->getHeaders()->get('Accept-Language');
php
{ "resource": "" }
q266407
RequestHelper.getETags
test
public function getETags() { if ($this->getHeaders()->has('If-None-Match')) { /** @var string $ifNoneHeader */ $ifNoneHeader = $this->getHeaders()->get('If-None-Match'); $eTags = preg_split('/[\s,]+/', str_replace('-gzip', '',
php
{ "resource": "" }
q266408
RequestHelper.getCsrfToken
test
public function getCsrfToken($regenerate = false) { if ($this->_csrfToken === null || $regenerate) { $token = $this->loadCsrfToken(); if ($regenerate || empty($token)) { $token = $this->generateCsrfToken();
php
{ "resource": "" }
q266409
RequestHelper.generateCsrfToken
test
protected function generateCsrfToken() { $token = Reaction::$app->security->generateRandomString(); if ($this->enableCsrfCookie) { $cookie = $this->createCsrfCookie($token);
php
{ "resource": "" }
q266410
RequestHelper.getDefaultServerParams
test
protected function getDefaultServerParams() { $scriptName = realpath($_SERVER['SCRIPT_FILENAME']); //Default script name fallback if (!$scriptName) { $scriptName = getcwd() . DIRECTORY_SEPARATOR . 'app'; }
php
{ "resource": "" }
q266411
LoginSuccess.onLogin
test
public function onLogin(InteractiveLoginEvent $event) { $user = $event->getAuthenticationToken()->getUser(); if ($user) { $user->setLastLogin(new \DateTime()); $user->setLogins($user->getLogins() + 1); $this->em->persist($user); $this->em->flush(); /*$request = $event->getRequest();
php
{ "resource": "" }
q266412
CropTwigExtension.crop
test
public function crop(array $croppable, $index = 0) { $coordinates = $croppable['coordinates'][$index]; $file = new UploadableFile($this->root_path, $croppable['image']); $name = $this->makeCropName($file, $coordinates);
php
{ "resource": "" }
q266413
CropTwigExtension.makeCropName
test
protected function makeCropName(UploadableFile $file, $coordinates) { $ext = $file->getExtension(); $suffix = implode('_', $coordinates);
php
{ "resource": "" }
q266414
CropTwigExtension.doCrop
test
protected function doCrop(UploadableFile $file, $coordinates, $path) { $crop = imagecreatetruecolor($coordinates['min_width'], $coordinates['min_height']); switch ($file->getExtension()) { case 'gif': $source = imagecreatefromgif($file); break; case 'png': $source = imagecreatefrompng($file); break; default: $source = imagecreatefromjpeg($file); } if (preg_match('/^(gif|png)$/', $file->getExtension())) { imagecolortransparent($crop, imagecolorallocatealpha($crop, 0, 0, 0, 127)); imagealphablending($crop, false); imagesavealpha($crop, true); } imagecopyresampled(
php
{ "resource": "" }
q266415
CropTwigExtension.getSize
test
public function getSize($image, $relative = false) { if (!$image instanceof File) { if ($relative) { $image = $this->root_path . $image; }
php
{ "resource": "" }
q266416
WindowsPathBuilder.getPermutations
test
public function getPermutations($file) { $paths = $this->_appendFileToPaths($this->_paths, $file);
php
{ "resource": "" }
q266417
NativeAnnotationsParser.getAnnotations
test
public function getAnnotations(string $docString): array { $annotations = []; // Get all matches of @ Annotations $matches = $this->getAnnotationMatches($docString); // If there are any matches iterate through them and create new // annotations if ($matches && isset($matches[0], $matches[1])) {
php
{ "resource": "" }
q266418
NativeAnnotationsParser.getAnnotationMatches
test
protected function getAnnotationMatches(string $docString): ? array {
php
{ "resource": "" }
q266419
NativeAnnotationsParser.setAnnotation
test
protected function setAnnotation(array $matches, int $index, array &$annotations): void { $properties = $this->getAnnotationProperties($matches, $index); // Get the annotation model from the annotations map $annotation = $this->getAnnotationFromMap($properties['annotation']); // Set the annotation's type $annotation->setAnnotationType($properties['annotation']); // If there are arguments if (null !== $properties['arguments'] && $properties['arguments']) { // Filter the arguments and set them in the annotation $annotation->setAnnotationArguments( $this->getArguments($properties['arguments']) ); // Having set the arguments there's no need to retain this key in // the properties unset($properties['arguments']); // Set the annotation's arguments to setters if they exist $this->setAnnotationArguments($annotation);
php
{ "resource": "" }
q266420
NativeAnnotationsParser.setAnnotationArguments
test
protected function setAnnotationArguments(Annotation $annotation): void { $arguments = $annotation->getAnnotationArguments(); // Iterate through the arguments foreach ($annotation->getAnnotationArguments() as $key => $argument) { $methodName = 'set' . ucfirst($key); // Check if there is a setter function for this argument if (method_exists($annotation, $methodName)) { // Set the argument using the setter
php
{ "resource": "" }
q266421
NativeAnnotationsParser.getAnnotationProperties
test
protected function getAnnotationProperties(array $matches, int $index): array { $properties = []; // Written like this to appease the code coverage gods $properties['annotation'] = $matches[1][$index] ?? null; $properties['arguments'] = $matches[2][$index] ?? null; $properties['type'] = $matches[3][$index] ??
php
{ "resource": "" }
q266422
NativeAnnotationsParser.processAnnotationProperties
test
protected function processAnnotationProperties(array $properties): array { // If the type and description exist by the variable does not // then that means the variable regex group captured the // first word of the description if ( $properties['type'] && $properties['description'] && ! $properties['variable'] ) { // Rectify this by concatenating the type and description $properties['description'] = $properties['type'] . $properties['description'];
php
{ "resource": "" }
q266423
NativeAnnotationsParser.getArguments
test
public function getArguments(string $arguments = null): ? array { $argumentsList = null; // If a valid arguments list was passed in if (null !== $arguments && $arguments) { $testArgs = str_replace('=', ':', $arguments);
php
{ "resource": "" }
q266424
NativeAnnotationsParser.determineValue
test
protected function determineValue($value) { if (\is_array($value)) { foreach ($value as &$item) { $item = $this->determineValue($item); } unset($item); return $value; } // Trim the value of spaces $value = trim($value); // If there was no double colon found there's no need to go further if (strpos($value, '::') === false) { return $value; } // Determine if the value is a constant if (\defined($value)) {
php
{ "resource": "" }
q266425
NativeAnnotationsParser.getAnnotationFromMap
test
public function getAnnotationFromMap(string $annotationType): Annotation { // Get the annotations map (annotation name to annotation class) $annotationsMap = $this->getAnnotationsMap(); // If an annotation is mapped to a class if ($annotationType && array_key_exists( $annotationType, $annotationsMap ) ) { // Set
php
{ "resource": "" }
q266426
NativeAnnotationsParser.cleanMatch
test
protected function cleanMatch(string $match = null): ? string { if (! $match) { return
php
{ "resource": "" }
q266427
Plugin.getSubscribedEvents
test
public function getSubscribedEvents() { $subscribedEvents = array(); foreach ($this->validProviders as $provider => $class) { $subscribedEvents['command.' . $provider] = 'handleCommand';
php
{ "resource": "" }
q266428
Plugin.handleCommand
test
public function handleCommand(Event $event, Queue $queue) { $provider = $this->getProvider($event->getCustomCommand()); if ($provider->validateParams($event->getCustomParams())) { $request = $this->getApiRequest($event, $queue);
php
{ "resource": "" }
q266429
Plugin.handleCommandHelp
test
public function handleCommandHelp(Event $event, Queue $queue) { $provider = $this->getProvider($event->getCustomCommand());
php
{ "resource": "" }
q266430
Plugin.getProvider
test
public function getProvider($command) { return (isset($this->validProviders[$command]))
php
{ "resource": "" }
q266431
Builder.leftJoin
test
public function leftJoin($table, $firstColumn, $operator = null, $secondColumn
php
{ "resource": "" }
q266432
Builder.rightJoin
test
public function rightJoin($table, $firstColumn, $operator = null, $secondColumn
php
{ "resource": "" }
q266433
Builder.rightJoinWhere
test
public function rightJoinWhere($table, $firstColumn, $operator, $value) {
php
{ "resource": "" }
q266434
Builder.toSql
test
public function toSql() { if ($this->type == 'insert') { return $this->grammar->compileInsert($this); } else if ($this->type == 'update') { return $this->grammar->compileUpdate($this); } else if ($this->type == 'delete') {
php
{ "resource": "" }
q266435
Builder.fetchAllColumn
test
public function fetchAllColumn() { return $this->db->fetchRows($this->toSql(),
php
{ "resource": "" }
q266436
AutoObject.setName
test
public function setName($name = null) { if (empty($name) || !is_string($name)) { throw new \InvalidArgumentException( sprintf('Object name
php
{ "resource": "" }
q266437
AutoObject.setStructure
test
public function setStructure($structure = null) { if (empty($structure) || !is_array($structure)) { throw new \InvalidArgumentException( sprintf('Object structure
php
{ "resource": "" }
q266438
AutoObject.setDatabaseName
test
public function setDatabaseName($name = null) { if (empty($name) || !is_string($name)) { throw new \InvalidArgumentException( sprintf('Object database
php
{ "resource": "" }
q266439
AutoObject.setModelName
test
public function setModelName($name = null) { if (empty($name) || !is_string($name)) { throw new \InvalidArgumentException( sprintf('Object model name is invalid! (must be a string, got "%s")', var_export($name,1))
php
{ "resource": "" }
q266440
AutoObject._buildModel
test
protected function _buildModel($auto_populate = true, $advanced_search = false) { if (\CarteBlanche\App\Loader::classExists($this->object_model_name)) { try { $this->object_model = new $this->object_model_name( $this->getTableName(), $this->getFields(), $this->getStructure(), $auto_populate, $advanced_search
php
{ "resource": "" }
q266441
AutoObject._buildFields
test
protected function _buildFields() { $db = CarteBlanche::getContainer()->get('entity_manager') ->getStorageEngine($this->getDatabaseName()); foreach ($this->getStructureEntry('structure') as $_field=>$_data) { $_f = null; if (preg_match('/^(.*)_id$/i', $_field, $matches)) { if (isset($matches[1]) && is_string($matches[1])) { $related_object = $matches[1]; if ($related_object=='parent') $related_object = $this->getTableName();
php
{ "resource": "" }
q266442
ValidationServiceProvider.registerValidationFactory
test
protected function registerValidationFactory() { $this->app->singleton('validator', function ($app) { $validator = new Factory($app['translator'], $app); // The validation presence verifier is responsible for determining the existence // of values in a given data collection, typically a relational database or
php
{ "resource": "" }
q266443
LoggerConfigLoader.load
test
public function load(): array { return [ ServiceLocatorInterface::class => [ FactoryResolver::class => [ LoggerInterface::class => LoggerFactory::class, ], StaticFactoryResolver::class => [ BacktraceDecorator::class => BacktraceDecorator::class, PriorityFilter::class => PriorityFilter::class, AlertPriority::class => AlertPriority::class, CriticalPriority::class => CriticalPriority::class,
php
{ "resource": "" }
q266444
SortableFields.targetSiteId
test
protected function targetSiteId(ElementInterface $element = null): int { /** @var Element $element */ if (Craft::$app->getIsMultiSite() === true && $element !== null) {
php
{ "resource": "" }
q266445
Relation.getParent
test
public function getParent(Record $record, $parent_table) { if ($record->getState() == Record::STATE_DELETED) { throw new Exception\LogicException(__METHOD__ . ": Logic exception, cannot operate on record that was deleted"); } $tableName = $this->table->getTableName(); $relations = $this->table->getTableManager()->metadata()->getForeignKeys($tableName); //$rels = array(); foreach ($relations as $column => $parent) { if ($parent['referenced_table'] == $parent_table) { // @todo, check the case when // table has many relations to the same parent
php
{ "resource": "" }
q266446
Collapse.renderItem
test
public function renderItem($item, $index) { $header = $item['label']; if (array_key_exists('content', $item)) { $id = $this->options['id'] . '-collapse-' . $index; $options = ArrayHelper::getValue($item, 'contentOptions', []); $options['id'] = $id; Html::addCssClass($options, ['widget' => 'collapse']); $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels; if ($encodeLabel) { $header = $this->htmlHlp->encode($header); } $headerOptions = [ 'class' => 'collapse-toggle', 'data-toggle' => 'collapse', ]; $headerToggle = $this->htmlHlp->a($header, '#' . $id, $headerOptions) . "\n"; if (is_string($item['content']) || is_numeric($item['content']) || is_object($item['content'])) {
php
{ "resource": "" }
q266447
Query.all
test
public function all($db = null) { if ($this->emulateExecution) { return new LazyPromise(function() { return resolve([]); });
php
{ "resource": "" }
q266448
Query.one
test
public function one($db = null) { if ($this->emulateExecution) { return new LazyPromise(function() { return reject(null); });
php
{ "resource": "" }
q266449
Query.column
test
public function column($db = null) { if ($this->emulateExecution) { return new LazyPromise(function() { return resolve([]); }); } if ($this->indexBy === null) { return $this->createCommand($db)->queryColumn(); } if (is_string($this->indexBy) && is_array($this->select) && count($this->select) === 1) { if (strpos($this->indexBy, '.') === false && count($tables = $this->getTablesUsedInFrom()) > 0) { $this->select[] = key($tables) . '.' . $this->indexBy; } else { $this->select[] = $this->indexBy; } } return $this->createCommand($db)->queryAll()->thenLazy( function($results) { $rows = []; foreach ($results as $row) {
php
{ "resource": "" }
q266450
Query.count
test
public function count($q = '*', $db = null) { if ($this->emulateExecution) {
php
{ "resource": "" }
q266451
Query.exists
test
public function exists($db = null) { if ($this->emulateExecution) { return reject(false); } $command = $this->createCommand($db); $params = $command->params; $command->setSql($command->db->getQueryBuilder()->selectExists($command->getSql())); $command->bindValues($params);
php
{ "resource": "" }
q266452
CallCenter.makeCall
test
public function makeCall(NamespaceProphecy $prophecy, $name, array $arguments) { // For efficiency exclude 'args' from the generated backtrace // Limit backtrace to last 3 calls as we don't use the rest $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 4); $file = $line = null; if (isset($backtrace[3]) && isset($backtrace[3]['file'])) { $file = $backtrace[3]['file']; $line = $backtrace[3]['line']; } // There are method prophecies, so it's a fake/stub. Searching prophecy for this call $matches = []; foreach ($prophecy->getProphecies() as $methodProphecy) { if ($methodProphecy->getName() !== $name) { continue; } if (0 < $score = $methodProphecy->getArgumentsWildcard()->scoreArguments($arguments)) { $matches[] = [$score, $methodProphecy]; } } // If fake/stub doesn't have method prophecy for this call - throw exception if (!count($matches)) { throw $this->createUnexpectedCallException($prophecy, $name, $arguments); } // Sort matches by their score value @usort($matches, function ($match1, $match2) {
php
{ "resource": "" }
q266453
CallCenter.findCalls
test
public function findCalls($functionName, ArgumentsWildcard $wildcard) { return array_values( array_filter($this->recordedCalls, function (Call $call) use ($wildcard, $functionName) {
php
{ "resource": "" }
q266454
PEAR_Registry.PEAR_Registry
test
function PEAR_Registry($pear_install_dir = PEAR_INSTALL_DIR, $pear_channel = false, $pecl_channel = false) { parent::PEAR(); $this->setInstallDir($pear_install_dir);
php
{ "resource": "" }
q266455
PEAR_Registry._assertStateDir
test
function _assertStateDir($channel = false) { if ($channel && $this->_getChannelFromAlias($channel) != 'pear.php.net') { return $this->_assertChannelStateDir($channel); } static $init = false; if (!file_exists($this->statedir)) { if (!$this->hasWriteAccess()) { return false; } require_once 'System.php'; if (!System::mkdir(array('-p', $this->statedir))) { return $this->raiseError("could not create directory '{$this->statedir}'"); } $init = true; } elseif (!is_dir($this->statedir)) { return $this->raiseError('Cannot create directory ' . $this->statedir . ', ' . 'it already exists and is not a directory'); } $ds = DIRECTORY_SEPARATOR; if (!file_exists($this->channelsdir)) { if (!file_exists($this->channelsdir . $ds . 'pear.php.net.reg') || !file_exists($this->channelsdir . $ds . 'pecl.php.net.reg') || !file_exists($this->channelsdir . $ds . 'doc.php.net.reg') || !file_exists($this->channelsdir
php
{ "resource": "" }
q266456
PEAR_Registry._assertChannelStateDir
test
function _assertChannelStateDir($channel) { $ds = DIRECTORY_SEPARATOR; if (!$channel || $this->_getChannelFromAlias($channel) == 'pear.php.net') { if (!file_exists($this->channelsdir . $ds . 'pear.php.net.reg')) { $this->_initializeChannelDirs(); } return $this->_assertStateDir($channel); } $channelDir = $this->_channelDirectoryName($channel); if (!is_dir($this->channelsdir) ||
php
{ "resource": "" }
q266457
PEAR_Registry._assertChannelDir
test
function _assertChannelDir() { if (!file_exists($this->channelsdir)) { if (!$this->hasWriteAccess()) { return false; } require_once 'System.php'; if (!System::mkdir(array('-p', $this->channelsdir))) { return $this->raiseError("could not create directory '{$this->channelsdir}'"); } } elseif (!is_dir($this->channelsdir)) { return $this->raiseError("could not create directory '{$this->channelsdir}" .
php
{ "resource": "" }
q266458
PEAR_Registry._channelFileName
test
function _channelFileName($channel, $noaliases = false) { if (!$noaliases) { if (file_exists($this->_getChannelAliasFileName($channel))) { $channel = implode('', file($this->_getChannelAliasFileName($channel))); }
php
{ "resource": "" }
q266459
PEAR_Registry._getChannelFromAlias
test
function _getChannelFromAlias($channel) { if (!$this->_channelExists($channel)) { if ($channel == 'pear.php.net') { return 'pear.php.net'; } if ($channel == 'pecl.php.net') { return 'pecl.php.net'; } if ($channel == 'doc.php.net') { return 'doc.php.net'; } if ($channel == '__uri') { return '__uri';
php
{ "resource": "" }
q266460
PEAR_Registry._getAlias
test
function _getAlias($channel) { if (!$this->_channelExists($channel)) { if ($channel == 'pear.php.net') { return 'pear'; } if ($channel == 'pecl.php.net') { return 'pecl'; } if ($channel == 'doc.php.net') { return 'phpdocs'; }
php
{ "resource": "" }
q266461
PEAR_Registry._lock
test
function _lock($mode = LOCK_EX) { if (stristr(php_uname(), 'Windows 9')) { return true; } if ($mode != LOCK_UN && is_resource($this->lock_fp)) { // XXX does not check type of lock (LOCK_SH/LOCK_EX) return true; } if (!$this->_assertStateDir()) { if ($mode == LOCK_EX) { return $this->raiseError('Registry directory is not writeable by the current user'); } return true; } $open_mode = 'w'; // XXX People reported problems with LOCK_SH and 'w' if ($mode === LOCK_SH || $mode === LOCK_UN) { if (!file_exists($this->lockfile)) { touch($this->lockfile); } $open_mode = 'r'; } if (!is_resource($this->lock_fp)) { $this->lock_fp = @fopen($this->lockfile, $open_mode); } if (!is_resource($this->lock_fp)) { $this->lock_fp = null; return $this->raiseError("could not create lock file" .
php
{ "resource": "" }
q266462
PEAR_Registry._channelExists
test
function _channelExists($channel, $noaliases = false) { $a = file_exists($this->_channelFileName($channel, $noaliases)); if (!$a && $channel == 'pear.php.net') { return true; } if (!$a &&
php
{ "resource": "" }
q266463
PEAR_Registry._mirrorExists
test
function _mirrorExists($channel, $mirror) { $data = $this->_channelInfo($channel); if (!isset($data['servers']['mirror'])) { return false; } foreach ($data['servers']['mirror'] as $m) {
php
{ "resource": "" }
q266464
PEAR_Registry.isAlias
test
function isAlias($alias) { if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
php
{ "resource": "" }
q266465
PEAR_Registry.channelInfo
test
function channelInfo($channel = null, $noaliases = false) { if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
php
{ "resource": "" }
q266466
PEAR_Registry.updateChannel
test
function updateChannel($channel, $lastmodified = null) { if ($channel->getName() == '__uri')
php
{ "resource": "" }
q266467
ClosureFilter.matches
test
public function matches(array $data) { return (isset($data[$this->property]) &&
php
{ "resource": "" }
q266468
Wysiwyg.tinyMCEfile
test
public function tinyMCEfile() { $reflector = new \ReflectionClass('Jin2\Form\Components\Wysiwyg'); $tinyMCEUrl = dirname($reflector->getFileName()); $tinyMCEUrl .= '..' . DIRECTORY_SEPARATOR .'..' . DIRECTORY_SEPARATOR .'..' . DIRECTORY_SEPARATOR .'..' . DIRECTORY_SEPARATOR .'assets' . DIRECTORY_SEPARATOR. 'wysiwyg'; $tinyMCEUrl = preg_replace('#^.*(\\'. DIRECTORY_SEPARATOR
php
{ "resource": "" }
q266469
Str.InitWith
test
public static function InitWith($value) { $instance = new Str(); $instance->value = $value;
php
{ "resource": "" }
q266470
BaseController.getEntityManager
test
public function getEntityManager($name = null) { $entityManager = $this->getDoctrine()->getManager($name); if (!$entityManager->isOpen()) {
php
{ "resource": "" }
q266471
InterfaceResolver.resolve
test
public function resolve($className) { $trimmed = ltrim($className, '\\');
php
{ "resource": "" }
q266472
Validator.validateHashesTo
test
public function validateHashesTo($attribute, $value, $parameters) { $this->requireParameterCount(1, $parameters, 'hashes_to');
php
{ "resource": "" }
q266473
Validator.validateRouteExists
test
public function validateRouteExists($attribute, $value, $parameters) { $method = 'getBy' . studly_case(isset($parameters[0]) ? $parameters[0] : 'name');
php
{ "resource": "" }
q266474
AssetsInstallCommand._hardCopy
test
private function _hardCopy($originDir, $targetDir) { $filesystem = $this->getApplication()->getService('filesystem'); $filesystem->mkdir($targetDir, 0777);
php
{ "resource": "" }
q266475
Button.init
test
public function init() { parent::init(); $this->clientOptions = false;
php
{ "resource": "" }
q266476
Dt.getNextDay
test
public static function getNextDay($dt, $format = "Y-m-d") { $dtObj = \DateTime::createFromFormat($format, $dt); if (!$dtObj) { return ""; }
php
{ "resource": "" }
q266477
Dt.getPrevDay
test
public static function getPrevDay($dt, $format = "Y-m-d") { $dtObj = \DateTime::createFromFormat($format, $dt); if (!$dtObj) { return ""; }
php
{ "resource": "" }
q266478
Dt.createDateRande
test
public static function createDateRande($from, $amount, $dtFormat='Y-m-d') { $range = [ $from ]; $curDt = $from;
php
{ "resource": "" }
q266479
FileHelperAsc.file
test
public static function file(&$filePath) { $filePath = \Reaction::$app->getAlias($filePath); $filePath
php
{ "resource": "" }
q266480
FileHelperAsc.dir
test
public static function dir(&$dirPath) { $dirPath = \Reaction::$app->getAlias($dirPath); $dirPath
php
{ "resource": "" }
q266481
FileHelperAsc.open
test
public static function open($filePath, $flags = 'r') { $file = static::ensureFileObject($filePath); $createMode
php
{ "resource": "" }
q266482
FileHelperAsc.create
test
public static function create($filePath, $mode = null, $time = null) { $mode = isset($mode) ? $mode : static::$fileCreateMode; $modeStr = static::permissionsAsString($mode);
php
{ "resource": "" }
q266483
FileHelperAsc.putContents
test
public static function putContents($filePath, $contents, $openFlags = 'cwt', $lock = true, $createMode = null) { $lockTimeout = is_int($lock) && !empty($lock) ? $lock : null; $lock = !empty($lock); $file = static::ensureFileObject($filePath); $createMode = isset($createMode) ? $createMode : static::$fileCreateMode; $createModeStr = FileHelper::permissionsAsString($createMode); $unlockCallback = function ($result = null) use ($filePath, $lock) { if ($lock) { static::unlock($filePath); } if (is_object($result) && $result instanceof \Throwable) { throw $result; } return $result; }; return static::onUnlock($filePath) ->then(function() use (&$file, $filePath, $lockTimeout, $openFlags, $createModeStr, $lock) {
php
{ "resource": "" }
q266484
FileHelperAsc.getContents
test
public static function getContents($filePath, $lock = true) { $lockTimeout = is_int($lock) && !empty($lock) ? $lock : null; $lock = !empty($lock); $file = static::ensureFileObject($filePath); $unlockCallback = function ($result = null) use ($lock, $filePath) { if ($lock) { static::unlock($filePath); } if (is_object($result) && $result instanceof \Throwable) { throw $result; } return $result; }; return static::onUnlock($filePath)->then(
php
{ "resource": "" }
q266485
FileHelperAsc.chmod
test
public static function chmod($path, $mode = 0755) { if ($path instanceof GenericOperationInterface) {
php
{ "resource": "" }
q266486
FileHelperAsc.lock
test
public static function lock($filePath, $timeout = null) { $filePath = FileHelper::normalizePath($filePath); $timeout = isset($timeout) ? $timeout : static::$LockTimeout; $expire = time()
php
{ "resource": "" }
q266487
FileHelperAsc.onUnlock
test
public static function onUnlock($filePath) { $filePath = FileHelper::normalizePath($filePath); if (!static::isLocked($filePath)) { return resolve(true); } $deferred = new Deferred(); if (!isset(static::$_lockedFilesQueue[$filePath])) {
php
{ "resource": "" }
q266488
FileHelperAsc.ensureFileObject
test
protected static function ensureFileObject(&$pathOrObject) { if ($pathOrObject instanceof FileInterface) { return $pathOrObject; } elseif ($pathOrObject instanceof DirectoryInterface) { return static::file($pathOrObject->getPath());
php
{ "resource": "" }
q266489
FileHelperAsc.ensureDirObject
test
protected static function ensureDirObject(&$pathOrObject) { if ($pathOrObject instanceof DirectoryInterface) { return $pathOrObject; } elseif ($pathOrObject instanceof FileInterface) { return
php
{ "resource": "" }
q266490
FileHelperAsc.checkUnlockTimer
test
protected static function checkUnlockTimer() { if (static::$_unlockTimer instanceof TimerInterface) { return; } static::$_unlockTimer = \Reaction::$app->loop->addPeriodicTimer(1, function () { $now = time(); foreach (static::$_lockedFiles as $filePath => $timeout)
php
{ "resource": "" }
q266491
Request.globals
test
public static function globals() { static $globals; if(!$globals) { $globals = new static(Uri::current()); $globals->servers = &$_SERVER; $globals->envs = &$_ENV; $globals->values = &$_POST; $globals->cookies = &$_COOKIE; $globals->accept = Request\Accept::from( $globals->server('HTTP_ACCEPT'), $globals->server('HTTP_ACCEPT_LANGUAGE'), $globals->server('HTTP_ACCEPT_ENCODING'), $globals->server('HTTP_ACCEPT_CHARSET') ); $globals->method = $globals->server('REQUEST_METHOD'); $globals->secure = ($globals->server('HTTPS') == 'on'); $globals->ajax = $globals->server('HTTP_X_REQUESTED_WITH')
php
{ "resource": "" }
q266492
ThemeSectionBase.render
test
public function render() { if (!file_exists($this->template)): throw new \Exception("Template of section is not defined."); endif;
php
{ "resource": "" }
q266493
JoinClause.on
test
public function on($firstColumn, $operator, $secondColumn, $boolean = 'and', $where = false) { if ($where) $this->bindings[] = $secondColumn; if ($where &&
php
{ "resource": "" }
q266494
JoinClause.where
test
public function where($firstColumn, $operator, $secondColumn, $boolean = 'and') {
php
{ "resource": "" }
q266495
JoinClause.whereNull
test
public function whereNull($column, $boolean = 'and', $not = false) {
php
{ "resource": "" }
q266496
HelperArrayCasterTrait.arrayToCollection
test
public function arrayToCollection(array $source, $collectionClass) { $manager = $this->manager; if ($manager instanceof ArrayCasterManagerInterface) { return $manager->process($source, $collectionClass); }
php
{ "resource": "" }
q266497
MoveSpec.it_could_be_normal
test
public function it_could_be_normal() { $this->isNormal()->shouldBeBool(); $this->isNormal()->shouldBe(true);
php
{ "resource": "" }
q266498
SessionArchiveInDb.getInternal
test
protected function getInternal($id, $unserialize = true) { return $this->selectQuery()->where(['sid' => $id]) ->one($this->db) ->then(function($row) use ($unserialize) {
php
{ "resource": "" }
q266499
SessionArchiveInDb.updateInternal
test
protected function updateInternal($row, $existingRow = null) { $equal = isset($existingRow) && isset($existingRow['data']) && $row['data'] === $existingRow['data']; $id = $row['sid']; unset($row['sid']); //If data not changed then just update timestamp if ($equal) {
php
{ "resource": "" }