_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q261500
ControlPosition.getControlPositions
test
public static function getControlPositions() { return array( self::BOTTOM_CENTER, self::BOTTOM_LEFT, self::BOTTOM_RIGHT, self::LEFT_BOTTOM, self::LEFT_CENTER, self::LEFT_TOP, self::RIGHT_BOTTOM, self::RIGHT_CENTER, self::RIGHT_TOP, self::TOP_CENTER, self::TOP_LEFT, self::TOP_RIGHT, ); }
php
{ "resource": "" }
q261501
DirectionsResponse.setStatus
test
public function setStatus($status) { if (!in_array($status, DirectionsStatus::getDirectionsStatus())) { throw DirectionsException::invalidDirectionsResponseStatus(); } $this->status = $status; }
php
{ "resource": "" }
q261502
OverviewMapControlHelper.render
test
public function render(OverviewMapControl $overviewMapControl) { return $this->jsonBuilder ->reset() ->setValue('[opened]', $overviewMapControl->isOpened()) ->build(); }
php
{ "resource": "" }
q261503
BoundHelper.render
test
public function render(Bound $bound) { if ($bound->hasExtends() || !$bound->hasCoordinates()) { return sprintf('%s = new google.maps.LatLngBounds();'.PHP_EOL, $bound->getJavascriptVariable()); } return sprintf( '%s = new google.maps.LatLngBounds(%s, %s);'.PHP_EOL, $bound->getJavascriptVariable(), $bound->getSouthWest()->getJavascriptVariable(), $bound->getNorthEast()->getJavascriptVariable() ); }
php
{ "resource": "" }
q261504
BoundHelper.renderExtends
test
public function renderExtends(Bound $bound) { $output = array(); foreach ($bound->getExtends() as $extend) { if (($extend instanceof Marker) || ($extend instanceof InfoWindow)) { $output[] = sprintf( '%s.extend(%s.getPosition());'.PHP_EOL, $bound->getJavascriptVariable(), $extend->getJavascriptVariable() ); } elseif (($extend instanceof Polyline) || ($extend instanceof EncodedPolyline) || ($extend instanceof Polygon) ) { $output[] = sprintf( '%s.getPath().forEach(function(element){%s.extend(element)});'.PHP_EOL, $extend->getJavascriptVariable(), $bound->getJavascriptVariable() ); } elseif (($extend instanceof Rectangle) || ($extend instanceof GroundOverlay)) { $output[] = sprintf( '%s.union(%s);'.PHP_EOL, $bound->getJavascriptVariable(), $extend->getBound()->getJavascriptVariable() ); } elseif ($extend instanceof Circle) { $output[] = sprintf( '%s.union(%s.getBounds());'.PHP_EOL, $bound->getJavascriptVariable(), $extend->getJavascriptVariable() ); } } return implode('', $output); }
php
{ "resource": "" }
q261505
Benchmark.printAllStatistics
test
protected function printAllStatistics() { $longest_label_chars = 0; // Initialize. foreach ($this->stats as $_label => $_value) { $longest_label_chars = max($longest_label_chars, mb_strlen($_label)); } echo "\n\n"; // Two lines down... echo '- Benchmark ----------------------------------------'."\n"; $statistics = ''; // Initialize. foreach ($this->stats as $_label => $_value) { $_label_chars = mb_strlen($_label); $_alignment_chars = $longest_label_chars - $_label_chars; $statistics .= $_label.': '.str_repeat(' ', $_alignment_chars).$_value."\n"; } // unset($_label_chars, $_alignment_chars); echo $this->c::mbTrim($statistics)."\n"; echo '----------------------------------------------------'."\n\n"; }
php
{ "resource": "" }
q261506
MarkerCluster.setMarkers
test
public function setMarkers($markers) { $this->markers = array(); foreach ($markers as $marker) { $this->addMarker($marker); } }
php
{ "resource": "" }
q261507
MarkerClusterHelper.setHelpers
test
public function setHelpers(array $helpers) { $this->helpers = array(); foreach ($helpers as $name => $helper) { $this->setHelper($name, $helper); } }
php
{ "resource": "" }
q261508
MarkerClusterHelper.getHelper
test
public function getHelper($name) { if (!$this->hasHelper($name)) { throw HelperException::invalidMarkerClusterHelper(); } return $this->helpers[$name]; }
php
{ "resource": "" }
q261509
MapHelper.setExtensionHelpers
test
public function setExtensionHelpers(array $extensionHelpers) { $this->extensionHelpers = array(); foreach ($extensionHelpers as $name => $extensionHelper) { $this->setExtensionHelper($name, $extensionHelper); } }
php
{ "resource": "" }
q261510
MapHelper.getExtensionHelper
test
public function getExtensionHelper($name) { if (!$this->hasExtensionHelper($name)) { throw HelperException::invalidExtension($name); } return $this->extensionHelpers[$name]; }
php
{ "resource": "" }
q261511
MapHelper.removeExtensionHelper
test
public function removeExtensionHelper($name) { if (!$this->hasExtensionHelper($name)) { throw HelperException::invalidExtension($name); } unset($this->extensionHelpers[$name]); }
php
{ "resource": "" }
q261512
MapHelper.renderHtmlContainer
test
public function renderHtmlContainer(Map $map) { return sprintf( '<div id="%s" style="width:%s;height:%s;"></div>'.PHP_EOL, $map->getHtmlContainerId(), $map->getStylesheetOption('width'), $map->getStylesheetOption('height') ); }
php
{ "resource": "" }
q261513
MapHelper.renderStylesheets
test
public function renderStylesheets(Map $map) { $html = array(); $html[] = '<style type="text/css" scoped>'.PHP_EOL; $html[] = '#'.$map->getHtmlContainerId().'{'.PHP_EOL; foreach ($map->getStylesheetOptions() as $option => $value) { $html[] = $option.':'.$value.';'.PHP_EOL; } $html[] = '}'.PHP_EOL; $html[] = '</style>'.PHP_EOL; return implode('', $html); }
php
{ "resource": "" }
q261514
MapHelper.renderJavascripts
test
public function renderJavascripts(Map $map) { $output = array(); if (!$map->isAsync()) { $output[] = $this->renderJsLibraries($map); } $output[] = '<script type="text/javascript">'.PHP_EOL; $output[] = $this->renderJsBefore($map); $output[] = $this->renderJsContainer($map); $output[] = $this->renderJsAfter($map); $output[] = '</script>'.PHP_EOL; if ($map->isAsync()) { $output[] = $this->renderJsLibraries($map); } return implode('', $output); }
php
{ "resource": "" }
q261515
MapHelper.renderJsLibraries
test
public function renderJsLibraries(Map $map) { $output = array(); foreach ($this->getExtensionHelpers() as $extension) { $output[] = $extension->renderLibraries($map); } return implode('', $output); }
php
{ "resource": "" }
q261516
MapHelper.renderJsBefore
test
public function renderJsBefore(Map $map) { $output = array(); foreach ($this->getExtensionHelpers() as $extension) { $output[] = $extension->renderBefore($map); } return implode('', $output); }
php
{ "resource": "" }
q261517
MapHelper.renderJsAfter
test
public function renderJsAfter(Map $map) { $output = array(); foreach (array_reverse($this->getExtensionHelpers()) as $extension) { $output[] = $extension->renderAfter($map); } return implode('', $output); }
php
{ "resource": "" }
q261518
MapHelper.renderJsContainer
test
public function renderJsContainer(Map $map) { $output = array(); $output[] = $this->renderJsContainerInit($map); $output[] = $this->renderJsContainerCoordinates($map); $output[] = $this->renderJsContainerBounds($map); $output[] = $this->renderJsContainerPoints($map); $output[] = $this->renderJsContainerSizes($map); $output[] = $this->renderJsContainerMap($map); $output[] = $this->renderJsContainerCircles($map); $output[] = $this->renderJsContainerEncodedPolylines($map); $output[] = $this->renderJsContainerGroundOverlays($map); $output[] = $this->renderJsContainerPolygons($map); $output[] = $this->renderJsContainerPolylines($map); $output[] = $this->renderJsContainerRectangles($map); $output[] = $this->renderJsContainerInfoWindows($map); $output[] = $this->renderJsContainerMarkerImages($map); $output[] = $this->renderJsContainerMarkerShapes($map); $output[] = $this->renderJsContainerMarkerCluster($map); $output[] = $this->renderJsContainerKMLLayers($map); $output[] = $this->renderJsContainerEventManager($map); $output[] = $this->renderJsContainerExtra($map); return implode('', $output); }
php
{ "resource": "" }
q261519
MapHelper.renderJsContainerCoordinates
test
public function renderJsContainerCoordinates(Map $map) { $output = array(); foreach ($this->computeCoordinates($map) as $coordinate) { $output[] = sprintf( '%s.coordinates.%s = %s', $this->getJsContainerName($map), $coordinate->getJavascriptVariable(), $this->coordinateHelper->render($coordinate) ); } return implode('', $output); }
php
{ "resource": "" }
q261520
MapHelper.renderJsContainerBounds
test
public function renderJsContainerBounds(Map $map) { $output = array(); foreach ($this->computeBounds($map) as $bound) { $output[] = sprintf( '%s.bounds.%s = %s', $this->getJsContainerName($map), $bound->getJavascriptVariable(), $this->boundHelper->render($bound) ); } return implode('', $output); }
php
{ "resource": "" }
q261521
MapHelper.renderJsContainerPoints
test
public function renderJsContainerPoints(Map $map) { $output = array(); foreach ($this->computePoints($map) as $point) { $output[] = sprintf( '%s.points.%s = %s', $this->getJsContainerName($map), $point->getJavascriptVariable(), $this->pointHelper->render($point) ); } return implode('', $output); }
php
{ "resource": "" }
q261522
MapHelper.renderJsContainerSizes
test
public function renderJsContainerSizes(Map $map) { $output = array(); foreach ($this->computeSizes($map) as $size) { $output[] = sprintf( '%s.sizes.%s = %s', $this->getJsContainerName($map), $size->getJavascriptVariable(), $this->sizeHelper->render($size) ); } return implode('', $output); }
php
{ "resource": "" }
q261523
MapHelper.renderJsContainerMap
test
public function renderJsContainerMap(Map $map) { return sprintf('%s.map = %s', $this->getJsContainerName($map), $this->renderMap($map)); }
php
{ "resource": "" }
q261524
MapHelper.renderJsContainerCircles
test
public function renderJsContainerCircles(Map $map) { $output = array(); foreach ($map->getCircles() as $circle) { $output[] = sprintf( '%s.circles.%s = %s', $this->getJsContainerName($map), $circle->getJavascriptVariable(), $this->circleHelper->render($circle, $map) ); } return implode('', $output); }
php
{ "resource": "" }
q261525
MapHelper.renderJsContainerEncodedPolylines
test
public function renderJsContainerEncodedPolylines(Map $map) { $output = array(); foreach ($map->getEncodedPolylines() as $encodedPolyline) { $output[] = sprintf( '%s.encoded_polylines.%s = %s', $this->getJsContainerName($map), $encodedPolyline->getJavascriptVariable(), $this->encodedPolylineHelper->render($encodedPolyline, $map) ); } return implode('', $output); }
php
{ "resource": "" }
q261526
MapHelper.renderJsContainerGroundOverlays
test
public function renderJsContainerGroundOverlays(Map $map) { $output = array(); foreach ($map->getGroundOverlays() as $groundOverlay) { $output[] = sprintf( '%s.ground_overlays.%s = %s', $this->getJsContainerName($map), $groundOverlay->getJavascriptVariable(), $this->groundOverlayHelper->render($groundOverlay, $map) ); } return implode('', $output); }
php
{ "resource": "" }
q261527
MapHelper.renderJsContainerPolygons
test
public function renderJsContainerPolygons(Map $map) { $output = array(); foreach ($map->getPolygons() as $polygon) { $output[] = sprintf( '%s.polygons.%s = %s', $this->getJsContainerName($map), $polygon->getJavascriptVariable(), $this->polygonHelper->render($polygon, $map) ); } return implode('', $output); }
php
{ "resource": "" }
q261528
MapHelper.renderJsContainerPolylines
test
public function renderJsContainerPolylines(Map $map) { $output = array(); foreach ($map->getPolylines() as $polyline) { $output[] = sprintf( '%s.polylines.%s = %s', $this->getJsContainerName($map), $polyline->getJavascriptVariable(), $this->polylineHelper->render($polyline, $map) ); } return implode('', $output); }
php
{ "resource": "" }
q261529
MapHelper.renderJsContainerRectangles
test
public function renderJsContainerRectangles(Map $map) { $output = array(); foreach ($map->getRectangles() as $rectangle) { $output[] = sprintf( '%s.rectangles.%s = %s', $this->getJsContainerName($map), $rectangle->getJavascriptVariable(), $this->rectangleHelper->render($rectangle, $map) ); } return implode('', $output); }
php
{ "resource": "" }
q261530
MapHelper.renderJsContainerInfoWindows
test
public function renderJsContainerInfoWindows(Map $map) { $output = array(); $mapInfoWindows = $map->getInfoWindows(); $markerInfoWindows = $this->computeMarkerInfoWindows($map); foreach ($mapInfoWindows as $mapInfoWindow) { $output[] = sprintf( '%s.info_windows.%s = %s', $this->getJsContainerName($map), $mapInfoWindow->getJavascriptVariable(), $this->infoWindowHelper->render($mapInfoWindow) ); } foreach ($markerInfoWindows as $markerInfoWindow) { $output[] = sprintf( '%s.info_windows.%s = %s', $this->getJsContainerName($map), $markerInfoWindow->getJavascriptVariable(), $this->infoWindowHelper->render($markerInfoWindow, false) ); } foreach (array_merge($mapInfoWindows, $markerInfoWindows) as $infoWindow) { if ($infoWindow->isAutoClose()) { $output[] = sprintf( '%s.closable_info_windows.%s = %s;'.PHP_EOL, $this->getJsContainerName($map), $infoWindow->getJavascriptVariable(), $infoWindow->getJavascriptVariable() ); } } return implode('', $output); }
php
{ "resource": "" }
q261531
MapHelper.renderJsContainerMarkerImages
test
public function renderJsContainerMarkerImages(Map $map) { $output = array(); foreach ($this->computeMarkerImages($map) as $markerImage) { $output[] = sprintf( '%s.marker_images.%s = %s', $this->getJsContainerName($map), $markerImage->getJavascriptVariable(), $this->markerImageHelper->render($markerImage) ); } return implode('', $output); }
php
{ "resource": "" }
q261532
MapHelper.renderJsContainerMarkerShapes
test
public function renderJsContainerMarkerShapes(Map $map) { $output = array(); foreach ($this->computeMarkerShapes($map) as $markerShape) { $output[] = sprintf( '%s.marker_shapes.%s = %s', $this->getJsContainerName($map), $markerShape->getJavascriptVariable(), $this->markerShapeHelper->render($markerShape) ); } return implode('', $output); }
php
{ "resource": "" }
q261533
MapHelper.renderJsContainerMarkerCluster
test
public function renderJsContainerMarkerCluster(Map $map) { $output = array( $this->markerClusterHelper->renderMarkers($map->getMarkerCluster(), $map), $this->markerClusterHelper->render($map->getMarkerCluster(), $map), ); return implode('', $output); }
php
{ "resource": "" }
q261534
MapHelper.renderJsContainerKMLLayers
test
public function renderJsContainerKMLLayers(Map $map) { $output = array(); foreach ($map->getKMLLayers() as $kmlLayer) { $output[] = sprintf( '%s.kml_layers.%s = %s', $this->getJsContainerName($map), $kmlLayer->getJavascriptVariable(), $this->kmlLayerHelper->render($kmlLayer, $map) ); } return implode('', $output); }
php
{ "resource": "" }
q261535
MapHelper.renderJsContainerEventManager
test
public function renderJsContainerEventManager(Map $map) { $output = array(); foreach ($map->getEventManager()->getDomEvents() as $domEvent) { $output[] = sprintf( '%s.event_manager.dom_events.%s = %s', $this->getJsContainerName($map), $domEvent->getJavascriptVariable(), $this->eventManagerHelper->renderDomEvent($domEvent) ); } foreach ($map->getEventManager()->getDomEventsOnce() as $domEventOnce) { $output[] = sprintf( '%s.event_manager.dom_events_once.%s = %s', $this->getJsContainerName($map), $domEventOnce->getJavascriptVariable(), $this->eventManagerHelper->renderDomEventOnce($domEventOnce) ); } foreach ($map->getEventManager()->getEvents() as $event) { $output[] = sprintf( '%s.event_manager.events.%s = %s', $this->getJsContainerName($map), $event->getJavascriptVariable(), $this->eventManagerHelper->renderEvent($event) ); } foreach ($map->getEventManager()->getEventsOnce() as $eventOnce) { $output[] = sprintf( '%s.event_manager.events_once.%s = %s', $this->getJsContainerName($map), $eventOnce->getJavascriptVariable(), $this->eventManagerHelper->renderEventOnce($eventOnce) ); } return implode('', $output); }
php
{ "resource": "" }
q261536
MapHelper.renderJsContainerExtra
test
public function renderJsContainerExtra(Map $map) { $output = array(); foreach ($map->getInfoWindows() as $infoWindow) { if ($infoWindow->isOpen()) { $output[] = $this->infoWindowHelper->renderOpen($infoWindow, $map); } } foreach ($map->getMarkers() as $marker) { if ($marker->hasInfoWindow() && $marker->getInfoWindow()->isOpen()) { $output[] = $this->infoWindowHelper->renderOpen($marker->getInfoWindow(), $map, $marker); } } foreach ($this->computeBounds($map) as $bound) { if ($bound->hasExtends()) { $output[] = $this->boundHelper->renderExtends($bound); } } if ($map->isAutoZoom()) { $output[] = $this->renderMapBound($map); } else { $output[] = $this->renderMapCenter($map); } return implode('', $output); }
php
{ "resource": "" }
q261537
MapHelper.renderMap
test
public function renderMap(Map $map) { $mapTypeId = $map->getMapOption('mapTypeId'); $map->removeMapOption('mapTypeId'); $this->jsonBuilder ->reset() ->setValue('[mapTypeId]', $this->mapTypeIdHelper->render($mapTypeId), false); $this->renderMapControls($map); if ($map->isAutoZoom()) { $map->removeMapOption('zoom'); } $this->jsonBuilder->setValues($map->getMapOptions()); return sprintf( '%s = new google.maps.Map(document.getElementById("%s"), { zoom: 5, scrollwheel: false, mapTypeId: google.maps.MapTypeId.ROADMAP, zoomControl: true, mapTypeControl: false, scaleControl: false, panControl: false, navigationControl: false, streetViewControl: false, gestureHandling: "cooperative", styles: [{"featureType":"poi","elementType":"labels.text.fill","stylers":[{"color":"#747474"},{"lightness":"23"}]},{"featureType":"poi.attraction","elementType":"geometry.fill","stylers":[{"color":"#f38eb0"}]},{"featureType":"poi.government","elementType":"geometry.fill","stylers":[{"color":"#ced7db"}]},{"featureType":"poi.medical","elementType":"geometry.fill","stylers":[{"color":"#ffa5a8"}]},{"featureType":"poi.park","elementType":"geometry.fill","stylers":[{"color":"#c7e5c8"}]},{"featureType":"poi.place_of_worship","elementType":"geometry.fill","stylers":[{"color":"#d6cbc7"}]},{"featureType":"poi.school","elementType":"geometry.fill","stylers":[{"color":"#c4c9e8"}]},{"featureType":"poi.sports_complex","elementType":"geometry.fill","stylers":[{"color":"#b1eaf1"}]},{"featureType":"road","elementType":"geometry","stylers":[{"lightness":"100"}]},{"featureType":"road","elementType":"labels","stylers":[{"visibility":"off"},{"lightness":"100"}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#ffd4a5"}]},{"featureType":"road.arterial","elementType":"geometry.fill","stylers":[{"color":"#ffe9d2"}]},{"featureType":"road.local","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"road.local","elementType":"geometry.fill","stylers":[{"weight":"3.00"}]},{"featureType":"road.local","elementType":"geometry.stroke","stylers":[{"weight":"0.30"}]},{"featureType":"road.local","elementType":"labels.text","stylers":[{"visibility":"on"}]},{"featureType":"road.local","elementType":"labels.text.fill","stylers":[{"color":"#747474"},{"lightness":"36"}]},{"featureType":"road.local","elementType":"labels.text.stroke","stylers":[{"color":"#e9e5dc"},{"lightness":"30"}]},{"featureType":"transit.line","elementType":"geometry","stylers":[{"visibility":"on"},{"lightness":"100"}]},{"featureType":"water","elementType":"all","stylers":[{"color":"#d2e7f7"}]}] });'.PHP_EOL, $map->getJavascriptVariable(), $map->getHtmlContainerId()//, //$this->jsonBuilder->build() ); }
php
{ "resource": "" }
q261538
MapHelper.renderMapCenter
test
public function renderMapCenter(Map $map) { return sprintf( '%s.setCenter(%s);'.PHP_EOL, $map->getJavascriptVariable(), $map->getCenter()->getJavascriptVariable() ); }
php
{ "resource": "" }
q261539
MapHelper.renderMapBound
test
public function renderMapBound(Map $map) { return sprintf( '%s.fitBounds(%s);'.PHP_EOL, $map->getJavascriptVariable(), $map->getBound()->getJavascriptVariable() ); }
php
{ "resource": "" }
q261540
MapHelper.computeCoordinates
test
protected function computeCoordinates(Map $map) { $coordinates = array(); if (!$map->isAutoZoom() && !in_array($map->getCenter(), $coordinates)) { $coordinates[] = $map->getCenter(); } foreach ($this->computeBounds($map) as $bound) { if (!$bound->hasExtends() && $bound->hasCoordinates()) { if (!in_array($bound->getSouthWest(), $coordinates)) { $coordinates[] = $bound->getSouthWest(); } if (!in_array($bound->getNorthEast(), $coordinates)) { $coordinates[] = $bound->getNorthEast(); } } } foreach ($map->getCircles() as $circle) { if (!in_array($circle->getCenter(), $coordinates)) { $coordinates[] = $circle->getCenter(); } } foreach ($map->getInfoWindows() as $infoWindow) { if (!in_array($infoWindow->getPosition(), $coordinates)) { $coordinates[] = $infoWindow->getPosition(); } } foreach ($map->getMarkers() as $marker) { if (!in_array($marker->getPosition(), $coordinates)) { $coordinates[] = $marker->getPosition(); } } foreach ($map->getPolygons() as $polygon) { foreach ($polygon->getCoordinates() as $polygonCoordinate) { if (!in_array($polygonCoordinate, $coordinates)) { $coordinates[] = $polygonCoordinate; } } } foreach ($map->getPolylines() as $polyline) { foreach ($polyline->getCoordinates() as $polylineCoordinate) { if (!in_array($polylineCoordinate, $coordinates)) { $coordinates[] = $polylineCoordinate; } } } return $coordinates; }
php
{ "resource": "" }
q261541
MapHelper.computeBounds
test
protected function computeBounds(Map $map) { $bounds = array(); if ($map->isAutoZoom() && !in_array($map->getBound(), $bounds)) { $bounds[] = $map->getBound(); } foreach ($map->getGroundOverlays() as $groundOverlay) { if (!in_array($groundOverlay->getBound(), $bounds)) { $bounds[] = $groundOverlay->getBound(); } } foreach ($map->getRectangles() as $rectangle) { if (!in_array($rectangle->getBound(), $bounds)) { $bounds[] = $rectangle->getBound(); } } return $bounds; }
php
{ "resource": "" }
q261542
MapHelper.computePoints
test
protected function computePoints(Map $map) { $points = array(); foreach ($map->getMarkers() as $marker) { if ($marker->hasIcon()) { if ($marker->getIcon()->hasAnchor() && !in_array($marker->getIcon()->getAnchor(), $points)) { $points[] = $marker->getIcon()->getAnchor(); } if ($marker->getIcon()->hasOrigin() && !in_array($marker->getIcon()->getOrigin(), $points)) { $points[] = $marker->getIcon()->getOrigin(); } } if ($marker->hasShadow()) { if ($marker->getShadow()->hasAnchor() && !in_array($marker->getShadow()->getAnchor(), $points)) { $points[] = $marker->getShadow()->getAnchor(); } if ($marker->getShadow()->hasOrigin() && !in_array($marker->getShadow()->getOrigin(), $points)) { $points[] = $marker->getShadow()->getOrigin(); } } } return $points; }
php
{ "resource": "" }
q261543
MapHelper.computeSizes
test
protected function computeSizes(Map $map) { $sizes = array(); foreach (array_merge($map->getInfoWindows(), $this->computeMarkerInfoWindows($map)) as $infoWindow) { if ($infoWindow->hasPixelOffset() && !in_array($infoWindow->getPixelOffset(), $sizes)) { $sizes[] = $infoWindow->getPixelOffset(); } } foreach ($map->getMarkers() as $marker) { if ($marker->hasIcon()) { if ($marker->getIcon()->hasSize() && !in_array($marker->getIcon()->getSize(), $sizes)) { $sizes[] = $marker->getIcon()->getSize(); } if ($marker->getIcon()->hasScaledSize() && !in_array($marker->getIcon()->getScaledSize(), $sizes)) { $sizes[] = $marker->getIcon()->getScaledSize(); } } if ($marker->hasShadow()) { if ($marker->getShadow()->hasSize() && !in_array($marker->getShadow()->getSize(), $sizes)) { $sizes[] = $marker->getShadow()->getSize(); } if ($marker->getShadow()->hasScaledSize() && !in_array($marker->getShadow()->getScaledSize(), $sizes)) { $sizes[] = $marker->getShadow()->getScaledSize(); } } } return $sizes; }
php
{ "resource": "" }
q261544
MapHelper.computeMarkerImages
test
protected function computeMarkerImages(Map $map) { $markerImages = array(); foreach ($map->getMarkers() as $marker) { if ($marker->hasIcon() && !in_array($marker->getIcon(), $markerImages)) { $markerImages[] = $marker->getIcon(); } if ($marker->hasShadow() && !in_array($marker->getShadow(), $markerImages)) { $markerImages[] = $marker->getShadow(); } } return $markerImages; }
php
{ "resource": "" }
q261545
MapHelper.computeMarkerShapes
test
protected function computeMarkerShapes(Map $map) { $markerShapes = array(); foreach ($map->getMarkers() as $marker) { if ($marker->hasShape() && !in_array($marker->getShape(), $markerShapes)) { $markerShapes[] = $marker->getShape(); } } return $markerShapes; }
php
{ "resource": "" }
q261546
MapHelper.computeMarkerInfoWindows
test
protected function computeMarkerInfoWindows(Map $map) { $infoWinfows = array(); foreach ($map->getMarkers() as $marker) { if ($marker->hasInfoWindow() && !in_array($marker->getInfoWindow(), $infoWinfows)) { $infoWinfows[] = $marker->getInfoWindow(); } } return $infoWinfows; }
php
{ "resource": "" }
q261547
MapHelper.renderMapControls
test
protected function renderMapControls(Map $map) { $controlNames = array( 'MapTypeControl', 'OverviewMapControl', 'PanControl', 'RotateControl', 'ScaleControl', 'StreetViewControl', 'ZoomControl', ); foreach ($controlNames as $controlName) { $controlHelper = lcfirst($controlName).'Helper'; $this->renderMapControl($map, $controlName, $this->$controlHelper); } }
php
{ "resource": "" }
q261548
MapHelper.renderMapControl
test
protected function renderMapControl(Map $map, $controlName, $controlHelper) { $lcFirstControlName = lcfirst($controlName); if (!$map->hasMapOption($lcFirstControlName)) { return; } $this->jsonBuilder->setValue( sprintf('[%s]', $lcFirstControlName), (bool) $map->getMapOption($lcFirstControlName) ); if ($map->getMapOption($lcFirstControlName)) { $hasControlMethod = 'has'.$controlName; if ($map->$hasControlMethod()) { $getControlMethod = 'get'.$controlName; $this->jsonBuilder->setValue( sprintf('[%sOptions]', $lcFirstControlName), $controlHelper->render($map->$getControlMethod()), false ); } } $map->removeMapOption($lcFirstControlName); }
php
{ "resource": "" }
q261549
Uuid.v1
test
public function v1(bool $optimize = true): string { $uuid = UuidGen::uuid1()->toString(); if ($optimize) { // See: <http://jas.xyz/1ODZilT> $uuid = substr($uuid, 14, 4). substr($uuid, 9, 4). substr($uuid, 0, 8). substr($uuid, 19, 4). substr($uuid, 24); } return $uuid; // Possibly optimized now. }
php
{ "resource": "" }
q261550
Uuid.v3
test
public function v3(string $namespace, string $identifier, bool $optimize = true): string { switch ($namespace) { case 'dns': $namespace = UuidGen::NAMESPACE_DNS; break; // Stop here. case 'url': $namespace = UuidGen::NAMESPACE_URL; break; // Stop here. case 'oid': $namespace = UuidGen::NAMESPACE_OID; break; // Stop here. case 'x500': $namespace = UuidGen::NAMESPACE_X500; break; // Stop here. default: $this->c::issue('Invalid namespace.'); } $uuid = UuidGen::uuid3($namespace, $identifier)->toString(); return $optimize ? str_replace('-', '', $uuid) : $uuid; }
php
{ "resource": "" }
q261551
Uuid.v4
test
public function v4(bool $optimize = true): string { $uuid = UuidGen::uuid4()->toString(); return $optimize ? str_replace('-', '', $uuid) : $uuid; }
php
{ "resource": "" }
q261552
Uuid.v4x2
test
public function v4x2(bool $optimize = true): string { $uuid1 = UuidGen::uuid4()->toString(); $uuid2 = UuidGen::uuid4()->toString(); return $optimize ? str_replace('-', '', $uuid1.$uuid2) : $uuid1.'-'.$uuid2; }
php
{ "resource": "" }
q261553
Repository.get
test
public function get($name): PackageContract { if (array_key_exists($name, $this->items)) { return $this->items[$name]; } throw new Exceptions\ModuleNotFoundException("Package '$name' not found."); }
php
{ "resource": "" }
q261554
Repository.each
test
public function each(callable $callback) { foreach ($this->items as $name => $item) { $callback($item, $name); } }
php
{ "resource": "" }
q261555
Repository.filter
test
public function filter(callable $callback):Repository { $result = new Repository(); foreach ($this->items as $name => $item) { if ($callback($item, $name)) { $result->add($item); } } return $result; }
php
{ "resource": "" }
q261556
Repository.add
test
public function add(PackageContract ...$items) { foreach ($items as $item) { $this->items[$item->getName()] = $item; } }
php
{ "resource": "" }
q261557
GeocoderRequest.setAddress
test
public function setAddress($address) { if (!is_string($address) && ($address !== null)) { throw GeocodingException::invalidGeocoderRequestAddress(); } $this->address = $address; }
php
{ "resource": "" }
q261558
GeocoderRequest.setCoordinate
test
public function setCoordinate() { $args = func_get_args(); if (isset($args[0]) && ($args[0] instanceof Coordinate)) { $this->coordinate = $args[0]; } elseif ((isset($args[0]) && is_numeric($args[0])) && (isset($args[1]) && is_numeric($args[1]))) { if (!$this->hasCoordinate()) { $this->coordinate = new Coordinate(); } $this->coordinate->setLatitude($args[0]); $this->coordinate->setLongitude($args[1]); if (isset($args[2]) && is_bool($args[2])) { $this->coordinate->setNoWrap($args[2]); } } elseif (!isset($args[0])) { $this->coordinate = null; } else { throw GeocodingException::invalidGeocoderRequestCoordinate(); } return $this; }
php
{ "resource": "" }
q261559
GeocoderRequest.setBound
test
public function setBound() { $args = func_get_args(); if (isset($args[0]) && ($args[0] instanceof Bound)) { $this->bound = $args[0]; } elseif ((isset($args[0]) && ($args[0] instanceof Coordinate)) && (isset($args[1]) && ($args[1] instanceof Coordinate)) ) { if (!$this->hasBound()) { $this->bound = new Bound(); } $this->bound->setSouthWest($args[0]); $this->bound->setNorthEast($args[1]); } elseif ((isset($args[0]) && is_numeric($args[0])) && (isset($args[1]) && is_numeric($args[1])) && (isset($args[2]) && is_numeric($args[2])) && (isset($args[3]) && is_numeric($args[3])) ) { if (!$this->hasBound()) { $this->bound = new Bound(); } $this->bound->setSouthWest(new Coordinate($args[0], $args[1])); $this->bound->setNorthEast(new Coordinate($args[2], $args[3])); if (isset($args[4]) && is_bool($args[4])) { $this->bound->getSouthWest()->setNoWrap($args[4]); } if (isset($args[5]) && is_bool($args[5])) { $this->bound->getNorthEast()->setNoWrap($args[5]); } } elseif (!isset($args[0])) { $this->bound = null; } else { throw GeocodingException::invalidGeocoderRequestBound(); } }
php
{ "resource": "" }
q261560
GeocoderRequest.setRegion
test
public function setRegion($region = null) { if ((!is_string($region) || (strlen($region) !== 2)) && ($region !== null)) { throw GeocodingException::invalidGeocoderRequestRegion(); } $this->region = $region; }
php
{ "resource": "" }
q261561
GeocoderRequest.setLanguage
test
public function setLanguage($language = null) { if ((!is_string($language) || ((strlen($language) !== 2) && (strlen($language) !== 5))) && ($language !== null)) { throw GeocodingException::invalidGeocoderRequestLanguage(); } $this->language = $language; }
php
{ "resource": "" }
q261562
Route.load
test
public function load(array $args = []) { $default_args = [ 'path' => '', 'dir' => '', 'vars' => [], 'on_resolved' => null, ]; $args += $default_args; $args['path'] = (string) $args['path']; $args['dir'] = (string) $args['dir']; $args['vars'] = (array) $args['vars']; if (($resolved = $this->resolve($args['path'], $args['dir'], $args))) { if (isset($args['on_resolved']) && is_callable($args['on_resolved'])) { $args['on_resolved']($resolved); } exit($this->get($resolved)->parse($args['vars'])); } else { $this->c::die(404); // Unable to resolve. } }
php
{ "resource": "" }
q261563
Route.get
test
public function get(array $args = []): Classes\Core\Route { return $this->App->Di->get(Classes\Core\Route::class, compact('args')); }
php
{ "resource": "" }
q261564
Yaml.parse
test
public function parse($value) { if (is_array($value) || is_object($value)) { foreach ($value as $_key => &$_value) { $_value = $this->parse($_value, $args); } // unset($_key, $_value); return $value; } if (!($yaml = (string) $value)) { return []; // Empty. } try { $array = Parser::parse($yaml); } catch (\Throwable $Throwable) { $array = []; // Empty. } return is_array($array) ? $array : []; }
php
{ "resource": "" }
q261565
NoCache.setFlags
test
public function setFlags() { if ($this->c::isWordPress()) { if (!defined('DONOTCACHEPAGE')) { define('DONOTCACHEPAGE', true); } if (!defined('COMET_CACHE_ALLOWED')) { define('COMET_CACHE_ALLOWED', false); } $_SERVER['COMET_CACHE_ALLOWED'] = false; } }
php
{ "resource": "" }
q261566
Sort.byKey
test
public function byKey(array $array, int $flags = SORT_REGULAR): array { ksort($array, $flags); foreach ($array as $_key => &$_value) { if (is_array($_value)) { $_value = $this->byKey($_value, $flags); } } // unset($_key, $_value); // Housekeeping. return $array; }
php
{ "resource": "" }
q261567
UrlCurrent.method
test
public function method(): string { if (($method = &$this->cacheKey(__FUNCTION__)) !== null) { return $method; // Cached this already. } return $method = mb_strtoupper($_SERVER['REQUEST_METHOD']); }
php
{ "resource": "" }
q261568
UrlCurrent.scheme
test
public function scheme(): string { if (($scheme = &$this->cacheKey(__FUNCTION__)) !== null) { return $scheme; // Cached this already. } return $scheme = $this->isSsl() ? 'https' : 'http'; }
php
{ "resource": "" }
q261569
UrlCurrent.host
test
public function host(bool $with_port = true): string { if (($host = &$this->cacheKey(__FUNCTION__, $with_port)) !== null) { return $host; // Cached this already. } $host = mb_strtolower($_SERVER['HTTP_HOST']); if (!$with_port) { // Strip port number? $host = preg_replace('/\:[0-9]+$/u', '', $host); } return $host; // With or without port number. }
php
{ "resource": "" }
q261570
UrlCurrent.rootHost
test
public function rootHost(bool $with_port = true): string { if (($root_host = &$this->cacheKey(__FUNCTION__, $with_port)) !== null) { return $root_host; // Cached this already. } $name_parts = explode('.', $this->host(false)); $root_name = implode('.', array_slice($name_parts, -2)); $port = $this->port(); // Might be needed in next line. return $root_host = $root_name.(!$with_port ? '' : (isset($port[0]) ? ':'.$port : '')); }
php
{ "resource": "" }
q261571
UrlCurrent.isSsl
test
public function isSsl(): bool { if (($is = &$this->cacheKey(__FUNCTION__)) !== null) { return $is; // Cached this already. } if (!empty($_SERVER['SERVER_PORT'])) { if ((int) $_SERVER['SERVER_PORT'] === 443) { return $is = true; } } if (!empty($_SERVER['HTTPS'])) { if (filter_var($_SERVER['HTTPS'], FILTER_VALIDATE_BOOLEAN)) { return $is = true; } } if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO'])) { if ($this->c::mbStrCaseCmp($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') === 0) { return $is = true; } } return $is = false; }
php
{ "resource": "" }
q261572
UrlCurrent.isLocalhost
test
public function isLocalhost(): bool { if (($is = &$this->cacheKey(__FUNCTION__)) !== null) { return $is; // Cached this already. } if (defined('LOCALHOST') && LOCALHOST) { return $is = true; } elseif (preg_match('/(?:\b(?:localhost|127\.0\.0\.1)\b|\.vm)$/ui', $this->host(false))) { return $is = true; } return $is = false; }
php
{ "resource": "" }
q261573
GeocoderGeometry.setLocationType
test
public function setLocationType($locationType) { if (!in_array($locationType, GeocoderLocationType::getGeocoderLocationTypes())) { throw GeocodingException::invalidGeocoderLocationType(); } $this->locationType = $locationType; }
php
{ "resource": "" }
q261574
RegexEscape.m0EscNoVws
test
public function m0EscNoVws(string $escapable_chars, bool $ungreedy = false): string { $escapable_chars = $this->__invoke($escapable_chars); return '(?:[^\v'.$escapable_chars.'\\\\]|\\\\['.$escapable_chars.'])*'.($ungreedy ? '?' : ''); }
php
{ "resource": "" }
q261575
DirectionsStatus.getDirectionsStatus
test
public static function getDirectionsStatus() { return array( self::INVALID_REQUEST, self::MAX_WAYPOINTS_EXCEEDED, self::NOT_FOUND, self::OK, self::OVER_QUERY_LIMIT, self::REQUEST_DENIED, self::UNKNOWN_ERROR, self::ZERO_RESULTS, ); }
php
{ "resource": "" }
q261576
OverloadMembers.overloadData
test
protected function overloadData(): array { foreach ($this->x___overload_data as $_key => $_value) { $properties[$_key] = $_value; } // unset($_key, $_value); return $properties ?? []; }
php
{ "resource": "" }
q261577
OverloadMembers.overloadPropertyData
test
protected function overloadPropertyData(): array { foreach ($this->x___overload_data as $_key => $_value) { if (!is_callable($_value)) { $properties[$_key] = $_value; } } // unset($_key, $_value); return $properties ?? []; }
php
{ "resource": "" }
q261578
OverloadMembers.writableOverloadPropertyData
test
protected function writableOverloadPropertyData(): array { foreach ($this->x___overload_data as $_key => $_value) { if (isset($this->x___writable_overload_keys[$_key]) && !is_callable($_value)) { $properties[$_key] = $_value; } } // unset($_key, $_value); return $properties ?? []; }
php
{ "resource": "" }
q261579
OverloadMembers.overload
test
protected function overload($properties, bool $writable = false) { if (is_object($properties)) { foreach ($properties as $_property => &$_value) { if ($writable) { unset($this->{$_property}); unset($this->x___overload_data[$_property]); $this->x___writable_overload_keys[$_property] = 1; $this->{$_property} = null; $this->{$_property} = &$_value; $this->x___overload_data[$_property] = &$this->{$_property}; } else { // NOT writable. unset($this->{$_property}); unset($this->x___overload_data[$_property]); unset($this->x___writable_overload_keys[$_property]); $this->x___overload_data[$_property] = &$_value; } } // unset($_property, $_value); return; // Stop now; all done here. // } elseif (is_array($properties)) { foreach ($properties as $_key => $_property) { if (!property_exists($this, $_property)) { throw $this->c::issue([], sprintf('No `%1$s` property.', $_property), __METHOD__); } if ($writable) { unset($this->x___overload_data[$_property]); $this->x___writable_overload_keys[$_property] = -1; $this->x___overload_data[$_property] = &$this->{$_property}; } else { // NOT writable. unset($this->x___overload_data[$_property]); unset($this->x___writable_overload_keys[$_property]); $this->x___overload_data[$_property] = &$this->{$_property}; } } // unset($_key, $_property); return; // Stop now; all done here. } throw $this->c::issue([], sprintf('`%1$s`; expecting object/array.', gettype($properties)), __METHOD__); }
php
{ "resource": "" }
q261580
CliOs.openUrl
test
public function openUrl(string $url) { if (!($url = $this->c::mbTrim($url))) { return; // Not possible. } $url_arg = escapeshellarg($url); if ($this->c::isMac()) { `open $url_arg`; } elseif ($this->c::isLinux()) { `xdg-open $url_arg`; } elseif ($this->c::isWindows()) { `start $url_arg`; } else { throw $this->c::issue('Unable to open <'.$url.'>. Unsupported operating system.'); } }
php
{ "resource": "" }
q261581
MarkerImage.setAnchor
test
public function setAnchor() { $args = func_get_args(); if ($args[0] instanceof Point) { $this->anchor = $args[0]; } elseif ((isset($args[0]) && is_numeric($args[0])) && (isset($args[1]) && is_numeric($args[1]))) { if ($this->anchor === null) { $this->anchor = new Point(); } $this->anchor->setX($args[0]); $this->anchor->setY($args[1]); } elseif (!isset($args[0])) { $this->anchor = null; } else { throw OverlayException::invalidMarkerImageAnchor(); } }
php
{ "resource": "" }
q261582
MarkerImage.setOrigin
test
public function setOrigin() { $args = func_get_args(); if (isset($args[0]) && ($args[0] instanceof Point)) { $this->origin = $args[0]; } elseif ((isset($args[0]) && is_numeric($args[0])) && (isset($args[1]) && is_numeric($args[1]))) { if ($this->origin === null) { $this->origin = new Point(); } $this->origin->setX($args[0]); $this->origin->setY($args[1]); } elseif (!isset($args[0])) { $this->origin = null; } else { throw OverlayException::invalidMarkerImageOrigin(); } }
php
{ "resource": "" }
q261583
MarkerImage.setScaledSize
test
public function setScaledSize() { $args = func_get_args(); if (isset($args[0]) && ($args[0] instanceof Size)) { $this->scaledSize = $args[0]; } elseif ((isset($args[0]) && is_numeric($args[0])) && (isset($args[1]) && is_numeric($args[1]))) { if ($this->scaledSize === null) { $this->scaledSize = new Size(); } $this->scaledSize->setWidth($args[0]); $this->scaledSize->setHeight($args[1]); if (isset($args[2]) && is_string($args[2])) { $this->scaledSize->setWidthUnit($args[2]); } if (isset($args[3]) && is_string($args[3])) { $this->scaledSize->setHeightUnit($args[3]); } } elseif (!isset($args[0])) { $this->scaledSize = null; } else { throw OverlayException::invalidMarkerImageScaledSize(); } }
php
{ "resource": "" }
q261584
MarkerImage.setSize
test
public function setSize() { $args = func_get_args(); if (isset($args[0]) && ($args[0] instanceof Size)) { $this->size = $args[0]; } elseif ((isset($args[0]) && is_numeric($args[0])) && (isset($args[1]) && is_numeric($args[1]))) { if ($this->size === null) { $this->size = new Size($args[0], $args[1]); } $this->size->setWidth($args[0]); $this->size->setHeight($args[1]); if (isset($args[2]) && is_string($args[2])) { $this->size->setWidthUnit($args[2]); } if (isset($args[3]) && is_string($args[3])) { $this->size->setHeightUnit($args[3]); } } elseif (!isset($args[0])) { $this->size = null; } else { throw OverlayException::invalidMarkerImageSize(); } }
php
{ "resource": "" }
q261585
InfoWindowHelper.render
test
public function render(InfoWindow $infoWindow, $renderPosition = true) { $this->doRender($infoWindow, $renderPosition); return sprintf( '%s = new google.maps.InfoWindow(%s);'.PHP_EOL, $infoWindow->getJavascriptVariable(), $this->jsonBuilder->build() ); }
php
{ "resource": "" }
q261586
InfoWindowHelper.renderOpen
test
public function renderOpen(InfoWindow $infoWindow, Map $map, Marker $marker = null) { if ($marker !== null) { return sprintf( '%s.open(%s, %s);'.PHP_EOL, $infoWindow->getJavascriptVariable(), $map->getJavascriptVariable(), $marker->getJavascriptVariable() ); } return sprintf('%s.open(%s);'.PHP_EOL, $infoWindow->getJavascriptVariable(), $map->getJavascriptVariable()); }
php
{ "resource": "" }
q261587
InfoWindowHelper.doRender
test
protected function doRender(InfoWindow $infoWindow, $renderPosition) { $this->jsonBuilder->reset(); if ($renderPosition) { $this->jsonBuilder->setValue('[position]', $infoWindow->getPosition()->getJavascriptVariable(), false); } if ($infoWindow->hasPixelOffset()) { $this->jsonBuilder->setValue( '[pixelOffset]', $infoWindow->getPixelOffset()->getJavascriptVariable(), false ); } $this->jsonBuilder ->setValue('[content]', $infoWindow->getContent()) ->setValues($infoWindow->getOptions()); }
php
{ "resource": "" }
q261588
Modules.register
test
public function register(Application $app) { $this->enabled()->each(function (Module $module) use ($app) { array_map(function ($class) use ($app) { /* @var ServiceProvider $provider */ $provider = new $class($app); if ($provider->isDeferred()) { $app->addDeferredServices(array_fill_keys($provider->provides(), $provider)); } else { $app->register($provider); } }, array_filter($module->getProviders(), 'class_exists')); }); }
php
{ "resource": "" }
q261589
Modules.asset
test
public function asset(string $module, string $path, $secure = null): string { if ($this->assetResolver && ($url = call_user_func($this->assetResolver, $module, $path, $secure)) !== null) { return $url; } return $this->app->make('url')->asset($this->getAssetsPath() . "/{$module}/" . $path, $secure); }
php
{ "resource": "" }
q261590
Modules.loadRoutes
test
public function loadRoutes(string $scope = 'web') { $this->app->make('router')->group([ 'as' => $scope === 'web' ? '' : "{$scope}.", ], function (Router $router) use ($scope) { $this->enabled()->each(function (Module $module) use ($scope, $router) { $path = $module->getPath("routes/{$scope}.php"); if (file_exists($path)) { $router->group([ 'namespace' => $module->getNamespace() . '\\Http\\Controllers', ], function (Router $router) use ($module, $path, $scope) { $options = array_merge([ 'namespace' => $scope === 'web' ? null : Str::studly($scope), 'as' => $module->getName() . '.', 'prefix' => $module->getName(), 'middleware' => $scope, ], $module->config("routes.{$scope}", [])); $router->group($options, function (Router $router) use ($path, $module) { require($path); }); }); } }); }); }
php
{ "resource": "" }
q261591
PhpHas.callableFunc
test
public function callableFunc(string $function): bool { $function = mb_strtolower($function); if (isset(static::$cache[__FUNCTION__][$function])) { return static::$cache[__FUNCTION__][$function]; } if (!isset(static::$cache[__FUNCTION__.'s_disabled'])) { static::$cache[__FUNCTION__.'s_disabled'] = []; // Initialize. $_functions_disabled = &static::$cache[__FUNCTION__.'s_disabled']; if (($_ini_disable_functions = (string) ini_get('disable_functions'))) { $_ini_disable_functions = mb_strtolower($_ini_disable_functions); $_functions_disabled = array_merge($_functions_disabled, preg_split('/[\s;,]+/u', $_ini_disable_functions, -1, PREG_SPLIT_NO_EMPTY)); } if (($_ini_suhosin_blacklist_functions = (string) ini_get('suhosin.executor.func.blacklist'))) { $_ini_suhosin_blacklist_functions = mb_strtolower($_ini_suhosin_blacklist_functions); $_functions_disabled = array_merge($_functions_disabled, preg_split('/[\s;,]+/u', $_ini_suhosin_blacklist_functions, -1, PREG_SPLIT_NO_EMPTY)); } if (($_ini_opcache_restrict_api = (string) ini_get('opcache.restrict_api')) && mb_stripos(__FILE__, $_ini_opcache_restrict_api) !== 0) { $_functions_disabled = array_merge($_functions_disabled, ['opcache_compile_file', 'opcache_get_configuration', 'opcache_get_status', 'opcache_invalidate', 'opcache_is_script_cached', 'opcache_reset']); } if (filter_var(@ini_get('suhosin.executor.disable_eval'), FILTER_VALIDATE_BOOLEAN)) { $_functions_disabled[] = 'eval'; // The `eval()` construct is disabled also. } } // We now have a full list of all disabled functions. static::$cache[__FUNCTION__][$function] = null; // Initialize. $has = &static::$cache[__FUNCTION__][$function]; $functions_disabled = &static::$cache[__FUNCTION__.'s_disabled']; if ($functions_disabled && in_array($function, $functions_disabled, true)) { return $has = false; // Not possible; e.g., `eval()`. } elseif ((!function_exists($function) || !is_callable($function)) && !in_array($function, $this::CONSTRUCTS, true)) { return $has = false; // Not possible. } return $has = true; }
php
{ "resource": "" }
q261592
GroundOverlayHelper.render
test
public function render(GroundOverlay $groundOverlay, Map $map) { $this->jsonBuilder ->reset() ->setValue('[map]', $map->getJavascriptVariable(), false) ->setValues($groundOverlay->getOptions()); return sprintf( '%s = new google.maps.GroundOverlay("%s", %s, %s);'.PHP_EOL, $groundOverlay->getJavascriptVariable(), $groundOverlay->getUrl(), $groundOverlay->getBound()->getJavascriptVariable(), $this->jsonBuilder->build() ); }
php
{ "resource": "" }
q261593
EchoEmitter.emit
test
public function emit(ResponseInterface $response): void { // Emit http status code echo sprintf( 'HTTP/%s %s %s', $response->getProtocolVersion(), $response->getStatusCode(), $response->getReasonPhrase() ) . PHP_EOL; // Emit headers iteratively foreach ($response->getHeaders() as $name => $values) { foreach ($values as $value) { echo sprintf('%s: %s', $name, $value) . PHP_EOL; } } // End the headers echo PHP_EOL; // Emit body echo $response->getBody(); }
php
{ "resource": "" }
q261594
CacheMembers.&
test
protected function &cacheSet(string $primary_key, $sub_key, $value) { if ($primary_key === 'x___keys' || $primary_key === 'x___refs') { throw $this->c::issue('Attempting to set a reserved primary key.'); } $sub_key = (string) $sub_key; $this->x___cache[$primary_key][$sub_key] = $value; return $this->x___cache[$primary_key][$sub_key]; }
php
{ "resource": "" }
q261595
CacheMembers.&
test
protected function &cacheGet(string $primary_key, $sub_key) { if ($primary_key === 'x___keys' || $primary_key === 'x___refs') { throw $this->c::issue('Attempting to get a reserved primary key.'); } $sub_key = (string) $sub_key; // Force string. if (isset($this->x___cache[$primary_key][$sub_key])) { return $this->x___cache[$primary_key][$sub_key]; } else { $this->x___cache[$primary_key][$sub_key] = null; return $this->x___cache[$primary_key][$sub_key]; } }
php
{ "resource": "" }
q261596
CacheMembers.cacheUnset
test
protected function cacheUnset(string $primary_key, $sub_key) { if ($primary_key === 'x___keys' || $primary_key === 'x___refs') { throw $this->c::issue('Attempting to unset a reserved primary key.'); } $sub_key = (string) $sub_key; $this->x___cache[$primary_key][$sub_key] = null; unset($this->x___cache[$primary_key][$sub_key]); }
php
{ "resource": "" }
q261597
CacheMembers.cacheUnsetPattern
test
protected function cacheUnsetPattern(string $primary_key, string $sub_key_pattern) { if ($primary_key === 'x___keys' || $primary_key === 'x___refs') { throw $this->c::issue('Attempting to unset a reserved primary key.'); } if (empty($this->x___cache[$primary_key])) { return; // Nothing to do here. } $sub_key_regex = // Allow `**` to indicate everything quickly. $sub_key_pattern === '**' ? '' : $this->c::wRegx($sub_key_pattern, '/', true); if (!$sub_key_regex && $sub_key_pattern !== '**') { return; // Nothing to do; i.e., no regex. } foreach (array_keys($this->x___cache[$primary_key]) as $_sub_key) { if ($sub_key_pattern === '**' || preg_match($sub_key_regex.'i', (string) $_sub_key)) { $this->x___cache[$primary_key][$_sub_key] = null; unset($this->x___cache[$primary_key][$_sub_key]); } } // unset($_sub_key); // Housekeeping. }
php
{ "resource": "" }
q261598
CacheMembers.cacheAddByRef
test
protected function cacheAddByRef(string $primary_key, $ref_key, &$value) { $ref_key = (string) $ref_key; $this->x___cache['x___refs'][$primary_key][$ref_key][] = &$value; }
php
{ "resource": "" }
q261599
CacheMembers.cacheUnsetByRef
test
protected function cacheUnsetByRef(string $primary_key, $ref_key) { $ref_key = (string) $ref_key; // Force string. if (empty($this->x___cache['x___refs'][$primary_key][$ref_key])) { return; // Nothing to do here. } foreach (array_keys($this->x___cache['x___refs'][$primary_key][$ref_key]) as $_key) { $this->x___cache['x___refs'][$primary_key][$ref_key][$_key] = null; } // unset($_key); // Housekeeping. unset($this->x___cache['x___refs'][$primary_key][$ref_key]); }
php
{ "resource": "" }