_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q266900 | Tokenizer.getStatedClassInstanceToken | test | public function getStatedClassInstanceToken(LifeCyclableInterface $object): string
{
$statedClassName = \get_class($object);
| php | {
"resource": ""
} |
q266901 | PEAR_REST_11.listCategory | test | function listCategory($base, $category, $info = false, $channel = false)
{
if ($info == false) {
$url = '%s'.'c/%s/packages.xml';
} else {
$url = '%s'.'c/%s/packagesinfo.xml';
}
$url = sprintf($url,
$base,
urlencode($cat... | php | {
"resource": ""
} |
q266902 | PEAR_REST_11.betterStates | test | function betterStates($state, $include = false)
{
static $states = array('snapshot', 'devel', 'alpha', 'beta', 'stable');
$i = array_search($state, $states);
if ($i === false) {
return false;
| php | {
"resource": ""
} |
q266903 | Executioner.compileCommand | test | private function compileCommand()
{
$command = '';
if ($this->sudo) {
$command = 'sudo ';
}
$command .= escapeshellcmd($this->applicationPath) . $this->generateArguments();
| php | {
"resource": ""
} |
q266904 | Executioner.generateArguments | test | protected function generateArguments()
{
$arguments = '';
if (!$this->applicationArguments->isEmpty()) {
$arguments = ' ' . | php | {
"resource": ""
} |
q266905 | Executioner.executeProcess | test | private function executeProcess()
{
$command = $this->compileCommand();
exec($command, $result, $status);
if ($status > 0) {
| php | {
"resource": ""
} |
q266906 | FileManager.save | test | private function save()
{
foreach ($this->stream as $key => $file) {
$layer = ucwords($key);
$namespace = Text::replace($this->namespace, '\\', '/');
$root = Text::replace("{$this->directory}/{$namespace}/{$layer}", '//', '/');
$success = true;
if... | php | {
"resource": ""
} |
q266907 | FileManager.replace | test | private function replace()
{
foreach ($this->stream as &$content) {
foreach ($this->replacements as $field) {
| php | {
"resource": ""
} |
q266908 | NativeRouter.addRoute | test | public function addRoute(Route $route): void
{
// Verify the dispatch
$this->app->dispatcher()->verifyDispatch($route);
// Set the path to the validated cleaned path (/some/path)
$route->setPath($this->validatePath($route->getPath()));
| php | {
"resource": ""
} |
q266909 | NativeRouter.get | test | public function get(Route $route): void
{
$route->setRequestMethods([RequestMethod::GET, | php | {
"resource": ""
} |
q266910 | NativeRouter.post | test | public function post(Route $route): void
{
$route->setRequestMethods([RequestMeth | php | {
"resource": ""
} |
q266911 | NativeRouter.put | test | public function put(Route $route): void
{
$route->setRequestMethods([RequestMeth | php | {
"resource": ""
} |
q266912 | NativeRouter.patch | test | public function patch(Route $route): void
{
$route->setRequestMethods([RequestMeth | php | {
"resource": ""
} |
q266913 | NativeRouter.delete | test | public function delete(Route $route): void
{
$route->setRequestMethods([RequestMeth | php | {
"resource": ""
} |
q266914 | NativeRouter.head | test | public function head(Route $route): void
{
$route->setRequestMethods([RequestMeth | php | {
"resource": ""
} |
q266915 | NativeRouter.route | test | public function route(string $name): Route
{
// If no route was found
if (! $this->routeIsset($name)) { | php | {
"resource": ""
} |
q266916 | NativeRouter.routeUrl | test | public function routeUrl(string $name, array $data = null, bool $absolute = null): string
{
// Get the matching route
$route = $this->route($name);
// Set the host to use if this is an absolute url
// or the config is set to always use absolute urls
// or the route is secure ... | php | {
"resource": ""
} |
q266917 | NativeRouter.requestRoute | test | public function requestRoute(Request $request): ? Route
{
$requestMethod = $request->getMethod();
// Decode the request uri
| php | {
"resource": ""
} |
q266918 | NativeRouter.matchRoute | test | public function matchRoute(string $path, string $method = null): ? Route
{
// Validate the path
$path = $this->validatePath($path);
$method = $method ?? RequestMethod::GET;
| php | {
"resource": ""
} |
q266919 | NativeRouter.isInternalUri | test | public function isInternalUri(string $uri): bool
{
// Replace the scheme if it exists
$uri = str_replace(['http://', 'https://'], '', $uri);
// Get the host of the uri
$host = (string) substr($uri, 0, strpos($uri, '/'));
// If the host does not match the current request uri... | php | {
"resource": ""
} |
q266920 | NativeRouter.dispatch | test | public function dispatch(Request $request): Response
{
// Check the returned route
if (null === $route = $this->requestRoute($request)) {
// If it was null throw a not found exception
throw new NotFoundHttpException();
}
// If the route is secure and the curr... | php | {
"resource": ""
} |
q266921 | NativeRouter.setup | test | public function setup(bool $force = false, bool $useCache = true): void
{
// If route's have already been setup, no need to do it again
if (self::$setup && ! $force) {
return;
}
self::$setup = true;
// If the application should use the routes cache file
... | php | {
"resource": ""
} |
q266922 | NativeRouter.setDynamicRoute | test | protected function setDynamicRoute(Route $route): void
{
// Parse the path
$parsedRoute = $this->app->pathParser()->parse($route->getPath());
// Set the properties
| php | {
"resource": ""
} |
q266923 | NativeRouter.validateRouteUrl | test | protected function validateRouteUrl(string $path): string
{
// If the last character is not a slash and the config is set to
// ensure trailing slash
if (
$path[-1] !== '/'
| php | {
"resource": ""
} |
q266924 | NativeRouter.matchStaticRoute | test | protected function matchStaticRoute(string $path, string $method): ? Route
{
$route = null;
// Let's check if the route is set in the static routes
if (self::$collection->issetStaticRoute($method, $path)) {
$route = $this->getMatchedStaticRoute($path, $method); | php | {
"resource": ""
} |
q266925 | NativeRouter.matchDynamicRoute | test | protected function matchDynamicRoute(string $path, string $method): ? Route
{
// The route to return (null by default)
$route = null;
// The dynamic routes
$dynamicRoutes = self::$collection->getDynamicRoutes($method);
// Attempt to find a match using dynamic routes that are... | php | {
"resource": ""
} |
q266926 | NativeRouter.getMatchedStaticRoute | test | protected function getMatchedStaticRoute(string $path, string $method): Route | php | {
"resource": ""
} |
q266927 | NativeRouter.getMatchedDynamicRoute | test | protected function getMatchedDynamicRoute(string $path, array $matches, string $method): Route
{
// Clone the route to avoid changing the one set in the master array
$dynamicRoute = clone self::$collection->dynamicRoute($method, $path);
// The first match is the path itself
unset($ma... | php | {
"resource": ""
} |
q266928 | NativeRouter.routeRequestMiddleware | test | protected function routeRequestMiddleware(Request $request, Route $route)
{
// If the route has no middleware
if (null === $route->getMiddleware()) {
// Return the request passed through
return $request;
| php | {
"resource": ""
} |
q266929 | NativeRouter.routeResponseMiddleware | test | protected function routeResponseMiddleware(Request $request, Response $response, Route $route): void
{
// If the route has no middleware
if (null === $route->getMiddleware()) {
// Return the response passed through
return;
| php | {
"resource": ""
} |
q266930 | NativeRouter.getResponseFromDispatch | test | protected function getResponseFromDispatch($dispatch): Response
{
// If the dispatch failed, 404
if (! $dispatch) {
$this->app->abort();
}
// If the dispatch is a Response then simply return it
if ($dispatch instanceof Response) {
return $dispatch;
... | php | {
"resource": ""
} |
q266931 | NativeRouter.setupFromCache | test | protected function setupFromCache(): void
{
// Set the application routes with said file
$cache = $this->app->config()['cache']['routing']
?? require $this->app->config()['routing']['cacheFilePath'];
self::$collection = unserialize(
base64_decode($cache['collection']... | php | {
"resource": ""
} |
q266932 | NativeRouter.setupAnnotatedRoutes | test | protected function setupAnnotatedRoutes(): void
{
/** @var RouteAnnotations $routeAnnotations */
$routeAnnotations = $this->app->container()->getSingleton(
RouteAnnotations::class
);
// Get all the annotated routes from the list of controllers
$routes = $routeAnn... | php | {
"resource": ""
} |
q266933 | Modal.renderHeader | test | protected function renderHeader()
{
$button = $this->renderCloseButton();
if ($button !== null) {
$this->header = $this->header . "\n" . $button;
}
if ($this->header !== null) {
Html::addCssClass($this->headerOptions, ['widget' => 'modal-header']);
| php | {
"resource": ""
} |
q266934 | Modal.renderToggleButton | test | protected function renderToggleButton()
{
if (($toggleButton = $this->toggleButton) !== false) {
$tag = ArrayHelper::remove($toggleButton, 'tag', 'button');
$label = ArrayHelper::remove($toggleButton, 'label', 'Show');
if ($tag === 'button' && !isset($toggleButton['type']... | php | {
"resource": ""
} |
q266935 | GettextMessageSource.getGettextFile | test | protected function getGettextFile($messageFile)
{
if (isset($this->_gettextFiles[$messageFile])) {
return $this->_gettextFiles[$messageFile];
}
if (!is_file($messageFile)) {
return null;
}
if ($this->useMoFile) {
$gettextFile = new | php | {
"resource": ""
} |
q266936 | DQL.getQBResult | test | protected function getQBResult(Params $params, Query $query)
{
$paginated = new Paginator($query);
| php | {
"resource": ""
} |
q266937 | DQL.addFilters | test | protected function addFilters(Params $params, QueryBuilder $qb)
{
| php | {
"resource": ""
} |
q266938 | DQL.filterBySearch | test | protected function filterBySearch(Params $params, QueryBuilder $qb)
{
if ($query = $params->getWrapped('search')->get('value')) {
| php | {
"resource": ""
} |
q266939 | DQL.searchFilter | test | protected function searchFilter(Params $params, QueryBuilder $qb, $search)
{
$qb->andWhere($this->alias('id').' | php | {
"resource": ""
} |
q266940 | DQL.addOrdering | test | protected function addOrdering(Params $params, QueryBuilder $qb)
{
$orderDir = "ASC";
if ($params->has('orderDir') && (strtoupper($params->get('orderDir')) == "DESC")) {
$orderDir = "DESC";
}
if | php | {
"resource": ""
} |
q266941 | DQL.addOffset | test | protected function addOffset(Params $params, QueryBuilder $qb)
{
if ($this->getOffset() && | php | {
"resource": ""
} |
q266942 | DQL.addLimit | test | protected function addLimit(Params $params, QueryBuilder $qb)
{
if ($this->getLimit() && | php | {
"resource": ""
} |
q266943 | DQL.find | test | public function find($id)
{
$params = Params::create(array($this->getIdParam() => $id, 'limit' => 1));
$qb = $this->getCustomizedQueryBuilder($params);
$results = $this->getQBResult($params, $this->queryHook($params, $qb));
if ($results->count() != 1) {
| php | {
"resource": ""
} |
q266944 | DQL.safeJoin | test | public function safeJoin(QueryBuilder $qb, $property, $joinedAlias, $autoAlias = true)
{
if ($autoAlias) {
$property = $this->alias($property);
| php | {
"resource": ""
} |
q266945 | DQL.getDataTablesSortColumn | test | protected function getDataTablesSortColumn(Params $params)
{
$column = $params->getWrapped('order')->getWrapped(0)->get('column', 0);
| php | {
"resource": ""
} |
q266946 | DQL.orderByDataTablesParams | test | protected function orderByDataTablesParams(Params $params, QueryBuilder $qb)
{
$order = $this->getDataTablesSortOrder($params);
$sort = $this->getDataTablesSortColumn($params);
| php | {
"resource": ""
} |
q266947 | PhoneValidator.isValid | test | public function isValid($value, Constraint $constraint)
{
if (empty($value)) {
return true;
}
| php | {
"resource": ""
} |
q266948 | XML_Util.replaceEntities | test | function replaceEntities($string, $replaceEntities = XML_UTIL_ENTITIES_XML,
$encoding = 'ISO-8859-1')
{
switch ($replaceEntities) {
case XML_UTIL_ENTITIES_XML:
return strtr($string, array(
'&' => '&',
'>' => '>',
'<' => '&... | php | {
"resource": ""
} |
q266949 | XML_Util.reverseEntities | test | function reverseEntities($string, $replaceEntities = XML_UTIL_ENTITIES_XML,
$encoding = 'ISO-8859-1')
{
switch ($replaceEntities) {
case XML_UTIL_ENTITIES_XML:
return strtr($string, array(
'&' => '&',
'>' => '>',
'<' ... | php | {
"resource": ""
} |
q266950 | XML_Util.getXMLDeclaration | test | function getXMLDeclaration($version = '1.0', $encoding = null,
$standalone = null)
{
$attributes = array(
'version' => $version,
);
// add encoding
if ($encoding !== null) {
| php | {
"resource": ""
} |
q266951 | XML_Util.getDocTypeDeclaration | test | function getDocTypeDeclaration($root, $uri = null, $internalDtd = null)
{
if (is_array($uri)) {
$ref = sprintf(' PUBLIC "%s" "%s"', $uri['id'], $uri['uri']);
} elseif (!empty($uri)) {
$ref = sprintf(' SYSTEM "%s"', $uri);
} else {
$ref = '';
}
... | php | {
"resource": ""
} |
q266952 | XML_Util.attributesToString | test | function attributesToString($attributes, $sort = true, $multiline = false,
$indent = ' ', $linebreak = "\n", $entities = XML_UTIL_ENTITIES_XML)
{
/*
* second parameter may be an array
*/
if (is_array($sort)) {
if (isset($sort['multiline'])) {
... | php | {
"resource": ""
} |
q266953 | XML_Util.collapseEmptyTags | test | function collapseEmptyTags($xml, $mode = XML_UTIL_COLLAPSE_ALL)
{
if ($mode == XML_UTIL_COLLAPSE_XHTML_ONLY) {
return preg_replace(
'/<(area|base(?:font)?|br|col|frame|hr|img|input|isindex|link|meta|'
. 'param)([^>]*)><\/\\1>/s',
'<\\1\\2 />', | php | {
"resource": ""
} |
q266954 | XML_Util.createTag | test | function createTag($qname, $attributes = array(), $content = null,
$namespaceUri = null, $replaceEntities = XML_UTIL_REPLACE_ENTITIES,
$multiline = false, $indent = '_auto', $linebreak = "\n",
$sortAttributes = true)
{
$tag = array(
'qname' => $qname,
... | php | {
"resource": ""
} |
q266955 | XML_Util.createStartElement | test | function createStartElement($qname, $attributes = array(), $namespaceUri = null,
$multiline = false, $indent = '_auto', $linebreak = "\n",
$sortAttributes = true)
{
// if no attributes hav been set, use empty attributes
if (!isset($attributes) || !is_array($attributes)) {
... | php | {
"resource": ""
} |
q266956 | XML_Util.splitQualifiedName | test | function splitQualifiedName($qname, $defaultNs = null)
{
if (strstr($qname, ':')) {
$tmp = explode(':', $qname);
return array(
'namespace' => $tmp[0],
| php | {
"resource": ""
} |
q266957 | XML_Util.isValidName | test | function isValidName($string)
{
// check for invalid chars
if (!preg_match('/^[[:alpha:]_]$/', $string{0})) {
return XML_Util::raiseError('XML names may only start with letter '
. 'or underscore', XML_UTIL_ERROR_INVALID_START);
}
// check for invalid char... | php | {
"resource": ""
} |
q266958 | Call.dispatch | test | public static function dispatch(ICallable $object)
{
$params = $object->getParams();
$call = $object->getCallable();
if (!is_callable($call)) {
throw new CallException("Non callable object found");
}
if ($call instanceof Closure) {
return call_user_f... | php | {
"resource": ""
} |
q266959 | HttpCacheEventSubscriber.onTagResponse | test | public function onTagResponse(HttpCacheEvent $event)
{
$tags = $event->getData();
if (empty($tags)) {
| php | {
"resource": ""
} |
q266960 | HttpCacheEventSubscriber.onInvalidateTag | test | public function onInvalidateTag(HttpCacheEvent $event)
{
$tags = $event->getData();
if (empty($tags)) {
| php | {
"resource": ""
} |
q266961 | ValidationSubscriber.validate | test | protected function validate(LifecycleEventArgs $args) {
$entity = $args->getEntity();
$metadata = $args->getEntityManager()->getClassMetadata(get_class($entity));
if($this->shouldBeValidated($entity)) {
$rules = $entity->getValidationRules();
$fields = $metadata->getField... | php | {
"resource": ""
} |
q266962 | MessageInterpolationTrait.interpolateMessage | test | protected function interpolateMessage($message, array $context)//@codingStandardsIgnoreLine Ignore missing type hint
{
$context = array_filter(
$context,
function ($value) {
return (is_scalar($value) || (is_object($value) && method_exists($value, '__toString')));
... | php | {
"resource": ""
} |
q266963 | Maths.areSameSpace | test | public static function areSameSpace(PointInterface $point1, PointInterface $point2)
{
return (bool) (
($point1->is1D() && $point2->is1d()) ||
| php | {
"resource": ""
} |
q266964 | Maths.areSamePoint | test | public static function areSamePoint(PointInterface $point1, PointInterface $point2)
{
if (self::areSameSpace($point1, $point2)) {
if ($point1->is1D()) {
return (bool) ($point1->getAbscissa()==$point2->getAbscissa());
} elseif ($point1->is2D()) {
return... | php | {
"resource": ""
} |
q266965 | Maths.getLinesIntersection | test | public static function getLinesIntersection(Line $line1, Line $line2)
{
$div = ($line1->getSlope() - $line2->getSlope());
$x = ($div!=0 ?
(($line2->getYIntercept() - $line1->getYIntercept()) / $div) | php | {
"resource": ""
} |
q266966 | Maths.arePerpendiculars | test | public function arePerpendiculars(Line $line1, Line $line2)
{
| php | {
"resource": ""
} |
q266967 | Maths.areParallels | test | public static function areParallels(Line $line1, Line $line2)
{
if (
($line1->isHorizontal() && $line2->isHorizontal()) ||
($line1->isVertical() && $line2->isVertical())
) {
return true;
}
$line1->rearrange();
$line2->rearrange();
$... | php | {
"resource": ""
} |
q266968 | Maths.getDirectionByPoints | test | public static function getDirectionByPoints(PointInterface $point1, PointInterface $point2)
{
if (self::areSameSpace($point1, $point2)) {
$directions = array(
0 => self::getDirectionByCoordinates($point1->getAbscissa(), $point2->getAbscissa())
);
if ($poin... | php | {
"resource": ""
} |
q266969 | Maths.getDirectionByCoordinates | test | public static function getDirectionByCoordinates($a, $b)
{
if ($a < $b) {
return self::DIRECTION_POSITIVE;
} elseif ($a > $b) {
| php | {
"resource": ""
} |
q266970 | ActiveQuery.all | test | public function all($db = null)
{
if ($this->emulateExecution) {
return resolve([]);
}
return $this->createCommand($db)->thenLazy(
function(CommandInterface $command) {
return $command->queryAll();
| php | {
"resource": ""
} |
q266971 | ActiveQuery.prepareAsyncVia | test | protected function prepareAsyncVia() {
// lazy loading of a relation
$where = $this->where;
$promise = new LazyPromise(function() {
return resolve(true);
});
if ($this->via instanceof self) {
// via junction table
$promise->thenLazy(
... | php | {
"resource": ""
} |
q266972 | ActiveQuery.removeDuplicatedModels | test | private function removeDuplicatedModels($models)
{
$hash = [];
/* @var $class ActiveRecordInterface */
$class = $this->modelClass;
$pks = $class::primaryKey();
if (count($pks) > 1) {
// composite primary key
foreach ($models as $i => $model) {
... | php | {
"resource": ""
} |
q266973 | ActiveQuery.one | test | public function one($db = null)
{
if ($this->emulateExecution) {
return reject(false);
}
return $this->createCommand($db)->thenLazy(
function(CommandInterface $command) {
return $command->queryOne();
}
)->thenLazy(
func... | php | {
"resource": ""
} |
q266974 | HeaderSecurity.isValid | test | public static function isValid(string $value): bool
{
// Look for:
// \n not preceded by \r, OR
// \r not followed by \n, OR
// \r\n not followed by space or horizontal tab; these are all CRLF attacks
if (preg_match("#(?:(?:(?<!\r)\n)|(?:\r(?!\n))|(?:\r\n(?![ \t])))#", $value... | php | {
"resource": ""
} |
q266975 | HeaderSecurity.assertValid | test | public static function assertValid(string $value): void
{
if (! self::isValid($value)) {
throw new InvalidArgumentException(
sprintf(
| php | {
"resource": ""
} |
q266976 | Tunes.request | test | public function request()
{
if ('' !== $this->defaultOptions['callback']) {
$msg = 'Cannot run query when callback is set. Get query using getRawRequestUrl().';
throw new \BadMethodCallException($msg);
}
$this->buildSpecificRequestUri();
try {
if... | php | {
"resource": ""
} |
q266977 | Tunes.buildRequestUri | test | protected function buildRequestUri()
{
$requestParameters = array();
// add entity
if (!empty($this->defaultOptions['entity'])) {
$tmp = array_keys($this->defaultOptions['entity']);
$key = array_pop($tmp);
$requestParameters[] = 'entity=' . $this->default... | php | {
"resource": ""
} |
q266978 | Tunes.setLanguage | test | public function setLanguage($language = 'en_us')
{
if (in_array($language, $this->languageList)) {
| php | {
"resource": ""
} |
q266979 | Tunes.setMediaType | test | public function setMediaType($mediatype = self::MEDIATYPE_ALL)
{
if (in_array($mediatype, $this->mediaTypes)) {
| php | {
"resource": ""
} |
q266980 | Tunes.setResultFormat | test | public function setResultFormat($format = self::RESULT_ARRAY)
{
if (in_array($format, $this->resultFormats)) {
| php | {
"resource": ""
} |
q266981 | Tunes.setLimit | test | public function setLimit($limit = 100)
{
// the limit must be within the boundaries of the service
if ($limit <= 0 || $limit > 200) {
throw | php | {
"resource": ""
} |
q266982 | Tunes.setEntity | test | public function setEntity($entity = array())
{
// check if only one entry is given
if (count($entity) <> 1) {
throw new \InvalidArgumentException('Must be set with one key/value-pair!');
}
// fetch key from parameter
| php | {
"resource": ""
} |
q266983 | Tunes.setAttribute | test | public function setAttribute($attribute = '')
{
if ('' === $this->defaultOptions['mediaType']) {
throw new \InvalidArgumentException('Attribute relates to media type but no media type is set.');
}
// check if the attribute is in the set of attributes for media type
if (i... | php | {
"resource": ""
} |
q266984 | Tunes.setCallback | test | public function setCallback($callback = '')
{
if (self::RESULT_JSON !== $this->getResultFormat()) {
throw new \BadMethodCallException('Callback can only be | php | {
"resource": ""
} |
q266985 | Tunes.setExplicit | test | public function setExplicit($setting = 'yes')
{
if (in_array($setting, $this->explicitTypes)) {
| php | {
"resource": ""
} |
q266986 | ApiPhoto.getPhotos | test | protected function getPhotos($galleryId)
{
if (! is_null($ids = | php | {
"resource": ""
} |
q266987 | PEAR_Common.log | test | function log($level, $msg, $append_crlf = true)
{
if ($this->debug >= $level) {
if (!class_exists('PEAR_Frontend')) {
require_once 'PEAR/Frontend.php';
}
$ui = &PEAR_Frontend::singleton();
| php | {
"resource": ""
} |
q266988 | PEAR_Common.mkTempDir | test | function mkTempDir($tmpdir = '')
{
$topt = $tmpdir ? array('-t', $tmpdir) : array();
$topt = array_merge($topt, array('-d', 'pear'));
if (!class_exists('System')) {
require_once 'System.php';
}
| php | {
"resource": ""
} |
q266989 | PEAR_Common.infoFromTgzFile | test | function infoFromTgzFile($file)
{
$packagefile = &new PEAR_PackageFile($this->config);
$pf | php | {
"resource": ""
} |
q266990 | PEAR_Common.infoFromDescriptionFile | test | function infoFromDescriptionFile($descfile)
{
$packagefile = &new PEAR_PackageFile($this->config);
$pf | php | {
"resource": ""
} |
q266991 | PEAR_Common.infoFromString | test | function infoFromString($data)
{
$packagefile = &new PEAR_PackageFile($this->config);
$pf | php | {
"resource": ""
} |
q266992 | PEAR_Common.infoFromAny | test | function infoFromAny($info)
{
if (is_string($info) && file_exists($info)) {
$packagefile = &new PEAR_PackageFile($this->config);
$pf = &$packagefile->fromAnyFile($info, PEAR_VALIDATE_NORMAL);
if (PEAR::isError($pf)) {
$errs = $pf->getUserinfo();
... | php | {
"resource": ""
} |
q266993 | Articles.getWithOffers | test | public function getWithOffers()
{
if ((int) $this->id <= 0) {
throw new NullPointerException("Id is not set.");
}
// build url
$url = $this->base_url . str_replace("{id}", $this->id, $this->_url_offers);
// get data from server | php | {
"resource": ""
} |
q266994 | Articles.getAllWithOffers | test | public function getAllWithOffers()
{
// build url
$url = $this->base_url . $this->_url_all_offers;
// get data from server
$data = $this->getDataFromUrl($url);
| php | {
"resource": ""
} |
q266995 | Articles.search | test | public function search()
{
if (strlen($this->ean) <= 0) {
throw new NullPointerException("EAN is not set.");
}
$params = array(
"ean" => $this->ean
);
$url = $this->base_url . self::URL_SEARCH . "?" . http_build_query($params);
| php | {
"resource": ""
} |
q266996 | Logger.setFileHandler | test | protected function setFileHandler(string $logFile, int $logLevel = null)
{
$this->logFile = $logFile;
| php | {
"resource": ""
} |
q266997 | Logger.setMailHandler | test | protected function setMailHandler(string $emailTo, string $emailSubject, string $emailFrom, int $logLevel)
| php | {
"resource": ""
} |
q266998 | Logger.getLogs | test | public function getLogs(int $limit = 0)
{
if (!file_exists($this->logFile)) {
return [];
}
$lineCount = 0;
$fileAsc = file($this->logFile);
$file = array_reverse($fileAsc);
$arrOutput = [];
foreach ($file as $row) {
$currentRow = $this-... | php | {
"resource": ""
} |
q266999 | Logger.makeLogRow | test | protected function makeLogRow(string $row)
{
//[2017-07-22 23:06:48]
$date = substr($row, 1, 19);
if (!Validator::validateDate($date)) {
return false;
}
$fullMsg = substr($row, 22);
$arrMsg = explode(":", $fullMsg);
$logLevel = $arrMsg[0];
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.