_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q267500
NativeRouteAnnotations.getClassRoutes
test
protected function getClassRoutes(array $classes): array { /** @var \Valkyrja\Routing\Route[] $routes */ $routes = []; // Iterate through all the classes foreach ($classes as $class) { $annotations = $this->classMembersAnnotationsType( $this->routeAnnotat...
php
{ "resource": "" }
q267501
NativeRouteAnnotations.getControllerBuiltRoute
test
protected function getControllerBuiltRoute(Route $controllerRoute, Route $route): Route { $newRoute = clone $route; // If there is a base path for this controller if (null !== $controllerRoute->getPath()) { // Get the route's path $path = $this->validatePat...
php
{ "resource": "" }
q267502
NativeRouteAnnotations.getRouteFromAnnotation
test
protected function getRouteFromAnnotation(Route $route): RouterRoute { $routerRoute = new RouterRoute(); $routerRoute ->setPath($route->getPath()) ->setRegex($route->getRegex()) ->setParams($route->getParams()) ->setSegments($route->getSegments()) ...
php
{ "resource": "" }
q267503
NativeRouteAnnotations.publish
test
public static function publish(Application $app): void { $app->container()->singleton( RouteAnnotations::class, new static( $app->container()->getSingleton(AnnotationsParser::class) ) ); }
php
{ "resource": "" }
q267504
JsonResponseFormatter.formatJson
test
protected function formatJson($response) { $bodyRaw = $response->getRawBody(); if ($bodyRaw !== null) { $options = $this->encodeOptions; if ($this->prettyPrint) { $options |= JSON_PRETTY_PRINT; } return $response->app instanceof Reactio...
php
{ "resource": "" }
q267505
JsonResponseFormatter.formatJsonp
test
protected function formatJsonp($response) { $bodyRaw = $response->getRawBody(); if (is_array($bodyRaw) && isset($bodyRaw['data'], $bodyRaw['callback']) ) { $data = $response->app instanceof Reaction\RequestApplicationInterface ? $response->app->helpers...
php
{ "resource": "" }
q267506
NativeUri.getHostPort
test
public function getHostPort(): string { $host = $this->getHost(); if ($host && $port = $this->getPort()) { $host .= ':' . $port; } return $host; }
php
{ "resource": "" }
q267507
NativeUri.getSchemeHostPort
test
public function getSchemeHostPort(): string { $hostPort = $this->getHostPort(); $scheme = $this->getScheme(); return $hostPort && $scheme ? $scheme . '://' . $hostPort : $hostPort; }
php
{ "resource": "" }
q267508
NativeUri.withHost
test
public function withHost(string $host): Uri { if ($host === $this->host) { return clone $this; } $new = clone $this; $new->host = $host; return $new; }
php
{ "resource": "" }
q267509
NativeUri.withPort
test
public function withPort(int $port = null): Uri { if ($port === $this->port) { return clone $this; } $this->validatePort($port); $new = clone $this; $new->port = $port; return $new; }
php
{ "resource": "" }
q267510
NativeUri.withPath
test
public function withPath(string $path): Uri { if ($path === $this->path) { return clone $this; } $path = $this->validatePath($path); $new = clone $this; $new->path = $path; return $new; }
php
{ "resource": "" }
q267511
NativeUri.withQuery
test
public function withQuery(string $query): Uri { if ($query === $this->query) { return clone $this; } $query = $this->validateQuery($query); $new = clone $this; $new->query = $query; return $new; }
php
{ "resource": "" }
q267512
NativeUri.withFragment
test
public function withFragment(string $fragment): Uri { if ($fragment === $this->fragment) { return clone $this; } $fragment = $this->validateFragment($fragment); $new = clone $this; $new->fragment = $fragment; return $new; }
php
{ "resource": "" }
q267513
NativeUri.isStandardPort
test
protected function isStandardPort(): bool { if (! $this->scheme) { return $this->host && ! $this->port; } if (! $this->host || ! $this->port) { return true; } return (static::HTTP_SCHEME === $this->scheme && $this->port === static::HTTP_PORT) ...
php
{ "resource": "" }
q267514
NativeUri.validateScheme
test
protected function validateScheme(string $scheme): string { $scheme = strtolower($scheme); $scheme = (string) preg_replace('#:(//)?$#', '', $scheme); if (! $scheme) { return ''; } if (static::HTTP_SCHEME !== $scheme || $scheme !== static::HTTPS_SCHEME) { ...
php
{ "resource": "" }
q267515
NativeUri.validatePort
test
protected function validatePort(int $port = null): void { if ($port !== null && ($port < 1 || $port > 65535)) { throw new InvalidPort( sprintf( 'Invalid port "%d" specified; must be a valid TCP/UDP port', $port ) ...
php
{ "resource": "" }
q267516
PEAR_Dependency2.validatePackage
test
function validatePackage($pkg, &$dl, $params = array()) { if (is_array($pkg) && isset($pkg['info'])) { $deps = $this->_dependencydb->getDependentPackageDependencies($pkg['info']); } else { $deps = $this->_dependencydb->getDependentPackageDependencies($pkg); } ...
php
{ "resource": "" }
q267517
PEAR_Dependency2.validateDependency1
test
function validateDependency1($dep, $params = array()) { if (!isset($dep['optional'])) { $dep['optional'] = 'no'; } list($newdep, $type) = $this->normalizeDep($dep); if (!$newdep) { return $this->raiseError("Invalid Dependency"); } if (method_...
php
{ "resource": "" }
q267518
PEAR_Dependency2.normalizeDep
test
function normalizeDep($dep) { $types = array( 'pkg' => 'Package', 'ext' => 'Extension', 'os' => 'Os', 'php' => 'Php' ); if (!isset($types[$dep['type']])) { return array(false, false); } $type = $types[$dep['type']]...
php
{ "resource": "" }
q267519
Backbone.addOrRemoveS
test
public static function addOrRemoveS($word) { $arrayOfCharInTable = str_split($word); if ($arrayOfCharInTable[count($arrayOfCharInTable) - 1] === 's') { array_pop($arrayOfCharInTable); $word = implode($arrayOfCharInTable); } else { $word .= 's'; } ...
php
{ "resource": "" }
q267520
Backbone.tokenize
test
public static function tokenize($string, $delimiter) { $result = ''; $token = strtok($string, $delimiter); $result .= $token; while ($token) { $token = strtok($delimiter); $result .= ',' . $token; } return chop($result, ','); }
php
{ "resource": "" }
q267521
Backbone.joinKeysAndValuesOfArray
test
public static function joinKeysAndValuesOfArray(array $record) { $temp = []; for ($i = 1; $i < count($record); $i++) { $value = array_values($record)[$i]; if (is_null($value)) { $value = 'NULL'; } else { $value = "'" . $value . "'"...
php
{ "resource": "" }
q267522
Backbone.checkForTable
test
public static function checkForTable($table, $dbConn = NULL) { if (is_null($dbConn)) { $dbConn = self::makeDbConn(); } try { $result = $dbConn->query('SELECT 1 FROM ' . $table . ' LIMIT 1'); } catch (\PDOException $e) { return false; } finally { $d...
php
{ "resource": "" }
q267523
Backbone.mapClassToTable
test
public static function mapClassToTable($className, $dbConn = NULL) { $demarcation = strrpos($className, '\\', -1); if ($demarcation !== false) { $table = strtolower(substr($className, $demarcation + 1)); } else { $table = strtolower($className); } if (is_n...
php
{ "resource": "" }
q267524
Backbone.getTable
test
public static function getTable($className, $dbConn = NULL) { if (is_null($dbConn)) { $dbConn = self::makeDbConn(); } try { $table = self::mapClassToTable($className, $dbConn); } catch (TableDoesNotExistException $e) { return $e->message(); } return $...
php
{ "resource": "" }
q267525
FileCommentSniff.processVersion
test
protected function processVersion($errorPos) { $version = $this->commentParser->getVersion(); if ($version !== null) { $content = $version->getContent(); $matches = array(); if (empty($content) === true) { $error = 'Content missing for @version tag...
php
{ "resource": "" }
q267526
PEAR_Command_Channels.doDiscover
test
function doDiscover($command, $options, $params) { if (count($params) !== 1) { return $this->raiseError("No channel server specified"); } // Look for the possible input format "<username>:<password>@<channel>" if (preg_match('/^(.+):(.+)@(.+)\\z/', $params[0], $matches))...
php
{ "resource": "" }
q267527
PEAR_Command_Channels.doLogin
test
function doLogin($command, $options, $params) { $reg = &$this->config->getRegistry(); // If a parameter is supplied, use that as the channel to log in to $channel = isset($params[0]) ? $params[0] : $this->config->get('default_channel'); $chan = $reg->getChannel($channel); i...
php
{ "resource": "" }
q267528
PEAR_Command_Channels.doLogout
test
function doLogout($command, $options, $params) { $reg = &$this->config->getRegistry(); // If a parameter is supplied, use that as the channel to log in to $channel = isset($params[0]) ? $params[0] : $this->config->get('default_channel'); $chan = $reg->getChannel($channel); ...
php
{ "resource": "" }
q267529
Zend_Filter_Word_SeparatorToSeparator._separatorToSeparatorFilter
test
protected function _separatorToSeparatorFilter($value) { if ($this->_searchSeparator == null) { throw new Zend_Filter_Exception('You must provide a search separator for this filter to work.'); } $this->setMatchPattern('#' . preg_quote($this->_searchSeparator, '#') . '#'); ...
php
{ "resource": "" }
q267530
MigrateCommand.getMigrationFiles
test
protected function getMigrationFiles($migrationPath) { $files = array(); $handle = opendir($migrationPath); while(false !== $file = readdir($handle)) { if($file === '.' || $file === '..') { continue; } $path = $migrationPath . DIRECTORY_SEPARAT...
php
{ "resource": "" }
q267531
MigrateCommand.getMigrationToFileMap
test
protected function getMigrationToFileMap() { if (null === $this->_migrationToFileMap) { $files = array(); $this->msg('Load application migrations from ' . $this->migrationPath); $paths = array( $this->migrationPath, ); if (!$this->modu...
php
{ "resource": "" }
q267532
BaseModelAbility.publishMethod
test
protected function publishMethod($methodName, $isStatic = false) { if ($isStatic) { $this->_publishedStaticMethods[$methodName] = array(); } else { $this->_publishedMethods[$methodName] = array(); } }
php
{ "resource": "" }
q267533
Request.send
test
public function send($url, $curled = true) { $this->setUrl($url); $result = ($this->isCurlExists() && $curled === true) ? $this->curl() : $this->simple(); return $this->interpretResponse($result); }
php
{ "resource": "" }
q267534
Request.checkUrl
test
private function checkUrl(&$url) { if ( ! is_string($url)) { throw new InvalidUrlException( 'The url must be a string value, ' . gettype($url) . ' given' ); } $url = trim($url); if (empty($url)) { throw new InvalidUrlException('Th...
php
{ "resource": "" }
q267535
DirectoryTransformer.reverseTransform
test
public function reverseTransform($value) { if (is_null($value)) { return null; } $dir = $this->objectManager->getRepository('CoreBundle:Directory') ->find($value); if ($dir === null) { throw new TransformationFailedException("The d...
php
{ "resource": "" }
q267536
AppBuilderFactory.createAppBuilder
test
public function createAppBuilder($contextName, $appRootPath) { list($fileSystem, $containerBuilder, $appPath) = $this->getAppBuilderDependencies($appRootPath); return new AppBuilder($fileSystem, $appPath, $containerBuilder, $contextName); }
php
{ "resource": "" }
q267537
AppBuilderFactory.createAppBuilderFromPersisted
test
public function createAppBuilderFromPersisted(IContainerBuilderPersister $persister, $contextName, $appRootPath) { $fileSystem = new FileSystem(); $appPath = new AppPath($fileSystem, $appRootPath); $containerBuilder = $persister->loadContainerBuilder(); return new App...
php
{ "resource": "" }
q267538
AppBuilderFactory.getAppBuilderDependencies
test
protected function getAppBuilderDependencies($appRootPath) { $fileSystem = new FileSystem(); $containerBuilder = new ContainerBuilder(); $appPath = new AppPath($fileSystem, $appRootPath); return array( $fileSystem, $containerBuilder, ...
php
{ "resource": "" }
q267539
GitHandler.reset
test
public function reset($file) { if (is_file($file)) { $cmd = 'cd %s && git checkout HEAD -- %s'; $this->systemLog(sprintf($cmd, $this->projectPath, $file)); } }
php
{ "resource": "" }
q267540
GitHandler.createBranch
test
public function createBranch($branch) { $cmd = 'cd %s && git checkout -b %s && git add .'; $this->systemLog(sprintf($cmd, $this->projectPath, $branch)); }
php
{ "resource": "" }
q267541
GitHandler.deleteBranch
test
public function deleteBranch($branch) { $cmd = 'cd %s && git checkout master && git branch -D %s'; $this->systemLog(sprintf($cmd, $this->projectPath, $branch)); }
php
{ "resource": "" }
q267542
GitHandler.pushBranch
test
public function pushBranch($branch) { $cmd = 'cd %s && git push origin %s'; $this->systemLog(sprintf($cmd, $this->projectPath, $branch)); }
php
{ "resource": "" }
q267543
GitHandler.createPullRequest
test
public function createPullRequest($headBranch, $baseBranch = 'master') { /** @var PullRequest $api */ $api = $this->githubClient->api('pull_request'); $api->create($this->organization, $this->project, array( 'base' => $baseBranch, 'head' => sprintf('%s:%s', ...
php
{ "resource": "" }
q267544
GitHandler.cloneProject
test
public function cloneProject() { $origin = sprintf('git@github.com:%s/%s.git', $this->username, $this->project); $upstream = sprintf('https://github.com/%s/%s.git', $this->organization, $this->project); $this->systemLog(sprintf('git clone %s %s', $origin, $this->projectPath)); $this...
php
{ "resource": "" }
q267545
PEAR_Builder.phpizeCallback
test
function phpizeCallback($what, $data) { if ($what != 'cmdoutput') { return; } $this->log(1, rtrim($data)); if (preg_match('/You should update your .aclocal.m4/', $data)) { return; } $matches = array(); if (preg_match('/^\s+(\S[^:]+):\s+...
php
{ "resource": "" }
q267546
PEAR_Builder._runCommand
test
function _runCommand($command, $callback = null) { $this->log(1, "running: $command"); $pp = popen("$command 2>&1", "r"); if (!$pp) { return $this->raiseError("failed to run `$command'"); } if ($callback && $callback[0]->debug == 1) { $olddbg = $callba...
php
{ "resource": "" }
q267547
ApiUser.connect
test
public function connect(array $clientCredentials) { $endPoints = array_filter([ 'request' => $this->urlRequest, 'authorize' => $this->urlAuthorize, 'access' => $this->urlAccess, ]); $auth = $this->newAuth(); $data = $auth::connect($clientCred...
php
{ "resource": "" }
q267548
Zend_Filter_File_Rename.addFile
test
public function addFile($options) { if (is_string($options)) { $options = array('target' => $options); } elseif (!is_array($options)) { throw new Zend_Filter_Exception ('Invalid options to rename filter provided'); } $this->_convertOptions($options); ...
php
{ "resource": "" }
q267549
Zend_Filter_File_Rename.getNewName
test
public function getNewName($value, $source = false) { $file = $this->_getFileName($value); if ($file['source'] == $file['target']) { return $value; } if (!file_exists($file['source'])) { return $value; } if (($file['overwrite'] == true) && (f...
php
{ "resource": "" }
q267550
Zend_Filter_File_Rename._getFileName
test
protected function _getFileName($file) { $rename = array(); foreach ($this->_files as $value) { if ($value['source'] == '*') { if (!isset($rename['source'])) { $rename = $value; $rename['source'] = $file; }...
php
{ "resource": "" }
q267551
Container.get
test
public function get($id) { $id = strtolower($id); $isAlias = false; if (array_key_exists($id, $this->aliases)) { $id = $this->aliases[$id]; $isAlias = true; } if (!array_key_exists($id, $this->serviceDefinitions)) { if (array_key_exists($...
php
{ "resource": "" }
q267552
Container.generateService
test
protected function generateService($definition) { $reflection = new \ReflectionClass($definition->getClass()); $arguments = $definition->getArguments(); $properties = $definition->getProperties(); $calls = $definition->getCalls(); if (count($arguments) > 0) { for...
php
{ "resource": "" }
q267553
Container.set
test
public function set($id, $service) { $id = strtolower($id); $this->services[$id] = $service; return $this; }
php
{ "resource": "" }
q267554
Container.setAlias
test
public function setAlias($aliasId, $id) { $this->aliases[strtolower($aliasId)] = strtolower($id); return $this; }
php
{ "resource": "" }
q267555
Container.getParameter
test
public function getParameter($id) { $id = strtolower($id); if (array_key_exists($id, $this->parameters)) { return $this->parameters[$id]; } return null; }
php
{ "resource": "" }
q267556
Container.setParameter
test
public function setParameter($id, $value) { $id = strtolower($id); $this->parameters[$id] = $value; return $this; }
php
{ "resource": "" }
q267557
Container.getDefinition
test
public function getDefinition($id) { $id = strtolower($id); if (array_key_exists($id, $this->aliases)) { $id = $this->aliases[$id]; } if (array_key_exists($id, $this->serviceDefinitions)) { return $this->serviceDefinitions[$id]; } throw new ...
php
{ "resource": "" }
q267558
Container.setDefinition
test
public function setDefinition($id, Definition $definition) { $id = strtolower($id); $this->serviceDefinitions[$id] = $definition; return $this; }
php
{ "resource": "" }
q267559
DrushTask.init
test
public function init() { // Get default root, uri and binary from project. $this->root = $this->getProject()->getProperty('drush.root'); $this->uri = $this->getProject()->getProperty('drush.uri'); $this->bin = $this->getProject()->getProperty('drush.bin'); $this->dir = $this-...
php
{ "resource": "" }
q267560
CommandEvent.fromEvent
test
public function fromEvent(UserEventInterface $event) { // EventInterface $this->setMessage($event->getMessage()); $this->setConnection($event->getConnection()); $this->setParams($event->getParams()); $this->setCommand($event->getCommand()); // UserEventInterface ...
php
{ "resource": "" }
q267561
Cacheable.tableToArray
test
public static function tableToArray() { $me = new static(); $cache_key = $me->cacheKey(); // Return the array from the cache if it is present. if (Cache::has($cache_key)) { return (array) Cache::get($cache_key); } // Otherwise put the results into...
php
{ "resource": "" }
q267562
IsSerialized.isSerialized
test
function isSerialized(): bool { // Empty strings cannot get unserialized if (strlen($this->string) <= 1) { return false; } // Serialized false, return true. unserialize() returns false on an // invalid string or it could return false if the string is serialized ...
php
{ "resource": "" }
q267563
CallbackPrediction.check
test
public function check(array $calls, FunctionProphecy $prophecy) { $callback = $this->callback; call_user_func($callback, $calls, $prophecy); }
php
{ "resource": "" }
q267564
RouterAbstract.addRoute
test
public function addRoute($httpMethod, $route, $handler) { $route = $this->groupCurrent . $route; $this->routes[] = [ 'httpMethod' => $httpMethod, 'route' => $route, 'handler' => $handler, ]; }
php
{ "resource": "" }
q267565
RouterAbstract.initRoutes
test
public function initRoutes() { $classNames = ClassFinderHelper::findClassesPsr4($this->controllerNamespaces, true); foreach ($classNames as $className) { $this->registerController($className); } }
php
{ "resource": "" }
q267566
RouterAbstract.createControllerInstance
test
protected function createControllerInstance($controllerName, $actionId = null, $config = []) { if (!isset($controllerName)) { return [null, $actionId]; } elseif ($controllerName instanceof ControllerInterface) { $controller = $controllerName; if (!isset($actionId)...
php
{ "resource": "" }
q267567
RouterAbstract.registerController
test
protected function registerController($className) { $_className = is_string($className) ? $className : get_class($className); if (in_array($_className, $this->controllers)) { return; } $this->controllers[] = $_className; $classAnnotations = Reaction::$annotations->get...
php
{ "resource": "" }
q267568
RouterAbstract.registerControllerWithAnnotations
test
protected function registerControllerWithAnnotations($className, Ctrl $ctrlAnnotation) { $actions = (new \ReflectionClass($className))->getMethods(\ReflectionMethod::IS_PUBLIC); $actions = array_filter($actions, function($value) { return $value->name !== 'actions' && strpos($value->name, 'ac...
php
{ "resource": "" }
q267569
RouterAbstract.registerControllerNoAnnotations
test
protected function registerControllerNoAnnotations($className) { /** @var Controller $controller */ $controller = new $className(); $routes = $controller->routes(); $group = $controller->group(); if (empty($routes)) { return; } foreach ($routes as $row...
php
{ "resource": "" }
q267570
RouterAbstract.getDefaultControllerAndAction
test
protected function getDefaultControllerAndAction($config = []) { $controller = $action = null; if (isset($this->defaultController)) { /** @var ControllerInterface $controller */ $configDefault = is_array($this->defaultController) ? $this->defaultController : ['class' => $this...
php
{ "resource": "" }
q267571
LifeCyclableTrait.registerObserver
test
public function registerObserver(ObservedInterface $observed): LifeCyclableInterface { $this->observedList[\spl_object_hash($observed)] = $observed; return $this; }
php
{ "resource": "" }
q267572
LifeCyclableTrait.unregisterObserver
test
public function unregisterObserver(ObservedInterface $observed): LifeCyclableInterface { $observedHash = \spl_object_hash($observed); if (isset($this->observedList[$observedHash])) { unset($this->observedList[$observedHash]); } return $this; }
php
{ "resource": "" }
q267573
ControlChannel.autoSetChannel
test
private function autoSetChannel($basename) { $channel = sprintf($basename, $this->client->getId()); $this->setChannel($channel); }
php
{ "resource": "" }
q267574
ControlChannel.executeCommand
test
private function executeCommand($command) { if ( !is_array($command) || !isset($command['command']) ) { return $this->returnError('Malformed command received.'); } switch ($command['command']) { case 'journal': return $this->commandJournal($command); case...
php
{ "resource": "" }
q267575
Controller.addFlash
test
protected function addFlash($message, $type = 'info') { if (!in_array($type, ['info', 'success', 'warning', 'danger'])) { throw new \InvalidArgumentException(sprintf('Invalid flash type "%s".', $type)); } $this->getFlashBag()->add($type, $message); }
php
{ "resource": "" }
q267576
Controller.redirectToReferer
test
protected function redirectToReferer($defaultPath) { if (null !== $request = $this->get('request_stack')->getCurrentRequest()) { if (0 < strlen($referer = $request->headers->get('referer'))) { return $this->redirect($referer); } } return $this->redirec...
php
{ "resource": "" }
q267577
Controller.configureSharedCache
test
protected function configureSharedCache(Response $response, array $tags = [], $smaxage = null) { if (!empty($tags)) { $this->get('ekyna_core.cache.tag_manager')->addTags($tags); } $smaxage = intval($smaxage); if (0 >= $smaxage) { $smaxage = $this->container->g...
php
{ "resource": "" }
q267578
ImageMePlugin.init
test
public function init() { // Ugh...PHP 5.3, you're killin' me. $that = $this; // Get me an image! $this->bot->onChannel('/^!(?:img|image) (.+)$/i', function(Event $event) use ($that) { $matches = $event->getMatches(); if ($img = $that->getImage(trim($matches[0...
php
{ "resource": "" }
q267579
Route.finalize
test
public function finalize() { if ($this->finalized) { return; } $befores = []; $afters = []; foreach ($this->getGroups() as $group) { $befores = array_merge($befores, $group->before()); $afters = array_merge($group->after(), $afters); ...
php
{ "resource": "" }
q267580
Extension.getConfigurationDirectory
test
protected function getConfigurationDirectory() { $reflector = new \ReflectionClass($this); $fileName = $reflector->getFileName(); if (!is_dir($directory = realpath(dirname($fileName) . $this->configDirectory))) { throw new \Exception(sprintf('The configuration directory "%s" doe...
php
{ "resource": "" }
q267581
NoCallsPrediction.check
test
public function check(array $calls, FunctionProphecy $prophecy) { if (!count($calls)) { return; } $verb = count($calls) === 1 ? 'was' : 'were'; throw new UnexpectedCallsException(sprintf( "No calls expected that match:\n". " %s(%s)\n". ...
php
{ "resource": "" }
q267582
ConnectionFactory.getConnection
test
static function getConnection($forceNewConnection = false){ if(self::$connection == null || $forceNewConnection){ $connectionImpl = Settings::getSettings('php-platform/persist','connection-class'); $connectionImplReflectionClass = new \ReflectionClass($connectionImpl); $connectionImplInterfaces = $connection...
php
{ "resource": "" }
q267583
EkynaCoreExtension.configureStfalconTinymceBundle
test
protected function configureStfalconTinymceBundle(ContainerBuilder $container, array $config, array $bundles) { $tinymceConfig = new TinymceConfiguration(); $container->prependExtensionConfig('stfalcon_tinymce', $tinymceConfig->build($config, $bundles)); }
php
{ "resource": "" }
q267584
TP_Editor_Capabilities.set_capabilities
test
function set_capabilities() { $editor = get_role( 'editor' ); $editor->add_cap( 'list_users' ); $editor->add_cap( 'remove_users' ); $editor->add_cap( 'add_users' ); $editor->add_cap( 'promote_users' ); $editor->add_cap( 'create_users' ); $editor->add_cap( 'delete_users' ); $editor->add_cap( 'edit_users...
php
{ "resource": "" }
q267585
WindowsLocatorFactory.create
test
public function create(Environment $environment = null) { return $this->createFromPath( $environment ? $environment->getenv('PATH') : getenv('PATH'), $environment ? $environment->getenv('PATHEXT') : getenv('PATHEXT') ); }
php
{ "resource": "" }
q267586
WindowsLocatorFactory.createFromPath
test
public function createFromPath($path, $pathext) { $paths = array_merge(['.'], array_filter(explode(';', $path))); $extensions = array_merge([''], array_filter(explode(';', $pathext))); return new Locator(new WindowsPathBuilder($paths, $extensions)); }
php
{ "resource": "" }
q267587
AbstractConstants.getChoices
test
public static function getChoices() { $choices = []; foreach (static::getConfig() as $constant => $config) { $choices[$constant] = $config[0]; } return $choices; }
php
{ "resource": "" }
q267588
AbstractConstants.isValid
test
public static function isValid($constant, $throwException = false) { if (array_key_exists($constant, static::getConfig())) { return true; } if ($throwException) { throw new \InvalidArgumentException(sprintf('Unknown constant "%s"', $constant)); } ret...
php
{ "resource": "" }
q267589
TypeCheck.doCheck
test
public static function doCheck() { $backtrace = debug_backtrace(); $functionArguments = $backtrace[1]['args']; $functionName = $backtrace[1]['function']; $doChecks = func_get_args(); unset($backtrace); array_walk( $functionArguments...
php
{ "resource": "" }
q267590
TypeCheck.checkValue
test
public static function checkValue($value, $type) { $validator = is_callable($type) ? $type : (isset(self::$validators[$type]) ? self::$validators[$type] : null); if (!is_null($value)) { return call_user_func($validator, $value); } return false; }
php
{ "resource": "" }
q267591
PDO.getAdapter
test
public static function getAdapter(\PDO $pdo) { $driver = new Driver\Pdo\Pdo($pdo); $adapter = new Adapter($driver); return $adapter; }
php
{ "resource": "" }
q267592
jWSDL._createPath
test
private function _createPath(){ $config = jApp::config(); //Check module availability if(!isset($config->_modulesPathList[$this->module])){ throw new jExceptionSelector('jelix~errors.module.unknown', $this->module); } //Build controller path $this->_ctrlpath...
php
{ "resource": "" }
q267593
jWSDL._createCachePath
test
private function _createCachePath(){ $this->_cachePath = jApp::tempPath('compiled/'.$this->_dirname.'/'.$this->module.'~'.$this->controller.$this->_cacheSuffix); }
php
{ "resource": "" }
q267594
jWSDL._updateWSDL
test
private function _updateWSDL(){ static $updated = FALSE; if($updated){ return; } $mustCompile = jApp::config()->compilation['force'] || !file_exists($this->_cachePath); if(jApp::config()->compilation['checkCacheFiletime'] && !$mustCompile){ if( filemtim...
php
{ "resource": "" }
q267595
jWSDL._compile
test
private function _compile(){ $url = jUrl::get($this->module.'~'.$this->controller.':index@soap',array(),jUrl::JURL); $url->clearParam (); $url->setParam('service',$this->module.'~'.$this->controller ); $serverUri = jUrl::getRootUrlRessourceValue('soap'); if ($serverUri === null...
php
{ "resource": "" }
q267596
jWSDL.doc
test
public function doc($className=""){ if($className != ""){ if(!class_exists($className,false)){ throw new jException('jelix~errors.ad.controller.class.unknown', array('WSDL generation', $className, $this->_ctrlpath)); } $classObject = new IPReflectionClass($cl...
php
{ "resource": "" }
q267597
jWSDL.getSoapControllers
test
public static function getSoapControllers(){ $modules = jApp::config()->_modulesPathList; $controllers = array(); foreach($modules as $module){ if(is_dir($module.'controllers')){ if ($handle = opendir($module.'controllers')) { $moduleName = basen...
php
{ "resource": "" }
q267598
AsseticConfiguration.build
test
public function build(array $config) { $output = []; // Fix output dir trailing slash if ('/' !== substr($config['output_dir'], -1) && strlen($config['output_dir']) > 0) { $config['output_dir'] .= '/'; } if ($config['bootstrap_css']['enabled']) { $ou...
php
{ "resource": "" }
q267599
AsseticConfiguration.buildBootstrapCss
test
protected function buildBootstrapCss(array $config) { $dir = $config['output_dir']; $inputs = $config['bootstrap_css']['inputs']; $inputs[] = 'assets/bootstrap-dialog/dist/css/bootstrap-dialog.min.css'; return [ 'inputs' => $inputs, 'filters' => ['cssrewrit...
php
{ "resource": "" }