_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
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->routeAnnotationType, $class ); // Get all the routes for each class and iterate through them
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->validatePath($route->getPath()); $controllerPath = $this->validatePath($controllerRoute->getPath()); // Set the path to the base path and route path $newRoute->setPath($this->validatePath($controllerPath . $path)); } // If there is a base name for this controller if (null !== $controllerRoute->getName()) { // Set the name to the base name and route name $newRoute->setName( $controllerRoute->getName() . '.' . $route->getName() ); } // If the base is dynamic if (false !== $controllerRoute->isDynamic()) { // Set the route to dynamic $newRoute->setDynamic(true); } // If the base is secure
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()) ->setRequestMethods($route->getRequestMethods()) ->setSecure($route->isSecure()) ->setDynamic($route->isDynamic()) ->setId($route->getId()) ->setName($route->getName()) ->setClass($route->getClass()) ->setProperty($route->getProperty())
php
{ "resource": "" }
q267503
NativeRouteAnnotations.publish
test
public static function publish(Application $app): void { $app->container()->singleton( RouteAnnotations::class, new static(
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; }
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->json->htmlEncode($bodyRaw['data']) : Json::htmlEncode($bodyRaw['data']);
php
{ "resource": "" }
q267506
NativeUri.getHostPort
test
public function getHostPort(): string { $host = $this->getHost(); if ($host && $port = $this->getPort()) {
php
{ "resource": "" }
q267507
NativeUri.getSchemeHostPort
test
public function getSchemeHostPort(): string { $hostPort = $this->getHostPort(); $scheme = $this->getScheme();
php
{ "resource": "" }
q267508
NativeUri.withHost
test
public function withHost(string $host): Uri { if ($host === $this->host) {
php
{ "resource": "" }
q267509
NativeUri.withPort
test
public function withPort(int $port = null): Uri { if ($port === $this->port) { return clone
php
{ "resource": "" }
q267510
NativeUri.withPath
test
public function withPath(string $path): Uri { if ($path === $this->path) { return clone $this;
php
{ "resource": "" }
q267511
NativeUri.withQuery
test
public function withQuery(string $query): Uri { if ($query === $this->query) { return clone $this; }
php
{ "resource": "" }
q267512
NativeUri.withFragment
test
public function withFragment(string $fragment): Uri { if ($fragment === $this->fragment) { return clone $this; }
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
php
{ "resource": "" }
q267514
NativeUri.validateScheme
test
protected function validateScheme(string $scheme): string { $scheme = strtolower($scheme); $scheme = (string) preg_replace('#:(//)?$#', '', $scheme); if (! $scheme) { return ''; }
php
{ "resource": "" }
q267515
NativeUri.validatePort
test
protected function validatePort(int $port = null): void { if ($port !== null && ($port < 1 || $port > 65535)) { throw new InvalidPort( sprintf(
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); } $fail = false; if ($deps) { if (!class_exists('PEAR_Downloader_Package')) { require_once 'PEAR/Downloader/Package.php'; } $dp = &new PEAR_Downloader_Package($dl); if (is_object($pkg)) { $dp->setPackageFile($pkg); } else { $dp->setDownloadURL($pkg); } PEAR::pushErrorHandling(PEAR_ERROR_RETURN); foreach ($deps as $channel => $info) { foreach ($info as $package => $ds) { foreach ($params as $packd) { if (strtolower($packd->getPackage()) == strtolower($package) && $packd->getChannel() == $channel) { $dl->log(3, 'skipping installed package check of "' . $this->_registry->parsedPackageNameToString( array('channel' => $channel, 'package' => $package), true) . '", version "' . $packd->getVersion() . '" will be ' . 'downloaded and installed');
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"); }
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']]; $newdep = array(); switch ($type) { case 'Package' : $newdep['channel'] = 'pear.php.net'; case 'Extension' : case 'Os' : $newdep['name'] = $dep['name']; break; } $dep['rel'] = PEAR_Dependency2::signOperator($dep['rel']); switch ($dep['rel']) { case 'has' : return array($newdep, $type); break; case 'not' : $newdep['conflicts'] = true; break; case '>=' : case '>' : $newdep['min'] = $dep['version']; if ($dep['rel'] == '>') { $newdep['exclude'] = $dep['version']; } break; case '<=' : case '<' : $newdep['max'] = $dep['version']; if ($dep['rel'] == '<') { $newdep['exclude'] = $dep['version']; } break;
php
{ "resource": "" }
q267519
Backbone.addOrRemoveS
test
public static function addOrRemoveS($word) { $arrayOfCharInTable = str_split($word); if ($arrayOfCharInTable[count($arrayOfCharInTable) - 1]
php
{ "resource": "" }
q267520
Backbone.tokenize
test
public static function tokenize($string, $delimiter) { $result = ''; $token = strtok($string, $delimiter); $result .= $token; while ($token) { $token
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];
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) {
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_null($dbConn)) { $dbConn = self::makeDbConn(); }
php
{ "resource": "" }
q267524
Backbone.getTable
test
public static function getTable($className, $dbConn = NULL) { if (is_null($dbConn)) { $dbConn = self::makeDbConn(); }
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) {
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)) { $username = $matches[1]; $password = $matches[2]; $channel = $matches[3]; } else { $channel = $params[0]; } $reg = &$this->config->getRegistry(); if ($reg->channelExists($channel)) { if (!$reg->isAlias($channel)) { return $this->raiseError("Channel \"$channel\" is already initialized", PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS); } return $this->raiseError("A channel alias named \"$channel\" " . 'already exists, aliasing channel "' . $reg->channelName($channel) . '"'); } $this->pushErrorHandling(PEAR_ERROR_RETURN); $err = $this->doAdd($command, $options, array('http://' . $channel . '/channel.xml')); $this->popErrorHandling(); if (PEAR::isError($err)) { if ($err->getCode() === PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS) { return $this->raiseError("Discovery of channel \"$channel\" failed (" . $err->getMessage() . ')'); } // Attempt fetch via https $this->ui->outputData("Discovering channel $channel over http:// failed with message: " . $err->getMessage());
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); if (PEAR::isError($chan)) { return $this->raiseError($chan); } $server = $this->config->get('preferred_mirror', null, $channel); $username = $this->config->get('username', null, $channel); if (empty($username)) { $username = isset($_ENV['USER']) ? $_ENV['USER'] : null; } $this->ui->outputData("Logging in to $server.", $command); list($username, $password) = $this->ui->userDialog( $command, array('Username', 'Password'), array('text', 'password'), array($username, '') ); $username = trim($username); $password = trim($password); $ourfile = $this->config->getConfFile('user'); if (!$ourfile) { $ourfile = $this->config->getConfFile('system');
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); if (PEAR::isError($chan)) { return $this->raiseError($chan); }
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.'); }
php
{ "resource": "" }
q267530
MigrateCommand.getMigrationFiles
test
protected function getMigrationFiles($migrationPath) { $files = array(); $handle = opendir($migrationPath); while(false !== $file = readdir($handle)) { if($file === '.' || $file === '..') { continue; }
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->module) { $paths = array_merge($paths, $this->getModulesMigrationPaths()); } foreach ($paths as $migrationPath) {
php
{ "resource": "" }
q267532
BaseModelAbility.publishMethod
test
protected function publishMethod($methodName, $isStatic = false) { if ($isStatic) { $this->_publishedStaticMethods[$methodName] = array(); } else {
php
{ "resource": "" }
q267533
Request.send
test
public function send($url, $curled = true) { $this->setUrl($url); $result = ($this->isCurlExists() && $curled === true) ? $this->curl()
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' );
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) {
php
{ "resource": "" }
q267536
AppBuilderFactory.createAppBuilder
test
public function createAppBuilder($contextName, $appRootPath) { list($fileSystem, $containerBuilder, $appPath) = $this->getAppBuilderDependencies($appRootPath);
php
{ "resource": "" }
q267537
AppBuilderFactory.createAppBuilderFromPersisted
test
public function createAppBuilderFromPersisted(IContainerBuilderPersister $persister, $contextName, $appRootPath) { $fileSystem = new FileSystem();
php
{ "resource": "" }
q267538
AppBuilderFactory.getAppBuilderDependencies
test
protected function getAppBuilderDependencies($appRootPath) { $fileSystem = new FileSystem(); $containerBuilder = new ContainerBuilder(); $appPath = new AppPath($fileSystem, $appRootPath); return array(
php
{ "resource": "" }
q267539
GitHandler.reset
test
public function reset($file) { if (is_file($file)) { $cmd = 'cd %s && git checkout HEAD -- %s';
php
{ "resource": "" }
q267540
GitHandler.createBranch
test
public function createBranch($branch) { $cmd = 'cd %s && git checkout
php
{ "resource": "" }
q267541
GitHandler.deleteBranch
test
public function deleteBranch($branch) { $cmd = 'cd %s && git checkout master && git branch -D %s';
php
{ "resource": "" }
q267542
GitHandler.pushBranch
test
public function pushBranch($branch) { $cmd = 'cd %s && git push origin %s';
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,
php
{ "resource": "" }
q267544
GitHandler.cloneProject
test
public function cloneProject() { $origin = sprintf('[email protected]:%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->systemLog(sprintf('cd %s && git config user.name "%s"', $this->projectPath, $this->username)); $this->systemLog(sprintf('cd %s && git config user.email %s', $this->projectPath, $this->email)); $this->systemLog(sprintf('cd %s && git remote add upstream
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+(\d{8})/', $data, $matches)) { $member = preg_replace('/[^a-z]/', '_', strtolower($matches[1]));
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 = $callback[0]->debug; $callback[0]->debug = 2; } while ($line = fgets($pp, 1024)) { if ($callback) { call_user_func($callback, 'cmdoutput', $line);
php
{ "resource": "" }
q267547
ApiUser.connect
test
public function connect(array $clientCredentials) { $endPoints = array_filter([ 'request' => $this->urlRequest, 'authorize' => $this->urlAuthorize, 'access' => $this->urlAccess, ]);
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
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; }
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; } } if ($value['source'] == $file) { $rename = $value; } } if (!isset($rename['source'])) { return $file; } if (!isset($rename['target']) or ($rename['target'] == '*')) {
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($id, $this->services)) { return $this->services[$id]; } throw new \InvalidArgumentException('service is not defined'); } $definition = $this->serviceDefinitions[$id]; if (false === $definition->getPublic() && false === $isAlias) { throw
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) { foreach ($arguments as &$argument) { if (is_string($argument)) { if ('@' === $argument[0]) { $serviceId = substr($argument, 1); $subDefinition = $this->getDefinition($serviceId); $argument = $this->generateService($subDefinition); } else if (strlen($argument) > 2 && '%' === $argument[0] && '%' === substr($argument, -1)) { $parameterId = substr($argument, 1, -1); $argument = $this->getParameter($parameterId); }
php
{ "resource": "" }
q267553
Container.set
test
public function set($id, $service) { $id = strtolower($id);
php
{ "resource": "" }
q267554
Container.setAlias
test
public function setAlias($aliasId, $id) { $this->aliases[strtolower($aliasId)]
php
{ "resource": "" }
q267555
Container.getParameter
test
public function getParameter($id) { $id = strtolower($id); if (array_key_exists($id, $this->parameters)) {
php
{ "resource": "" }
q267556
Container.setParameter
test
public function setParameter($id, $value) { $id = strtolower($id);
php
{ "resource": "" }
q267557
Container.getDefinition
test
public function getDefinition($id) { $id = strtolower($id); if (array_key_exists($id, $this->aliases)) { $id = $this->aliases[$id];
php
{ "resource": "" }
q267558
Container.setDefinition
test
public function setDefinition($id, Definition $definition) { $id = strtolower($id);
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->getProject()->getProperty('drush.dir'); $this->alias = $this->getProject()->getProperty('drush.alias');
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 $this->setPrefix($event->getPrefix());
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 the cache and return them. $results = []; $query = static::all(); // If the current model uses softDeletes then fix the // query to exclude those objects. foreach (class_uses(__CLASS__) as $traitName) { if ($traitName == 'SoftDeletes') {
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 // false, eliminate that possibility. if ($this->string === 'b:0;') { $result = false; return true; } $length = strlen($this->string); $end = ''; switch ($this->string[0]) { case 's': if ($this->string[$length - 2] !== '"') { return false; } case 'b': case 'i': case 'd': $end .= ';'; case 'a': case 'O': $end .= '}'; if ($this->string[1] !== ':') { return false; } switch ($this->string[2]) { case 0: case 1: case 2: case 3: case 4:
php
{ "resource": "" }
q267563
CallbackPrediction.check
test
public function check(array $calls, FunctionProphecy $prophecy) { $callback = $this->callback;
php
{ "resource": "" }
q267564
RouterAbstract.addRoute
test
public function addRoute($httpMethod, $route, $handler) { $route = $this->groupCurrent . $route;
php
{ "resource": "" }
q267565
RouterAbstract.initRoutes
test
public function initRoutes() { $classNames = ClassFinderHelper::findClassesPsr4($this->controllerNamespaces, true);
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) || !$controller->hasAction($actionId)) { $actionId = $controller->defaultAction; } return [$controller, $actionId]; } $controller = null; foreach ($this->controllerNamespaces as $namespace) {
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->getClass($className); if (isset($classAnnotations[Ctrl::class])) {
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, 'action') === 0 ? $value : false; }); $actions = Reaction\Helpers\ArrayHelper::getColumn($actions, 'name', false); if (empty($actions)) { return; } $controller = is_string($className) ? new $className() : $className; for ($i = 0; $i < count($actions); $i++) { $actionAnnotations = Reaction::$annotations->getMethod($actions[$i], $className); if (!isset($actionAnnotations[CtrlAction::class])) {
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) { $method = $row['method']; $route = $group . $row['route'];
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->defaultController];
php
{ "resource": "" }
q267571
LifeCyclableTrait.registerObserver
test
public function registerObserver(ObservedInterface $observed): LifeCyclableInterface {
php
{ "resource": "" }
q267572
LifeCyclableTrait.unregisterObserver
test
public function unregisterObserver(ObservedInterface $observed): LifeCyclableInterface { $observedHash = \spl_object_hash($observed);
php
{ "resource": "" }
q267573
ControlChannel.autoSetChannel
test
private function autoSetChannel($basename) { $channel = sprintf($basename,
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
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
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'))) {
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) {
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]), false)) {
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))) {
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 = $connectionImplReflectionClass->getInterfaceNames(); $connectionInterfaceName = 'PhpPlatform\Persist\Connection\Connection'; if(!in_array($connectionInterfaceName, $connectionImplInterfaces)){ throw
php
{ "resource": "" }
q267583
EkynaCoreExtension.configureStfalconTinymceBundle
test
protected function configureStfalconTinymceBundle(ContainerBuilder $container, array $config, array $bundles) { $tinymceConfig = new TinymceConfiguration();
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' );
php
{ "resource": "" }
q267585
WindowsLocatorFactory.create
test
public function create(Environment $environment = null) { return $this->createFromPath( $environment ? $environment->getenv('PATH') : getenv('PATH'),
php
{ "resource": "" }
q267586
WindowsLocatorFactory.createFromPath
test
public function createFromPath($path, $pathext) { $paths = array_merge(['.'], array_filter(explode(';', $path)));
php
{ "resource": "" }
q267587
AbstractConstants.getChoices
test
public static function getChoices() { $choices = []; foreach (static::getConfig() as
php
{ "resource": "" }
q267588
AbstractConstants.isValid
test
public static function isValid($constant, $throwException = false) { if (array_key_exists($constant, static::getConfig())) { return true; } if ($throwException) {
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, function ($value, $key) use (&$doChecks, $functionName) { if (is_null($value) || !isset($doChecks[$key]) || $doChecks[$key] == DataType::SKIP) { return; } if (!TypeCheck::checkValue($value, $doChecks[$key])) { if (is_callable($doChecks[$key])) {
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)) {
php
{ "resource": "" }
q267591
PDO.getAdapter
test
public static function getAdapter(\PDO $pdo) { $driver = new Driver\Pdo\Pdo($pdo);
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 = $config->_modulesPathList[$this->module].'controllers/'.$this->controller.'.soap.php'; //Check controller availability if(!file_exists($this->_ctrlpath)){ throw new jException('jelix~errors.action.unknown',$this->controller);
php
{ "resource": "" }
q267593
jWSDL._createCachePath
test
private function _createCachePath(){ $this->_cachePath = jApp::tempPath('compiled/'.$this->_dirnam
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){
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) { $serverUri = jUrl::getRootUrlRessourceValue('soap-'.$this->module); } if ($serverUri === null) { $serverUri = jUrl::getRootUrlRessourceValue('soap-'.$this->module.'-'.$this->controller); } if ($serverUri === null) { $serverUri = jApp::coord()->request->getServerURI(); } $serviceURL = $serverUri .$url->toString(); $serviceNameSpace = $serverUri . jApp::urlBasePath();
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($className); }else{ $classObject = new IPReflectionClass($this->controllerClassName); } $documentation = Array(); $documentation['menu'] = Array(); if($classObject){ $classObject->properties = $classObject->getProperties(false, false, false); $classObject->methods =
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 = basename($module); while (false !== ($file = readdir($handle))) { if (substr($file, strlen($file) - strlen('.soap.php')) == '.soap.php') { $controller = array();
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']) { $output['bootstrap_css'] = $this->buildBootstrapCss($config); } if ($config['content_css']['enabled']) {
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,
php
{ "resource": "" }