_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q261700
Map.setStreetViewControl
test
public function setStreetViewControl() { $args = func_get_args(); if (isset($args[0]) && ($args[0] instanceof StreetViewControl)) { $this->streetViewControl = $args[0]; $this->mapOptions['streetViewControl'] = true; } elseif (isset($args[0]) && is_string($args[0])) {...
php
{ "resource": "" }
q261701
Map.setZoomControl
test
public function setZoomControl() { $args = func_get_args(); if (isset($args[0]) && ($args[0] instanceof ZoomControl)) { $this->zoomControl = $args[0]; $this->mapOptions['zoomControl'] = true; } elseif ((isset($args[0]) && is_string($args[0])) && (isset($args[1]) && i...
php
{ "resource": "" }
q261702
Map.addMarker
test
public function addMarker(Marker $marker) { $this->markerCluster->addMarker($marker); if ($this->autoZoom) { $this->bound->extend($marker); } }
php
{ "resource": "" }
q261703
Map.addInfoWindow
test
public function addInfoWindow(InfoWindow $infoWindow) { $this->infoWindows[] = $infoWindow; if ($this->autoZoom) { $this->bound->extend($infoWindow); } }
php
{ "resource": "" }
q261704
Map.addPolyline
test
public function addPolyline(Polyline $polyline) { $this->polylines[] = $polyline; if ($this->autoZoom) { $this->bound->extend($polyline); } }
php
{ "resource": "" }
q261705
Map.addEncodedPolyline
test
public function addEncodedPolyline(EncodedPolyline $encodedPolyline) { $this->encodedPolylines[] = $encodedPolyline; if ($this->autoZoom) { $this->bound->extend($encodedPolyline); } }
php
{ "resource": "" }
q261706
Map.addPolygon
test
public function addPolygon(Polygon $polygon) { $this->polygons[] = $polygon; if ($this->autoZoom) { $this->bound->extend($polygon); } }
php
{ "resource": "" }
q261707
Map.addRectangle
test
public function addRectangle(Rectangle $rectangle) { $this->rectangles[] = $rectangle; if ($this->autoZoom) { $this->bound->extend($rectangle); } }
php
{ "resource": "" }
q261708
Map.addCircle
test
public function addCircle(Circle $circle) { $this->circles[] = $circle; if ($this->autoZoom) { $this->bound->extend($circle); } }
php
{ "resource": "" }
q261709
Map.addGroundOverlay
test
public function addGroundOverlay(GroundOverlay $groundOverlay) { $this->groundOverlays[] = $groundOverlay; if ($this->autoZoom) { $this->bound->extend($groundOverlay); } }
php
{ "resource": "" }
q261710
FileItem.set
test
public function set($value = null, $ttl = null) { $now = new DateTime(); // whoever came up with the idea of allowing int AND datetime... // so lets convert this to an int (its a time to live, not a date to delete ffs) if ($ttl instanceof DateTime) { $ttl = $ttl->getTime...
php
{ "resource": "" }
q261711
FileItem.delete
test
public function delete() { if (file_exists($this->filename)) { unlink($this->filename); } $this->hit = false; $this->value = null; return $this; }
php
{ "resource": "" }
q261712
DirectionsRequest.setAvoidHighways
test
public function setAvoidHighways($avoidHighways = null) { if (!is_bool($avoidHighways) && ($avoidHighways !== null)) { throw DirectionsException::invalidDirectionsRequestAvoidHighways(); } $this->avoidHighways = $avoidHighways; }
php
{ "resource": "" }
q261713
DirectionsRequest.setAvoidTolls
test
public function setAvoidTolls($avoidTolls = null) { if (!is_bool($avoidTolls) && ($avoidTolls !== null)) { throw DirectionsException::invalidDirectionsRequestAvoidTolls(); } $this->avoidTolls = $avoidTolls; }
php
{ "resource": "" }
q261714
DirectionsRequest.setDestination
test
public function setDestination() { $args = func_get_args(); if (isset($args[0]) && is_string($args[0])) { $this->destination = $args[0]; } elseif (isset($args[0]) && ($args[0] instanceof Coordinate)) { $this->destination = $args[0]; } elseif ((isset($args[0])...
php
{ "resource": "" }
q261715
DirectionsRequest.setOptimizeWaypoints
test
public function setOptimizeWaypoints($optimizeWaypoints = null) { if (!is_bool($optimizeWaypoints) && ($optimizeWaypoints !== null)) { throw DirectionsException::invalidDirectionsRequestOptimizeWaypoints(); } $this->optimizeWaypoints = $optimizeWaypoints; }
php
{ "resource": "" }
q261716
DirectionsRequest.setOrigin
test
public function setOrigin() { $args = func_get_args(); if (isset($args[0]) && is_string($args[0])) { $this->origin = $args[0]; } elseif (isset($args[0]) && ($args[0] instanceof Coordinate)) { $this->origin = $args[0]; } elseif ((isset($args[0]) && is_numeric(...
php
{ "resource": "" }
q261717
DirectionsRequest.setProvideRouteAlternatives
test
public function setProvideRouteAlternatives($provideRouteAlternatives = null) { if (!is_bool($provideRouteAlternatives) && ($provideRouteAlternatives !== null)) { throw DirectionsException::invalidDirectionsRequestProvideRouteAlternatives(); } $this->provideRouteAlternatives = $...
php
{ "resource": "" }
q261718
DirectionsRequest.setRegion
test
public function setRegion($region = null) { if ((!is_string($region) || (strlen($region) !== 2)) && ($region !== null)) { throw DirectionsException::invalidDirectionsRequestRegion(); } $this->region = $region; }
php
{ "resource": "" }
q261719
DirectionsRequest.setLanguage
test
public function setLanguage($language = null) { if ((!is_string($language) || ((strlen($language) !== 2) && (strlen($language) !== 5))) && ($language !== null)) { throw DirectionsException::invalidDirectionsRequestLanguage(); } $this->language = $language; }
php
{ "resource": "" }
q261720
DirectionsRequest.setTravelMode
test
public function setTravelMode($travelMode = null) { if (!in_array($travelMode, TravelMode::getTravelModes()) && ($travelMode !== null)) { throw DirectionsException::invalidDirectionsRequestTravelMode(); } $this->travelMode = $travelMode; }
php
{ "resource": "" }
q261721
DirectionsRequest.setUnitSystem
test
public function setUnitSystem($unitSystem = null) { if (!in_array($unitSystem, UnitSystem::getUnitSystems()) && ($unitSystem !== null)) { throw DirectionsException::invalidDirectionsRequestUnitSystem(); } $this->unitSystem = $unitSystem; }
php
{ "resource": "" }
q261722
DirectionsRequest.setWaypoints
test
public function setWaypoints(array $waypoints = array()) { $this->waypoints = array(); foreach ($waypoints as $waypoint) { $this->addWaypoint($waypoint); } }
php
{ "resource": "" }
q261723
DirectionsRequest.addWaypoint
test
public function addWaypoint() { $args = func_get_args(); if (isset($args[0]) && ($args[0] instanceof DirectionsWaypoint)) { $this->waypoints[] = $args[0]; } elseif ((isset($args[0]) && is_numeric($args[0])) && (isset($args[1]) && is_numeric($args[1]))) { $waypoint = ...
php
{ "resource": "" }
q261724
DirectionsRequest.isValid
test
public function isValid() { $isValid = $this->hasDestination() && $this->hasOrigin(); for ($i = 0; $isValid && ($i < count($this->waypoints)); $i++) { $isValid = $this->waypoints[$i]->isValid(); } if ($this->getTravelMode() === TravelMode::TRANSIT) { $isVali...
php
{ "resource": "" }
q261725
GitHub.postJson
test
public function postJson(string $url, $data, array $args = []): \StdClass { return $this->submitJson($url, $data, array_merge($args, ['method' => 'POST'])); }
php
{ "resource": "" }
q261726
Debugging.logIssue
test
public function logIssue($data = [], string $note = '', string $event = ''): Exception { if (func_num_args() === 1 && is_string($data)) { $note = $data; // Use data as note. $data = []; // Data empty in this case. } $event = $event ?: $this->traceLogEventTrigger(); ...
php
{ "resource": "" }
q261727
Debugging.logReview
test
public function logReview($data = [], string $note = '', string $event = ''): int { if (func_num_args() === 1 && is_string($data)) { $note = $data; // Use data as note. $data = []; // Data empty in this case. } $event = $event ?: $this->traceLogEventTrigger(); ...
php
{ "resource": "" }
q261728
Debugging.writeLogFileLines
test
protected function writeLogFileLines(string $event, array $lines): int { if (!$lines) { // No lines? return 0; // Stop; nothing to do here. } $this->prepareLogsDir(); // Prepares (and secures). if (mb_strpos($event, '#') !== false) { $file_name = mb_strstr($e...
php
{ "resource": "" }
q261729
Debugging.cleanLogEvent
test
protected function cleanLogEvent(string $event): string { if (($classes_pos = mb_strripos($event, '\\Classes\\')) !== false) { $event = mb_substr($event, $classes_pos + 9); } // This chops off `*\Classes\` from `__METHOD__`. $event = str_replace($this->App->namespace, '', $event)...
php
{ "resource": "" }
q261730
Debugging.maybeRotateLogFiles
test
protected function maybeRotateLogFiles(string $file) { if (!$file || !is_file($file)) { return; // Nothing to do at this time. } elseif (filesize($file) < $this->max_log_file_size) { return; // Nothing to do at this time. } // Only rotate when log file becomes large. ...
php
{ "resource": "" }
q261731
UrlRemote.response
test
public function response(string $url, array $args = []): \StdClass { return $this->curl($url, array_merge($args, ['return' => 'object'])); }
php
{ "resource": "" }
q261732
DocumentParser.parse
test
public function parse(string $source): Contracts\Document { $content = $this->parseContent($source); $metadata = $this->parseMetadata($this->parseHeader($source)); return $this->buildDocument($content, $metadata); }
php
{ "resource": "" }
q261733
DocumentParser.buildDocument
test
public function buildDocument(string $content, array $metadata): Contracts\Document { $document = $this->documentResolver; $document->setContent($content); $document->set($metadata); return $document; }
php
{ "resource": "" }
q261734
DocumentParser.parseSection
test
public function parseSection(string $source, int $offset): string { $sections = preg_split(self::SECTION_SPLITTER, $source, 2); if (count($sections) != 2) { throw new TooFewSectionsException(); } return trim($sections[$offset]); }
php
{ "resource": "" }
q261735
DocumentParser.parseMetadata
test
public function parseMetadata(string $source): array { $yaml = Yaml::parse($source); if (! is_array($yaml)) { throw new ParseException('The YAML value does not appear to be valid UTF-8.', -1, null, null); } return $yaml; }
php
{ "resource": "" }
q261736
Route.queryVar
test
public function queryVar(string $key): string { if (isset($this->query_vars[$key])) { return $this->query_vars[$key]; } $value = ''; // Initialize. if (isset($_REQUEST[$key])) { $value = (string) $_REQUEST[$key]; $value = $this->c::unslash($value)...
php
{ "resource": "" }
q261737
Route.get
test
protected function get(string $file, array $vars = [], string $dir = ''): string { $template_vars = $this->vars; // Route vars as template vars. if (isset($template_vars[$file])) { // File-specific vars? $template_vars = array_replace_recursive($template_vars, $template_vars[$file]); ...
php
{ "resource": "" }
q261738
Twitter.getRemote
test
public function getRemote(array $args = []): TwitterOAuth { $default_args = $this->default_credentials; $args += $default_args; $hash = $this->remoteHash($args); if (isset($this->remotes[$hash])) { return $this->remotes[$hash]; } return $this->remotes[$h...
php
{ "resource": "" }
q261739
Twitter.remoteHash
test
protected function remoteHash(array $args = []): string { $default_args = $this->default_credentials; $args += $default_args; $args = array_intersect_key($args, $default_args); $args = array_map('strval', $args); return $hash = sha1(serialize($args)); }
php
{ "resource": "" }
q261740
Transliterate.toAscii
test
public function toAscii($value) { if (is_array($value) || is_object($value)) { foreach ($value as $_key => &$_value) { $_value = $this->toAscii($_value); } // unset($_key, $_value); return $value; } if (!($string = (string) $value)) { ...
php
{ "resource": "" }
q261741
DistanceMatrixStatus.getDistanceMatrixStatus
test
public static function getDistanceMatrixStatus() { return array( self::INVALID_REQUEST, self::MAX_DIMENSIONS_EXCEEDED, self::MAX_ELEMENTS_EXCEEDED, self::OK, self::OVER_QUERY_LIMIT, self::REQUEST_DENIED, self::UNKNOWN_ERROR,...
php
{ "resource": "" }
q261742
Indents.stripLeading
test
public function stripLeading($value, $trim = true) { if (is_array($value) || is_object($value)) { foreach ($value as $_key => &$_value) { $_value = $this->stripLeading($_value, $trim); } // unset($_key, $_value); return $value; } if (!($str...
php
{ "resource": "" }
q261743
DirectionsLeg.setSteps
test
public function setSteps(array $steps) { $this->steps = array(); foreach ($steps as $step) { $this->addStep($step); } }
php
{ "resource": "" }
q261744
Directions.route
test
public function route() { $args = func_get_args(); if (isset($args[0]) && ($args[0] instanceof DirectionsRequest)) { $directionsRequest = $args[0]; } elseif ((isset($args[0]) && is_string($args[0])) && (isset($args[1]) && is_string($args[1]))) { $directionsRequest = ...
php
{ "resource": "" }
q261745
Directions.buildDirectionsResponse
test
protected function buildDirectionsResponse(\stdClass $directionsResponse) { $routes = $this->buildDirectionsRoutes($directionsResponse->routes); $status = $directionsResponse->status; return new DirectionsResponse($routes, $status); }
php
{ "resource": "" }
q261746
Directions.buildDirectionsRoutes
test
protected function buildDirectionsRoutes(array $directionsRoutes) { $results = array(); foreach ($directionsRoutes as $directionsRoute) { $results[] = $this->buildDirectionsRoute($directionsRoute); } return $results; }
php
{ "resource": "" }
q261747
Directions.buildDirectionsRoute
test
protected function buildDirectionsRoute(\stdClass $directionsRoute) { $bound = new Bound( new Coordinate($directionsRoute->bounds->southwest->lat, $directionsRoute->bounds->southwest->lng), new Coordinate($directionsRoute->bounds->northeast->lat, $directionsRoute->bounds->northeast->...
php
{ "resource": "" }
q261748
Directions.buildDirectionsLegs
test
protected function buildDirectionsLegs(array $directionsLegs) { $results = array(); foreach ($directionsLegs as $directionsLeg) { $results[] = $this->buildDirectionsLeg($directionsLeg); } return $results; }
php
{ "resource": "" }
q261749
Directions.buildDirectionsLeg
test
protected function buildDirectionsLeg(\stdClass $directionsLeg) { $distance = new Distance($directionsLeg->distance->text, $directionsLeg->distance->value); $duration = new Duration($directionsLeg->duration->text, $directionsLeg->duration->value); $endAddress = $directionsLeg->end_address; ...
php
{ "resource": "" }
q261750
Directions.buildDirectionsSteps
test
protected function buildDirectionsSteps(array $directionsSteps) { $results = array(); foreach ($directionsSteps as $directionsStep) { $results[] = $this->buildDirectionsStep($directionsStep); } return $results; }
php
{ "resource": "" }
q261751
Directions.buildDirectionsStep
test
protected function buildDirectionsStep(\stdClass $directionsStep) { $distance = new Distance($directionsStep->distance->text, $directionsStep->distance->value); $duration = new Duration($directionsStep->duration->text, $directionsStep->duration->value); $endLocation = new Coordinate($directi...
php
{ "resource": "" }
q261752
HSL.lighten
test
public function lighten($pct) { $lightness = $this->lightness() + $pct; $lightness = $lightness > 100 ? 100 : $lightness; return $this->withLightness($lightness); }
php
{ "resource": "" }
q261753
HSL.darken
test
public function darken($pct) { $lightness = $this->lightness() - $pct; $lightness = $lightness < 0 ? 0 : $lightness; return $this->withLightness($lightness); }
php
{ "resource": "" }
q261754
HSL.saturate
test
public function saturate($pct) { $saturation = $this->saturation() + $pct; $saturation = $saturation > 100 ? 100 : $saturation; return $this->withSaturation($saturation); }
php
{ "resource": "" }
q261755
HSL.desaturate
test
public function desaturate($pct) { $saturation = $this->saturation() - $pct; $saturation = $saturation < 0 ? 0 : $saturation; return $this->withSaturation($saturation); }
php
{ "resource": "" }
q261756
HSL.mix
test
public function mix(HSL $color) { return new self(...mixHSL( $this->hue(), $this->saturation(), $this->lightness(), $color->hue(), $color->saturation(), $color->lightness() )); }
php
{ "resource": "" }
q261757
Session.start
test
public function start(string $name = '', array $options = []) { if (session_status() !== \PHP_SESSION_NONE) { throw $this->c::issue('Expecting inactive session.'); } // Expecting inactive so we can start below. if ($name) { session_name($name); } $opt...
php
{ "resource": "" }
q261758
WsVersion.isValid
test
public function isValid(string $version): bool { if (!$version) { return false; // Nope. } return (bool) preg_match($this::WS_VERSION_REGEX_VALID, $version); }
php
{ "resource": "" }
q261759
WsVersion.isValidDev
test
public function isValidDev(string $version): bool { if (!$version) { return false; // Nope. } return (bool) preg_match($this::WS_VERSION_REGEX_VALID_DEV, $version); }
php
{ "resource": "" }
q261760
WsVersion.isValidStable
test
public function isValidStable(string $version): bool { if (!$version) { return false; // Nope. } return (bool) preg_match($this::WS_VERSION_REGEX_VALID_STABLE, $version); }
php
{ "resource": "" }
q261761
WsVersion.date
test
public function date(string $version, string $format = 'F jS, Y'): string { if (!$format) { return ''; // Not possible. } elseif (!($time = $this->time($version))) { return ''; // Not possible. } return date($format, $time); }
php
{ "resource": "" }
q261762
WsVersion.time
test
public function time(string $version): int { if (!$version) { return 0; // Not possible. } elseif (!$this->isValid($version)) { return 0; // Invalid version. } $Y = substr(date('Y'), 0, 2).substr($version, 0, 2); $m = substr($version, 2, 2); // Month. ...
php
{ "resource": "" }
q261763
Response.withNoCache
test
public function withNoCache(): self { $clone = $this->withoutHeader('last-modified'); foreach ($this->App->c::noCacheHeadersArray() as $_header => $_value) { $clone = $clone->withHeader($_header, $_value); } // unset($_header, $_value); return $clone; // Response. }
php
{ "resource": "" }
q261764
Response.withSuccess
test
public function withSuccess(int $status, $data, bool $as_json = null): self { $is_data_array = is_array($data); if (!isset($as_json) && $is_data_array) { $as_json = $this->App->c::isApi() || $this->App->c::isAjax(); } if ($as_json) { // Format as JSON? $conte...
php
{ "resource": "" }
q261765
Response.withError
test
public function withError(int $status, $data, bool $as_json = null): self { $is_data_error = $data && $this->App->c::isError($data); if (!isset($as_json) && $is_data_error) { $as_json = $this->App->c::isApi() || $this->App->c::isAjax(); } if ($as_json) { // Format as JSO...
php
{ "resource": "" }
q261766
Response.output
test
public function output(array $args = []) { $default_args = [ 'exit' => false, ]; $args += $default_args; // Merge defaults. $args['exit'] = (bool) $args['exit']; if ($this->hasNoCache()) { $this->App->c::noCacheFlags(); } $status = $...
php
{ "resource": "" }
q261767
DirectionsRoute.setLegs
test
public function setLegs(array $legs) { $this->legs = array(); foreach ($legs as $leg) { $this->addLeg($leg); } }
php
{ "resource": "" }
q261768
DirectionsRoute.setWarnings
test
public function setWarnings(array $warnings) { $this->warnings = array(); foreach ($warnings as $warning) { $this->addWarning($warning); } }
php
{ "resource": "" }
q261769
DirectionsRoute.setWaypointOrder
test
public function setWaypointOrder(array $waypointOrder) { $this->waypointOrder = array(); foreach ($waypointOrder as $waypointOrder) { $this->addWaypointOrder($waypointOrder); } }
php
{ "resource": "" }
q261770
ZoomControlStyleHelper.render
test
public function render($zoomControlStyle) { switch ($zoomControlStyle) { case ZoomControlStyle::DEFAULT_: case ZoomControlStyle::LARGE: case ZoomControlStyle::SMALL: return sprintf('google.maps.ZoomControlStyle.%s', strtoupper($zoomControlStyle)); ...
php
{ "resource": "" }
q261771
Document.get
test
public function get(?string $key = null) { if (is_null($key)) { return $this->metadata; } if (! array_key_exists($key, $this->metadata)) { return null; } return $this->metadata[$key]; }
php
{ "resource": "" }
q261772
OAuthServer.issueToken
test
public function issueToken(Request $Request, Response $Response) { try { // Handles `/(access|refresh)-token` endpoints. $AuthorizationServer = $this->authorizationServer(); $Response = $AuthorizationServer->respondToAccessTokenRequest($Request, $Response); $Re...
php
{ "resource": "" }
q261773
OAuthServer.resourceRequest
test
public function resourceRequest(Request $Request, Response $Response): Request { try { // Authenticate resource request. $ResourceServer = $this->resourceServer(); return $Request = $ResourceServer->validateAuthenticatedRequest($Request); // } catch (OAuthServerEx...
php
{ "resource": "" }
q261774
OAuthServer.accessTokenRepository
test
protected function accessTokenRepository(): AccessTokenRepository { if ($this->AccessTokenRepository) { return $this->AccessTokenRepository; } return $this->AccessTokenRepository = $this->App->Di->get(AccessTokenRepository::class); }
php
{ "resource": "" }
q261775
Slashes.add
test
public function add($value) { if (is_array($value) || is_object($value)) { foreach ($value as $_key => &$_value) { $_value = $this->add($_value); } // unset($_key, $_value); return $value; } $string = (string) $value; return addsla...
php
{ "resource": "" }
q261776
Slashes.remove
test
public function remove($value) { if (is_array($value) || is_object($value)) { foreach ($value as $_key => &$_value) { $_value = $this->remove($_value); } // unset($_key, $_value); return $value; } $string = (string) $value; return ...
php
{ "resource": "" }
q261777
ApiHelper.render
test
public function render( $language = 'en', array $libraries = array(), $callback = null, $api_key = null ) { $otherParameters = array(); if (!empty($libraries)) { $otherParameters['libraries'] = implode(',', $libraries); } $otherParame...
php
{ "resource": "" }
q261778
DistanceMatrixResponseRow.setElements
test
public function setElements(array $elements) { $this->elements = array(); foreach ($elements as $element) { $this->addElement($element); } }
php
{ "resource": "" }
q261779
ControlPositionHelper.render
test
public function render($controlPosition) { switch ($controlPosition) { case ControlPosition::BOTTOM_CENTER: case ControlPosition::BOTTOM_LEFT: case ControlPosition::BOTTOM_RIGHT: case ControlPosition::LEFT_BOTTOM: case ControlPosition::LEFT_CENTER:...
php
{ "resource": "" }
q261780
Ip.current
test
public function current(): string { if (($ip = &$this->cacheKey(__FUNCTION__)) !== null) { return $ip; // Already cached this. } if ($this->c::isCli()) { throw $this->c::issue('Not possible in CLI mode.'); } // @TODO Try detecting IP address in CLI mode. ...
php
{ "resource": "" }
q261781
Ip.region
test
public function region(string $ip): string { if (($geo = $this->geoData($ip))) { return $geo->region; } return ''; // Failure. }
php
{ "resource": "" }
q261782
Ip.country
test
public function country(string $ip): string { if (!empty($_SERVER['HTTP_CF_IPCOUNTRY']) // Save time. && $ip === $_SERVER['HTTP_CF_CONNECTING_IP'] ?? '' && $ip === $this->current() && mb_strlen((string) $_SERVER['HTTP_CF_IPCOUNTRY']) === 2) { return (string) $_SERVER['HTT...
php
{ "resource": "" }
q261783
RequestType.isAjax
test
public function isAjax(bool $flag = null): bool { if (isset($flag)) { $this->is_ajax = $flag; } if (!isset($this->is_ajax) && $this->is_wordpress) { if (defined('DOING_AJAX') && DOING_AJAX) { $this->is_ajax = true; // Via WP constants. } ...
php
{ "resource": "" }
q261784
RequestType.isApi
test
public function isApi(bool $flag = null): bool { if (isset($flag)) { $this->is_api = $flag; } if (!isset($this->is_api) && $this->is_wordpress) { if ((defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) || (defined('REST_REQUEST') && REST_REQUEST)) { $this->i...
php
{ "resource": "" }
q261785
RequestType.doingRestAction
test
public function doingRestAction(string $action = null): string { if (isset($action)) { $this->doing_rest_action = $action; $this->doingAction($action, true); } return (string) $this->doing_rest_action; }
php
{ "resource": "" }
q261786
RequestType.doingAction
test
public function doingAction(string $action = '', bool $flag = null): bool { if ($action && isset($flag)) { $this->doing_actions[$action] = $flag; } if ($action) { return $this->doing_actions[$action] ?? false; } else { return !empty($this->doing_ac...
php
{ "resource": "" }
q261787
MailChimpClient.subscribeNewUser
test
public static function subscribeNewUser($email,$listid,$confirm = false){ $data = [ 'email_address' => $email, 'status' => ($confirm ? 'pending' : 'subscribed'), ]; if (!empty($merge_fields)) $data['merge_fields'] = $merge_fields; $action = self::$api_version.'/lists/'.$listid.'/member...
php
{ "resource": "" }
q261788
MailChimpClient.getMember
test
public function getMember($email,$listid) { $action = "lists/".$listid."/members/" . md5($email); return self::getData($action); }
php
{ "resource": "" }
q261789
MailChimpClient.updateUser
test
public static function updateUser($listid,$email,$status) { $data = [ 'status' => $status ]; if (!empty($merge_fields)) $data['merge_fields'] = $merge_fields; $action = self::$api_version.'/lists/'.$listid.'/members/'. md5($email); return self::send($action, 'PATCH', $data); ...
php
{ "resource": "" }
q261790
MailChimpClient.deleteUser
test
public static function deleteUser($listid,$email) { $email=md5($email); $action = self::$api_version.'/lists/'.$listid.'/members/'. $email; return self::send($action, 'DELETE', []); }
php
{ "resource": "" }
q261791
Color.sha1
test
public function sha1(string $string, float $adjust = 0): string { $hex = '#'.mb_substr(sha1($string), 0, 6); return $hex = $adjust ? $this->adjustLuminosity($hex, $adjust) : $hex; }
php
{ "resource": "" }
q261792
Color.adjustLuminosity
test
public function adjustLuminosity(string $hex, float $adjust): string { $hex = $this->cleanHex($hex); for ($adjusted_hex = '', $_dec, $_hex, $_i = 0; $_i < 3; ++$_i) { $_dec = hexdec(mb_substr($hex, $_i * 2, 2)); $_hex = dechex(round(min(max(0, $_dec + ($_dec * $adjust)), 255...
php
{ "resource": "" }
q261793
Color.cleanHex
test
public function cleanHex(string $hex): string { $hex = ltrim($hex, '#'); if (!isset($hex[5])) { $hex = preg_replace('/(.)/u', '$1$1', $hex); $hex = $this->c::mbStrPad($hex, 6, '0'); } return $hex; }
php
{ "resource": "" }
q261794
App.maybeEmptyNumericConfigArrays
test
public function maybeEmptyNumericConfigArrays(array $base, array $merge): array { if (!$merge) { // Save time. Merge is empty? return $base; // Nothing to do here. } foreach ($base as $_key => &$_value) { if (is_array($_value) && array_key_exists($_key, $merge)) { ...
php
{ "resource": "" }
q261795
Request.create
test
public function create(array $args = []): Classes\Core\Request { return $this->App->Di->get(Classes\Core\Request::class, $args); }
php
{ "resource": "" }
q261796
Request.createBody
test
public function createBody(string $content = null): Classes\Core\RequestBody { return $this->App->Di->get(Classes\Core\RequestBody::class, compact('content')); }
php
{ "resource": "" }
q261797
ArrayChangeRecursive.maybeEmptyNumericArrays
test
protected function maybeEmptyNumericArrays(array $array, array ...$merge): array { if (!$merge) { // Save time. Merge is empty? return $base; // Nothing to do here. } foreach ($array as $_key => &$_value) { if (is_array($_value)) { foreach ($merge as $...
php
{ "resource": "" }
q261798
RectangleHelper.render
test
public function render(Rectangle $rectangle, Map $map) { $this->jsonBuilder ->reset() ->setValue('[map]', $map->getJavascriptVariable(), false) ->setValue('[bounds]', $rectangle->getBound()->getJavascriptVariable(), false) ->setValues($rectangle->getOptions())...
php
{ "resource": "" }
q261799
Array2Xml.toHtml
test
public function toHtml(string $parent_element_name, array $array, array $args = []): string { return $this->__invoke($parent_element_name, $array, array_merge($args, ['type' => 'html'])); }
php
{ "resource": "" }