_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->routeAnnotationType, $class ); // Get all the routes for each class and iterate through them foreach ($annotations as $annotation) { // Set the annotation in the routes list $routes[] = $annotation; } } return $routes; }
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 if (false !== $controllerRoute->isSecure()) { // Set the route to dynamic $newRoute->setSecure(true); } // If there is a base middleware collection for this controller if (null !== $controllerRoute->getMiddleware()) { // Merge the route's middleware and the controller's middleware // keeping the controller's middleware first $middleware = array_merge( $controllerRoute->getMiddleware(), $route->getMiddleware() ?? [] ); // Set the middleware in the route $newRoute->setMiddleware($middleware); } return $newRoute; }
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()) ->setMethod($route->getMethod()) ->setStatic($route->isStatic()) ->setFunction($route->getFunction()) ->setMatches($route->getMatches()) ->setDependencies($route->getDependencies()) ->setMiddleware($route->getMiddleware()) ->setArguments($route->getArguments()); return $routerRoute; }
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 Reaction\RequestApplicationInterface ? $response->app->helpers->json->encode($bodyRaw, $options) : Json::encode($bodyRaw, $options); } return ''; }
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']); return sprintf('%s(%s);', $bodyRaw['callback'], $data); } elseif ($bodyRaw !== null) { Reaction::warning( "The 'jsonp' response requires that the data be an array consisting of both 'data' and 'callback' elements." ); } return ''; }
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) || (static::HTTPS_SCHEME === $this->scheme && $this->port === static::HTTPS_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) { throw new InvalidScheme( sprintf( 'Invalid scheme "%s" specified; must be either "http" or "https"', $scheme ) ); } return $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); } $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'); continue 2; // jump to next package } } foreach ($ds as $d) { $checker = &new PEAR_Dependency2($this->_config, $this->_options, array('channel' => $channel, 'package' => $package), $this->_state); $dep = $d['dep']; $required = $d['type'] == 'required'; $ret = $checker->_validatePackageDownload($dep, $required, array(&$dp)); if (is_array($ret)) { $dl->log(0, $ret[0]); } elseif (PEAR::isError($ret)) { $dl->log(0, $ret->getMessage()); $fail = true; } } } } PEAR::popErrorHandling(); } if ($fail) { return $this->raiseError( '%s cannot be installed, conflicts with installed packages'); } return true; }
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_exists($this, "validate{$type}Dependency")) { return $this->{"validate{$type}Dependency"}($newdep, $dep['optional'] == 'no', $params, true); } }
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; case 'ne' : case '!=' : $newdep['min'] = '0'; $newdep['max'] = '100000'; $newdep['exclude'] = $dep['version']; break; case '==' : $newdep['min'] = $dep['version']; $newdep['max'] = $dep['version']; break; } if ($type == 'Php') { if (!isset($newdep['min'])) { $newdep['min'] = '4.4.0'; } if (!isset($newdep['max'])) { $newdep['max'] = '6.0.0'; } } return array($newdep, $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'; } return $word; }
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 . "'"; } array_push($temp, array_keys($record)[$i] . '=' . $value); } return $temp; }
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 { $dbConn = null; } return $result ? true : false; }
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(); } if ($table == 'user' || (! self::checkForTable($table, $dbConn))) { $table = self::addOrRemoveS($table); if (! self::checkForTable($table, $dbConn)) { throw new TableDoesNotExistException; } } return $table; }
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 $table; }
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 in file comment'; $this->currentFile->addError($error, $errorPos); } } }
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()); $this->ui->outputData("Trying to discover channel $channel over https:// instead"); $this->pushErrorHandling(PEAR_ERROR_RETURN); $err = $this->doAdd($command, $options, array('https://' . $channel . '/channel.xml')); $this->popErrorHandling(); if (PEAR::isError($err)) { return $this->raiseError("Discovery of channel \"$channel\" failed (" . $err->getMessage() . ')'); } } // Store username/password if they were given // Arguably we should do a logintest on the channel here, but since // that's awkward on a REST-based channel (even "pear login" doesn't // do it for those), and XML-RPC is deprecated, it's fairly pointless. if (isset($username)) { $this->config->set('username', $username, 'user', $channel); $this->config->set('password', $password, 'user', $channel); $this->config->store(); $this->ui->outputData("Stored login for channel \"$channel\" using username \"$username\"", $command); } $this->ui->outputData("Discovery of channel \"$channel\" succeeded", $command); }
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'); } $this->config->set('username', $username, 'user', $channel); $this->config->set('password', $password, 'user', $channel); if ($chan->supportsREST()) { $ok = true; } if ($ok !== true) { return $this->raiseError('Login failed!'); } $this->ui->outputData("Logged in.", $command); // avoid changing any temporary settings changed with -d $ourconfig = new PEAR_Config($ourfile, $ourfile); $ourconfig->set('username', $username, 'user', $channel); $ourconfig->set('password', $password, 'user', $channel); $ourconfig->store(); return true; }
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); } $server = $this->config->get('preferred_mirror', null, $channel); $this->ui->outputData("Logging out from $server.", $command); $this->config->remove('username', 'user', $channel); $this->config->remove('password', 'user', $channel); $this->config->store(); return true; }
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, '#') . '#'); $this->setReplacement($this->_replacementSeparator); return parent::filter($value); }
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_SEPARATOR . $file; if(preg_match('/^(m(\d{6}_\d{6})_.*?)\.php$/', $file, $matches) && is_file($path)) { $files[$matches[1]] = $path; } } closedir($handle); return $files; }
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) { $moduleFiles = $this->getMigrationFiles($migrationPath); $files = array_merge($files, $moduleFiles); } $this->_migrationToFileMap = $files; } return $this->_migrationToFileMap; }
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('The url must not be empty'); } if (filter_var($url, FILTER_VALIDATE_URL) === false) { throw new InvalidUrlException('The url [' . $url . '] is invalid'); } }
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 directory was not found!"); } return $dir; }
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 AppBuilder($fileSystem, $appPath, $containerBuilder, $contextName); }
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, $appPath, ); }
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', $this->username, $headBranch), 'title' => $this->pullRequestTitle, 'body' => $this->pullRequestMessage ) ); }
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 %s', $this->projectPath, $upstream)); $this->systemLog(sprintf('cd %s && git fetch upstream', $this->projectPath)); $this->systemLog(sprintf('cd %s && git merge upstream/master', $this->projectPath)); $this->systemLog(sprintf('cd %s && git push origin master', $this->projectPath)); }
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])); $apino = (int)$matches[2]; if (isset($this->$member)) { $this->$member = $apino; //$msg = sprintf("%-22s : %d", $matches[1], $apino); //$this->log(1, $msg); } } }
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); } else { $this->log(2, rtrim($line)); } } if ($callback && isset($olddbg)) { $callback[0]->debug = $olddbg; } $exitcode = is_resource($pp) ? pclose($pp) : -1; return ($exitcode == 0); }
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($clientCredentials, $endPoints, $this->checkUrl); return $this->getUserOrFail($data); }
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); return $this; }
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) && (file_exists($file['target']))) { unlink($file['target']); } if (file_exists($file['target'])) { throw new Zend_Filter_Exception(sprintf("File '%s' could not be renamed. It already exists.", $value)); } if ($source) { return $file; } return $file['target']; }
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'] == '*')) { $rename['target'] = $rename['source']; } if (is_dir($rename['target'])) { $name = basename($rename['source']); $last = $rename['target'][strlen($rename['target']) - 1]; if (($last != '/') and ($last != '\\')) { $rename['target'] .= DIRECTORY_SEPARATOR; } $rename['target'] .= $name; } return $rename; }
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 new \InvalidArgumentException('cannot access service directly'); } if (array_key_exists($id, $this->services)) { return $this->services[$id]; } $service = $this->generateService($definition); if ($definition->getShare()) { $this->services[$id] = $service; } return $service; }
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); } } } $service = $reflection->newInstanceArgs($arguments); } else { $service = $reflection->newInstance(); } if (count($properties) > 0) { foreach ($properties as $key => $value) { $service->{$key} = $value; } } if (count($calls) > 0) { foreach ($calls as $call) { call_user_func_array(array($service, $call[0]), $call[1]); } } return $service; }
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 \InvalidArgumentException('service is not defined'); }
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->getProject()->getProperty('drush.dir'); $this->alias = $this->getProject()->getProperty('drush.alias'); $this->setVerbose($this->getProject()->getProperty('drush.verbose')); $this->setAssume($this->getProject()->getProperty('drush.assume')); $this->setPassthru($this->getProject()->getProperty('drush.passthru')); $this->setLogOutput($this->getProject()->getProperty('drush.logoutput')); }
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()); $this->setNick($event->getNick()); $this->setUsername($event->getUsername()); $this->setHost($event->getHost()); $this->setTargets($event->getTargets()); }
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') { $query = static::whereNull('deleted_at')->get(); break; } } /** @var Cacheable $row */ foreach ($query as $row) { $results[$row->getIndexKey()] = $row->toFluent(); } Cache::put($cache_key, $results, 60); return $results; }
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: case 5: case 6: case 7: case 8: case 9: break; default: return false; } case 'N': $end .= ';'; if ($this->string[$length - 1] !== $end[0]) { return false; } break; default: return false; } if (($this->result = @unserialize($this->string)) === false) { $this->result = null; return false; } return true; }
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) || !$controller->hasAction($actionId)) { $actionId = $controller->defaultAction; } return [$controller, $actionId]; } $controller = null; foreach ($this->controllerNamespaces as $namespace) { $controllerNameFull = $namespace . '\\' . $controllerName; if (!class_exists($controllerNameFull)) { continue; } try { /** @var ControllerInterface $controller */ $config = Reaction\Helpers\ArrayHelper::merge($config, ['class' => $controllerNameFull]); $controller = Reaction::create($config); if (!isset($actionId) || !$controller->hasAction($actionId)) { $actionId = $controller->defaultAction; } break; } catch (InvalidConfigException $exception) { $controller = null; continue; } } return [$controller, $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->getClass($className); if (isset($classAnnotations[Ctrl::class])) { $this->registerControllerWithAnnotations($className, $classAnnotations[Ctrl::class]); } else { $this->registerControllerNoAnnotations($className); } }
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])) { continue; } /** @var CtrlAction $ctrlAction */ $ctrlAction = $actionAnnotations[CtrlAction::class]; $path = $ctrlAnnotation->group . '/' . ltrim($ctrlAction->path, '/'); $path = $path !== '/' ? rtrim($path, '/') : $path; $actionId = Controller::getActionId($actions[$i]); $this->addRoute($ctrlAction->method, $path, [$controller, $actionId]); } }
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']; $handlerName = $row['handler']; $actionId = Controller::getActionId($handlerName); $this->addRoute($method, $route, [$controller, $actionId]); } }
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]; $config = Reaction\Helpers\ArrayHelper::merge($configDefault, $config); $controller = Reaction::create($config); $action = $controller->defaultAction; } return [$controller, $action]; }
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 'shutdown': return $this->commandShutdown($command); default: return $this->returnError('Unknown command.'); } }
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->redirect($defaultPath); }
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->getParameter('ekyna_core.cache_config')['default_smaxage']; } return $response->setSharedMaxAge($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)) { $event->addResponse(Response::msg($event->getRequest()->getSource(), $img)); } }); // Get me a gif! $this->bot->onChannel('/^!gif (.+)$/i', function(Event $event) use ($that) { $matches = $event->getMatches(); if ($img = $that->getImage(trim($matches[0]), true)) { $event->addResponse(Response::msg($event->getRequest()->getSource(), $img)); } }); }
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); } $befores = array_merge($befores, $this->before()); $afters = array_merge($this->after(), $afters); // before kernel foreach ($befores as $middleware) { $this->pushToBefore($middleware); } // after kernel foreach ($afters as $middleware) { $this->pushToAfter($middleware); } $this->finalized = true; }
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" does not exists.', $directory)); } return $directory; }
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". "but %d %s made:\n%s", $prophecy->getName(), $prophecy->getArgumentsWildcard(), count($calls), $verb, $this->util->stringifyCalls($calls) )); }
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 new NoConnectionException("connection implementation $connectionImpl does not implement $connectionInterfaceName"); } self::$connection = $connectionImplReflectionClass->newInstance(); } return self::$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' ); $editor->add_cap( 'edit_theme_options' ); $editor->remove_cap( 'switch_themes' ); }
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)); } return false; }
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])) { $doChecks[$key] = 'unknown (custom validator)'; } if (is_object($value)) { $message = sprintf( TypeCheck::MESSAGE, $key, $functionName, $doChecks[$key], 'instance of ' . get_class($value) ); } else { $message = sprintf( TypeCheck::MESSAGE, $key, $functionName, $doChecks[$key], gettype($value) ); } throw new InvalidArgumentException($message); } } ); }
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 = $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); } //Check controller declaration require_once($this->_ctrlpath); $this->controllerClassName = $this->controller.'Ctrl'; if(!class_exists($this->controllerClassName,false)){ throw new jException('jelix~errors.ad.controller.class.unknown', array('jWSDL', $this->controllerClassName, $this->_ctrlpath)); } //Check eAccelerator configuration in order to Reflexion API work if (extension_loaded('eAccelerator')) { $reflect = new ReflectionClass('jWSDL'); if($reflect->getDocComment() == NULL) { throw new jException('jsoap~errors.eaccelerator.configuration'); } unset($reflect); } }
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( filemtime($this->_ctrlpath) > filemtime($this->_cachePath)){ $mustCompile = true; } } if($mustCompile){ jFile::write($this->_cachePath, $this->_compile()); } $updated = TRUE; }
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(); $wsdl = new WSDLStruct($serviceNameSpace, $serviceURL, SOAP_RPC, SOAP_ENCODED); $wsdl->setService(new IPReflectionClass($this->controllerClassName)); try { $gendoc = $wsdl->generateDocument(); } catch (WSDLException $exception) { throw new JException('jsoap~errors.wsdl.generation', $exception->msg); } return $gendoc; }
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 = $classObject->getMethods(false, false, false); foreach((array)$classObject->methods as $method) { $method->params = $method->getParameters(); } $documentation['class'] = $classObject; $documentation['service'] = $this->module.'~'.$this->controller; } return $documentation; }
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(); $controller['class'] = substr($file, 0, strlen($file) - strlen('.soap.php')); $controller['module'] = $moduleName; $controller['service'] = $moduleName.'~'.$controller['class']; array_push($controllers, $controller); } } closedir($handle); } } } return $controllers; }
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']) { $output['content_css'] = $this->buildContentCss($config); } $output['twig_js'] = $this->buildTwigJs($config); $output['form_css'] = $this->buildFormCss($config); return $output; }
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' => ['cssrewrite', 'less', 'yui_css'], 'output' => $dir . 'css/bootstrap.css', 'debug' => false, ]; }
php
{ "resource": "" }