idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
19,500 | public function getAvailableLanguages ( ) { $ languages = [ ] ; $ paths = $ this -> fileSystem -> getDirectories ( $ this -> getLanguagesPath ( ) ) ; foreach ( $ paths as $ path ) { $ languages [ ] = substr ( $ path , strlen ( $ this -> getLanguagesPath ( ) ) + 1 ) ; } return $ languages ; } | Return the list of available languages . |
19,501 | public function createNewLanguage ( string $ newLocale ) { if ( count ( $ this -> getAvailableLanguages ( ) ) >= $ this -> allowedLanguages ) { throw new DirectoryNotCreatedException ( "Max number of allowed languages alread reached." ) ; } if ( ! $ this -> fileSystem -> makeDirectory ( $ this -> getLanguagesPath ( ) .... | Create a new directory under the languages directory for input locale . Return true on success . |
19,502 | protected function purifyInputs ( array $ inputs ) { $ newInputs = [ ] ; foreach ( $ inputs as $ key => $ value ) { if ( is_array ( $ value ) ) { throw new InvalidArgumentException ( 'Input array can NOT contain nested arrays.' ) ; } if ( strlen ( ( string ) $ key ) > $ this -> maxTextLength ) { throw new TextTooLongEx... | Escape input array . Keys beginning with _ are discarded . If the file already exists it gets overwritten . |
19,503 | public function buildArray ( array $ inputs ) { $ newArray = [ ] ; foreach ( $ inputs as $ path => $ value ) { if ( is_array ( $ value ) ) { throw new InvalidArgumentException ( 'Input array CANNOT contain nested arrays.' ) ; } if ( isset ( $ path [ 0 ] ) ) { if ( $ path [ 0 ] === '_' || $ path [ 0 ] === '.' ) { unset ... | Build the final array that will be written into the file . Support dot notation . |
19,504 | protected function assignArrayByDotPath ( & $ arr , string $ path , string $ value ) { $ keys = explode ( '.' , $ path ) ; foreach ( $ keys as $ keyValue ) { if ( $ keyValue == '0' ) { throw new InvalidArgumentException ( 'Invalid key in input array: part of the key in dot notation can NOT be \'0\'.' ) ; } } $ nestingL... | Take a path of nested array with dot notation and build an array saving it through reference . |
19,505 | public function convertArrayToDotNotation ( array $ array ) { $ recursiveIterator = new \ RecursiveIteratorIterator ( new \ RecursiveArrayIterator ( $ array ) ) ; $ newArray = [ ] ; foreach ( $ recursiveIterator as $ leafValue ) { $ keys = [ ] ; foreach ( range ( 0 , $ recursiveIterator -> getDepth ( ) ) as $ depth ) {... | Convert an array with nested arrays into a dot notation array . |
19,506 | protected function checkIfKeysAreSafe ( string $ fileName , array $ array ) { $ languageFile = $ this -> getLanguageFile ( $ fileName , true ) ; foreach ( $ array as $ key => $ value ) { if ( isset ( $ key [ 0 ] ) ) { if ( $ key [ 0 ] === '_' || $ key [ 0 ] === '.' ) { continue ; } } if ( ! array_key_exists ( $ key , $... | Check if input keys are safe i . e . all its keys are contained in the default locale language file . |
19,507 | protected function checkIfFileNameIsSafe ( string $ fileName ) { $ allowedFileNames = $ this -> getLanguageFiles ( true ) ; if ( ! in_array ( $ fileName , $ allowedFileNames ) ) { return false ; } return true ; } | Check if input file name is safe i . e . if the default locale contains a file with the same name . |
19,508 | protected function initTranslations ( ) { $ i18n = Instance :: ensure ( $ this -> i18n , \ yii \ i18n \ I18N :: class ) ; $ i18n -> translations [ 'recaptcha*' ] = [ 'class' => PhpMessageSource :: class , 'basePath' => dirname ( __FILE__ ) . DIRECTORY_SEPARATOR . 'messages' , 'sourceLanguage' => 'en' , 'fileMap' => [ '... | Initializes translations for component |
19,509 | public function deregisterOnWorkerExit ( WorkerInterface $ worker ) { $ process = $ worker -> getProcess ( ) ; $ process -> wait ( ) ; if ( $ process -> isCleanExit ( ) ) { $ this -> registry -> deregister ( $ worker ) ; } else { throw new ResqueRuntimeException ( sprintf ( 'Foreman error with worker %s wait on pid %d'... | Deregister on worker exit . |
19,510 | public function pruneDeadWorkers ( ) { $ workerPids = $ this -> getLocalWorkerPids ( ) ; $ workers = $ this -> registry -> all ( ) ; $ hostname = $ this -> system -> getHostname ( ) ; foreach ( $ workers as $ worker ) { if ( $ worker instanceof WorkerInterface ) { $ isNotOnCurrentHost = $ worker -> getHostname ( ) != $... | Prune dead workers . |
19,511 | public function kill ( $ signal = SIGKILL ) { if ( ! $ this -> getPid ( ) ) { throw new ResqueRuntimeException ( 'Cannot kill a process with out a pid set' ) ; } posix_kill ( $ this -> getPid ( ) , $ signal ) ; $ this -> pid = null ; return $ this ; } | Attempt to kill the process |
19,512 | public function setTitle ( $ title ) { if ( getmypid ( ) != $ this -> getPid ( ) ) { throw new ResqueRuntimeException ( sprintf ( 'Can not set title when process pid has changed. Expected "%s", got "%s"' , $ this -> getPid ( ) , getmypid ( ) ) ) ; } $ processTitle = 'resque-' . Resque :: VERSION . ': ' . $ title ; if (... | Set process title |
19,513 | public function config ( $ option = null , $ value = null ) { if ( $ option !== null ) { self :: ensureValidConfigOptions ( $ option ) ; if ( ! is_array ( $ option ) ) { if ( $ value !== null ) { $ this -> config [ $ option ] = $ value ; } return array_key_exists ( $ option , $ this -> config ) ? $ this -> config [ $ o... | Method to get or set the service s configuration . |
19,514 | private function buildAttachmentBody ( $ attachment ) { return sprintf ( '%s%s%s%s%s%s' , '--MIME_boundary' . self :: CRLF , 'Content-Type: ' . $ attachment [ 'mimeType' ] . self :: CRLF , 'Content-Transfer-Encoding: binary' . self :: CRLF , 'Content-ID: <attachment.bin@devbay.net>' . self :: CRLF . self :: CRLF , $ at... | Builds the attachment part of the request body string . |
19,515 | private function extractXml ( $ response ) { if ( strpos ( $ response , 'application/xop+xml' ) === false ) { return array ( $ response , array ( 'data' => null , 'mimeType' => null ) ) ; } else { return $ this -> extractXmlAndAttachment ( $ response ) ; } } | Extracts the XML from the response if it contains an attachment . |
19,516 | private function extractXmlAndAttachment ( $ response ) { $ attachment = array ( 'data' => null , 'mimeType' => null ) ; preg_match ( '/\r\n/' , $ response , $ matches , PREG_OFFSET_CAPTURE ) ; $ boundary = substr ( $ response , 0 , $ matches [ 0 ] [ 1 ] ) ; $ xmlStartPos = strpos ( $ response , '<?xml ' ) ; $ xmlEndPo... | Extracts the XML and the attachment from the response if it contains an attachment . |
19,517 | private static function ensureValidConfigOptions ( $ option ) { $ class = get_called_class ( ) ; if ( ! is_array ( $ option ) ) { self :: ensureValidConfigOption ( $ class , $ option ) ; } else { $ keys = array_keys ( $ option ) ; foreach ( $ keys as $ key ) { self :: ensureValidConfigOption ( $ class , $ key ) ; } } } | Helper function to ensure that the passed configuration options exist . |
19,518 | private function logRequest ( $ url , $ name , $ headers , $ body ) { if ( $ this -> logger ) { $ this -> logger -> debug ( 'Request' , array ( 'url' => $ url , 'name' => $ name , 'headers' => $ headers , 'body' => $ body ) ) ; } } | Logs the request details . |
19,519 | public static function date_sort_callback ( $ a , $ b ) { if ( $ a -> StartDate == $ b -> StartDate ) { if ( $ a -> StartTime == $ b -> StartTime ) return 0 ; else if ( strtotime ( $ a -> StartTime ) > strtotime ( $ b -> StartTime ) ) return 1 ; else return - 1 ; } else if ( strtotime ( $ a -> StartDate ) > strtotime (... | Callback used by column_sort |
19,520 | private function setSSL ( ) { curl_setopt ( $ this -> curl , CURLOPT_SSL_VERIFYHOST , 0 ) ; curl_setopt ( $ this -> curl , CURLOPT_SSL_VERIFYPEER , 0 ) ; curl_setopt ( $ this -> curl , CURLOPT_RETURNTRANSFER , 1 ) ; } | Sets SSL curl properties when requesting an https url . |
19,521 | public static function fromNative ( $ latLng ) { if ( is_string ( $ latLng ) ) { return static :: fromString ( $ latLng ) ; } elseif ( is_array ( $ latLng ) || $ latLng instanceof \ ArrayObject ) { return static :: fromArray ( $ latLng ) ; } throw new InvalidArgumentException ( 'Could not create LatLng from native valu... | Create LatLng from a native representation . |
19,522 | public static function fromArray ( $ native ) { $ keys = array ( array ( 0 , 1 , 2 ) , array ( 'lat' , 'lng' , 'alt' ) , array ( 'latitude' , 'longitude' , 'altitude' ) , ) ; foreach ( $ keys as $ key ) { if ( isset ( $ native [ $ key [ 0 ] ] ) && isset ( $ native [ $ key [ 1 ] ] ) ) { return new static ( $ native [ $ ... | Create LatLng from array . |
19,523 | public static function fromString ( $ latLng ) { list ( $ latitude , $ longitude , $ altitude ) = explode ( ',' , $ latLng ) ; Assertion :: numeric ( $ latitude ) ; Assertion :: numeric ( $ longitude ) ; Assertion :: nullOrNumeric ( $ altitude ) ; return new static ( $ latitude , $ longitude , $ altitude ) ; } | Create latlng from a string reprensentation . |
19,524 | public function equals ( LatLng $ other , $ maxMargin = null , $ ignoreAltitude = true ) { if ( $ maxMargin !== null ) { $ margin = max ( abs ( ( $ this -> getLatitude ( ) - $ other -> getLatitude ( ) ) ) , abs ( ( $ this -> getLongitude ( ) - $ other -> getLongitude ( ) ) ) ) ; if ( ! $ ignoreAltitude ) { $ margin = m... | Compare 2 coordinates . It ignores the altitude . |
19,525 | public function toGeoJson ( ) { $ raw = array ( $ this -> getLongitude ( ) , $ this -> getLatitude ( ) ) ; if ( $ this -> hasAltitude ( ) ) { $ raw [ ] = $ this -> getAltitude ( ) ; } return $ raw ; } | Get latlng as geo json coordinate . |
19,526 | public function setConfig ( $ key = null , $ value = null ) { if ( $ key == null || $ value == null ) { return null ; } return ( $ this -> config [ $ key ] = $ value ) ; } | Set an API configuration key . |
19,527 | protected function debug ( $ type , $ mixed ) { if ( $ this -> config && $ this -> config [ 'debugsEnabled' ] ) { switch ( $ type ) { case 'echo' : echo $ mixed ; break ; case 'print_r' : print_r ( $ mixed ) ; break ; case 'var_dump' : var_dump ( $ mixed ) ; break ; } } } | Generates some output if debugsEnabled is set to true . |
19,528 | public function bindPopup ( $ popup , $ options = null ) { $ this -> popup = $ popup ; $ this -> popupOptions = $ options ; if ( ! empty ( $ options ) ) { return $ this -> addMethod ( 'binPopup' , array ( $ popup , $ options ) ) ; } return $ this -> addMethod ( 'bindPopup' , array ( $ popup ) ) ; } | Bind marker to a popup . |
19,529 | public function eagerLoadElements ( $ elements , $ with ) { if ( empty ( $ elements ) ) { return ; } if ( ! \ is_array ( $ elements ) ) { $ elements = [ $ elements ] ; } $ element = $ elements [ 0 ] ; $ elementType = \ get_class ( $ element ) ; Craft :: $ app -> elements -> eagerLoadElements ( $ elementType , $ element... | Eager - loads additional elements onto a given set of elements . |
19,530 | public function addLatLng ( $ latLng , $ ringIndex = 0 ) { if ( is_scalar ( $ latLng ) ) { $ latLng = LatLng :: fromNative ( $ latLng ) ; } Assertion :: isInstanceOf ( $ latLng , 'Netzmacht\LeafletPHP\Value\LatLng' ) ; $ ringIndex = ( int ) $ ringIndex ; $ this -> latLngs [ $ ringIndex ] [ ] = $ latLng ; return $ this ... | Add a latitude longitude position . |
19,531 | public function addLatLngs ( $ values , $ ringIndex = 0 ) { foreach ( $ values as $ position ) { $ this -> addLatLng ( $ position , $ ringIndex ) ; } return $ this ; } | Add a list of values . |
19,532 | public function getLatLngs ( $ preferFlat = true ) { if ( $ preferFlat ) { $ value = [ ] ; foreach ( $ this -> latLngs as $ ring ) { $ value = array_merge ( $ value , $ ring ) ; } return $ value ; } return $ this -> latLngs ; } | Get all lat lngs . |
19,533 | protected function createService ( Container $ container , array $ config ) { $ authorizationServer = $ this -> createAuthorizationServer ( $ container , $ config ) ; $ resourceServer = $ this -> createResourceServer ( $ container ) ; return new OAuth2Service ( $ authorizationServer , $ resourceServer ) ; } | Creates the service instance . |
19,534 | protected function createAuthorizationServer ( Container $ container , array $ config ) { $ authorizationServer = $ container -> make ( AuthorizationServer :: class ) ; $ authorizationServer -> setSessionStorage ( $ container -> make ( SessionInterface :: class ) ) ; $ authorizationServer -> setAccessTokenStorage ( $ c... | Creates the authorization instance . |
19,535 | protected function configureAuthorizationServer ( AuthorizationServer $ authorizationServer , array $ config ) { if ( isset ( $ config [ 'scope_param' ] ) ) { $ authorizationServer -> requireScopeParam ( $ config [ 'scope_param' ] ) ; } if ( isset ( $ config [ 'default_scope' ] ) ) { $ authorizationServer -> setDefault... | Configures the authorization server instance . |
19,536 | protected function configureGrantTypes ( AuthorizationServer $ authorizationServer , array $ config ) { foreach ( $ config as $ name => $ params ) { if ( ! isset ( $ params [ 'class' ] ) || ! class_exists ( $ params [ 'class' ] ) ) { continue ; } $ grantType = new $ params [ 'class' ] ; if ( isset ( $ params [ 'access_... | Configures the grant types for the authorization server instance . |
19,537 | private function doVectorEncode ( $ type , Vector $ vector , Encoder $ builder ) { return sprintf ( '%s = L.%s(%s, %s);' , $ builder -> encodeReference ( $ vector ) , $ type , $ builder -> encodeArray ( $ vector -> getLatLngs ( ) ) , $ builder -> encodeValue ( $ vector -> getOptions ( ) ) ) ; } | Encode a vector . |
19,538 | private function doCircleEncode ( $ type , CircleMarker $ circle , Encoder $ builder ) { return sprintf ( '%s = L.%s(%s);' , $ builder -> encodeReference ( $ circle ) , $ type , $ builder -> encodeArguments ( array ( $ circle -> getLatLng ( ) , $ circle , $ circle -> getOptions ( ) ) ) ) ; } | Encode a circle . |
19,539 | public function removeAttribution ( $ attribution ) { $ key = array_search ( $ attribution , $ this -> attributions ) ; if ( $ key !== false ) { unset ( $ this -> attributions [ $ key ] ) ; } else { $ this -> addMethod ( 'removeAttribution' , array ( $ attribution ) ) ; } return $ this ; } | Remove attribution . |
19,540 | public function setCustomLayer ( Layer $ customLayer ) { Assertion :: count ( $ this -> getMethodCalls ( ) , 0 , 'Setting custom layer has to be done before any method call.' ) ; $ this -> customLayer = $ customLayer ; return $ this ; } | Set the custom layer . |
19,541 | public function setOptions ( array $ options ) { foreach ( $ options as $ name => $ value ) { $ method = 'set' . ucfirst ( $ name ) ; if ( method_exists ( $ this , $ method ) ) { $ this -> $ method ( $ value ) ; } else { $ this -> options [ $ name ] = $ value ; } } return $ this ; } | Set options by calling options methods . |
19,542 | public static function csv ( $ layerId , $ url , $ parserOptions = array ( ) , Layer $ customLayer = null ) { return new Csv ( $ layerId , $ url , $ parserOptions , $ customLayer ) ; } | Create a csv file loading request . |
19,543 | public static function gpx ( $ layerId , $ url , $ parserOptions = array ( ) , Layer $ customLayer = null ) { return new Gpx ( $ layerId , $ url , $ parserOptions , $ customLayer ) ; } | Create a gpx file loading request . |
19,544 | public static function geojson ( $ layerId , $ url , $ parserOptions = array ( ) , Layer $ customLayer = null ) { return new GeoJson ( $ layerId , $ url , $ parserOptions , $ customLayer ) ; } | Create a geoJSON file loading request . |
19,545 | public static function wkt ( $ layerId , $ url , $ parserOptions = array ( ) , Layer $ customLayer = null ) { return new Wkt ( $ layerId , $ url , $ parserOptions , $ customLayer ) ; } | Create a wkt file loading request . |
19,546 | public static function topojson ( $ layerId , $ url , $ parserOptions = array ( ) , Layer $ customLayer = null ) { return new TopoJson ( $ layerId , $ url , $ parserOptions , $ customLayer ) ; } | Create a TopoJSON file loading request . |
19,547 | public static function polyline ( $ layerId , $ url , $ parserOptions = array ( ) , Layer $ customLayer = null ) { return new Polyline ( $ layerId , $ url , $ parserOptions , $ customLayer ) ; } | Create a polyline file loading request . |
19,548 | public function encodeControlAttribution ( Attribution $ attribution , Encoder $ encoder ) { $ result = $ this -> doControlEncode ( 'attribution' , $ attribution , $ encoder ) ; foreach ( $ attribution -> getAttributions ( ) as $ value ) { $ result .= sprintf ( '%s.addAttribution(\'%s\');' . "\n" , $ encoder -> encodeR... | Compile attributions . |
19,549 | public function encodeControlLayers ( Layers $ layers , Encoder $ encoder ) { return sprintf ( '%s = L.control.layers(%s, %s, %s);' , $ encoder -> encodeReference ( $ layers ) , $ this -> encodeLayersInformation ( $ layers -> getBaseLayers ( ) , $ encoder ) , $ this -> encodeLayersInformation ( $ layers -> getOverlays ... | Compile layer control . |
19,550 | private function doControlEncode ( $ type , Control $ control , Encoder $ encoder ) { return sprintf ( '%s = L.control.%s(%s);' , $ encoder -> encodeReference ( $ control ) , $ type , $ encoder -> encodeArguments ( array ( $ control -> getOptions ( ) ) ) ) ; } | Compile a control . |
19,551 | private function encodeLayersInformation ( $ layers , Encoder $ encoder ) { $ prepared = '' ; foreach ( $ layers as $ layer ) { if ( $ prepared ) { $ prepared .= ', ' ; } $ prepared .= sprintf ( '%s: %s' , $ encoder -> encodeValue ( $ layer -> getLabel ( ) ) , $ encoder -> encodeReference ( $ layer ) ) ; } return '{' .... | Get layer information so that label is used . |
19,552 | protected function addMethod ( $ name , array $ arguments = array ( ) ) { $ this -> methods [ ] = new MethodCall ( $ this , $ name , $ arguments ) ; return $ this ; } | Add a method call . |
19,553 | protected function encodeSimpleControl ( $ name , AbstractControl $ control , Encoder $ encoder , $ flags = null ) { $ buffer = sprintf ( '%s = L.%s(%s)%s' , $ encoder -> encodeReference ( $ control ) , $ name , $ encoder -> encodeValue ( $ control -> getOptions ( ) ) , $ encoder -> close ( $ flags ) ) ; $ buffer .= $ ... | Encode an control . |
19,554 | public static function breakdown ( $ ts = null ) { if ( $ ts === null ) $ ts = sfDateTimeToolkit :: now ( ) ; $ H = date ( 'H' , $ ts ) ; $ i = date ( 'i' , $ ts ) ; $ s = date ( 's' , $ ts ) ; $ m = date ( 'm' , $ ts ) ; $ d = date ( 'd' , $ ts ) ; $ Y = date ( 'Y' , $ ts ) ; return array ( $ H , $ i , $ s , $ m , $ d... | Breaks down the individual components of the timestamp . |
19,555 | public static function getTS ( $ value = null ) { if ( $ value === null ) { return sfDateTimeToolkit :: now ( ) ; } else if ( $ value instanceof sfDate ) { return $ value -> get ( ) ; } else if ( ! is_numeric ( $ value ) ) { return strtotime ( $ value ) ; } else if ( is_numeric ( $ value ) ) { return $ value ; } throw ... | Retrieve the timestamp from a number of different formats . |
19,556 | public function encodeIcon ( ImageIcon $ icon , Encoder $ encoder ) { return sprintf ( '%s = L.icon(%s);' , $ encoder -> encodeReference ( $ icon ) , $ encoder -> encodeArguments ( array ( $ icon -> getOptions ( ) ) ) ) ; } | Encode the icon . |
19,557 | public function encodeDivIcon ( DivIcon $ icon , Encoder $ encoder ) { return sprintf ( '%s = L.divIcon(%s);' , $ encoder -> encodeReference ( $ icon ) , $ encoder -> encodeArguments ( array ( $ icon -> getOptions ( ) ) ) ) ; } | Encode the div icon . |
19,558 | public function encodeTileLayer ( TileLayer $ layer , Encoder $ builder ) { return sprintf ( '%s = L.tileLayer(%s);' , $ builder -> encodeReference ( $ layer ) , $ builder -> encodeArguments ( array ( $ layer -> getUrl ( ) , $ layer -> getOptions ( ) ) ) ) ; } | Encode a tile layer . |
19,559 | public function openOn ( Map $ map ) { $ this -> map = $ map ; $ map -> addLayer ( $ this ) ; return $ this -> addMethod ( 'openOn' , array ( $ map ) ) ; } | Create openOn map method . |
19,560 | public function setLatLng ( LatLng $ latLng ) { $ this -> latLng = $ latLng ; $ this -> addMethod ( 'setLatLng' , array ( $ latLng ) ) ; return $ this ; } | Sets the geographical point where the popup will open . |
19,561 | public function removeLayer ( Layer $ layer ) { $ key = array_search ( $ layer , $ this -> baseLayers ) ; if ( $ key !== false ) { unset ( $ this -> baseLayers [ $ key ] ) ; } $ key = array_search ( $ layer , $ this -> overlays ) ; if ( $ key !== false ) { unset ( $ this -> overlays [ $ key ] ) ; } return $ this ; } | Remove a layer . |
19,562 | public function jsonSerialize ( ) { $ bounds = $ this -> getBounds ( ) ; return array ( 'type' => 'Polygon' , 'coordinates' => array ( array ( $ bounds -> getNorthEast ( ) -> toGeoJson ( ) , $ bounds -> getNorthWest ( ) -> toGeoJson ( ) , $ bounds -> getSouthWest ( ) -> toGeoJson ( ) , $ bounds -> getSouthEast ( ) -> t... | Get definition as feature collection . |
19,563 | public function setSeparate ( $ separate ) { if ( $ separate ) { $ this -> setOption ( 'zoomControl' , null ) ; } return $ this -> setOption ( 'separate' , ( bool ) $ separate ) ; } | Set separate mode . |
19,564 | public function collect ( EncodeValueEvent $ event ) { $ value = $ event -> getValue ( ) ; if ( $ value instanceof Definition ) { foreach ( $ value -> getRequiredLibraries ( ) as $ library ) { if ( isset ( $ this -> libraries [ $ library ] ) ) { continue ; } if ( isset ( $ this -> stylesheets [ $ library ] ) ) { foreac... | Collect all libraries . |
19,565 | public function get ( $ countryCode ) { if ( strlen ( $ countryCode ) !== 2 ) { throw new \ InvalidArgumentException ( 'Please provide a 2 character country code.' ) ; } $ countryCode = strtoupper ( $ countryCode ) ; if ( array_key_exists ( $ countryCode , $ this -> aliases ) ) { $ countryCode = $ this -> aliases [ $ c... | Get the flag for the given country code . |
19,566 | public function setAliases ( array $ aliases ) { $ this -> aliases = [ ] ; foreach ( $ aliases as $ alias => $ countryCode ) { $ this -> aliases [ strtoupper ( $ alias ) ] = strtoupper ( $ countryCode ) ; } } | Set the country code aliases . |
19,567 | protected function encodeName ( ) { $ name = $ this -> getProvider ( ) ; if ( $ this -> getVariant ( ) ) { $ name .= '.' . $ this -> getVariant ( ) ; return $ name ; } return $ name ; } | Encode provider name . |
19,568 | public function addTo ( Map $ map ) { $ this -> map = $ map ; $ map -> addLayer ( $ this ) ; return $ this -> addMethod ( 'addTo' , array ( $ map ) ) ; } | Add layer to the map . |
19,569 | public function retrieve ( $ unit = sfTime :: DAY ) { switch ( $ unit ) { case sfTime :: SECOND : return date ( 's' , $ this -> ts ) ; case sfTime :: MINUTE : return date ( 'i' , $ this -> ts ) ; case sfTime :: HOUR : return date ( 'H' , $ this -> ts ) ; case sfTime :: DAY : return date ( 'd' , $ this -> ts ) ; case sf... | Retrieves the given unit of time from the timestamp . |
19,570 | public function set ( $ value = null ) { $ ts = sfDateTimeToolkit :: getTS ( $ value ) ; $ this -> ts = $ ts ; if ( $ this -> init === null ) { $ this -> init = $ ts ; } return $ this ; } | Sets the timestamp value of this sfDate instance . |
19,571 | public function cmp ( $ value ) { $ ts = sfDateTimeToolkit :: getTS ( $ value ) ; if ( $ this -> ts < $ ts ) { return - 1 ; } else if ( $ this -> ts > $ ts ) { return 1 ; } return 0 ; } | Compares two date values . |
19,572 | public function getStack ( GetObjectStackEvent $ event ) { $ stack = array ( ) ; $ value = $ event -> getValue ( ) ; if ( $ value instanceof Map ) { foreach ( $ value -> getControls ( ) as $ control ) { if ( $ control instanceof Layers ) { $ this -> addLayersToStack ( $ control -> getBaseLayers ( ) , $ stack ) ; $ this... | Get object stack of the map as far as possible . |
19,573 | public function encodeMap ( Map $ map , Encoder $ encoder ) { $ output = $ encoder -> getOutput ( ) ; $ hash = spl_object_hash ( $ map ) ; if ( ! isset ( $ this -> initialized [ $ hash ] ) ) { $ output -> prepend ( sprintf ( '%s = L.map(%s);' , $ encoder -> encodeReference ( $ map ) , $ encoder -> encodeArguments ( arr... | Compile a map . |
19,574 | private function addLayersToStack ( $ layers , & $ stack ) { foreach ( $ layers as $ layer ) { if ( $ layer instanceof LayerGroup ) { $ this -> addLayersToStack ( $ layer -> getLayers ( ) , $ stack ) ; } $ stack [ ] = $ layer ; } } | Add layers to to the stack . |
19,575 | public static function getAuthEnv ( $ keys = null , $ debug = false ) { if ( ! $ keys ) { $ msg = 'Keys parameter is required. (Keys to set from env)' ; throw new ApiException ( $ msg ) ; } $ env = true ; foreach ( $ keys as $ k ) { if ( ! ( $ $ k = getenv ( 'ma_' . $ k ) ) ) { $ $ k = '111' ; $ env = false ; } } $ aut... | Get an auth object from the local ENV or test data . |
19,576 | protected function createFeature ( ) { $ feature = new Feature ( $ this , $ this -> getId ( ) ) ; $ feature -> setProperty ( 'type' , lcfirst ( static :: getType ( ) ) ) ; $ feature -> setProperty ( 'options' , $ this -> getOptions ( ) ) ; return $ feature ; } | Create feature of the given definition . |
19,577 | public function getAuthKeyVar ( $ key ) { if ( ! isset ( $ this -> authKeyMap [ $ key ] ) ) { $ msg = 'Invalid Auth key requested: ' . $ key ; throw new ApiException ( $ msg ) ; } $ property = $ this -> authKeyMap [ $ key ] ; return $ this -> $ property ; } | Map an API authentication key to the Auth object s variable and return it . |
19,578 | public function getAuthKeyByVar ( $ property ) { if ( ! ( $ key = array_search ( $ property , $ this -> authKeyMap ) ) ) { $ msg = 'Invalid Auth property requested: ' . $ property ; throw new ApiException ( $ msg ) ; } return $ key ; } | Get an authentication key by variable name . |
19,579 | public static function add ( $ ts = null , $ num = 1 , $ unit = sfTime :: DAY ) { if ( $ ts === null ) $ ts = sfDateTimeToolkit :: now ( ) ; list ( $ H , $ i , $ s , $ m , $ d , $ Y ) = sfDateTimeToolkit :: breakdown ( $ ts ) ; switch ( $ unit ) { case sfTime :: SECOND : return mktime ( $ H , $ i , $ s + $ num , $ m , ... | Adds the specified number of given units of time to the given date . |
19,580 | public static function subtract ( $ ts = null , $ num = 1 , $ unit = sfTime :: DAY ) { return sfTime :: add ( $ ts , $ num * - 1 , $ unit ) ; } | Subtracts the specified number of given units of time from the given date . |
19,581 | public static function clearTime ( $ ts = null ) { if ( $ ts === null ) $ ts = sfDateTimeToolkit :: now ( ) ; list ( $ H , $ i , $ s , $ m , $ d , $ Y ) = sfDateTimeToolkit :: breakdown ( $ ts ) ; return mktime ( 0 , 0 , 0 , $ m , $ d , $ Y ) ; } | Returns the timestamp with the date but without the time of day . |
19,582 | public static function clearDate ( $ ts = null ) { if ( $ ts === null ) $ ts = sfDateTimeToolkit :: now ( ) ; list ( $ H , $ i , $ s , $ m , $ d , $ Y ) = sfDateTimeToolkit :: breakdown ( $ ts ) ; return mktime ( $ H , $ i , $ s , 0 , 0 , 0 ) ; } | Returns the timestamp with the time of day but without the date . |
19,583 | public static function setDay ( $ ts = null , $ day = 1 ) { list ( $ H , $ i , $ s , $ m , $ d , $ Y ) = sfDateTimeToolkit :: breakdown ( $ ts ) ; return mktime ( $ H , $ i , $ s , $ m , $ day , $ Y ) ; } | Set the day value of this timestamp . |
19,584 | public static function addSecond ( $ ts = null , $ num = 1 ) { return sfTime :: add ( $ ts , $ num , sfTime :: SECOND ) ; } | Adds the specified number of seconds to the timestamp . |
19,585 | public static function subtractSecond ( $ ts = null , $ num = 1 ) { return sfTime :: subtract ( $ ts , $ num , sfTime :: SECOND ) ; } | Subtracts the specified number of seconds from the timestamp . |
19,586 | public static function addMinute ( $ ts = null , $ num = 1 ) { return sfTime :: add ( $ ts , $ num , sfTime :: MINUTE ) ; } | Adds the specified number of minutes to the timestamp . |
19,587 | public static function subtractMinute ( $ ts = null , $ num = 1 ) { return sfTime :: subtract ( $ ts , $ num , sfTime :: MINUTE ) ; } | Subtracts the specified number of minutes from the timestamp . |
19,588 | public static function addHour ( $ ts = null , $ num = 1 ) { return sfTime :: add ( $ ts , $ num , sfTime :: HOUR ) ; } | Adds the specified number of hours to the timestamp . |
19,589 | public static function subtractHour ( $ ts = null , $ num = 1 ) { return sfTime :: subtract ( $ ts , $ num , sfTime :: HOUR ) ; } | Subtracts the specified number of hours from the timestamp . |
19,590 | public static function addDay ( $ ts = null , $ num = 1 ) { return sfTime :: add ( $ ts , $ num , sfTime :: DAY ) ; } | Adds the specified number of days to the timestamp . |
19,591 | public static function subtractDay ( $ ts = null , $ num = 1 ) { return sfTime :: subtract ( $ ts , $ num , sfTime :: DAY ) ; } | Subtracts the specified number of days from the timestamp . |
19,592 | public static function addWeek ( $ ts = null , $ num = 1 ) { return sfTime :: add ( $ ts , $ num , sfTime :: WEEK ) ; } | Adds the specified number of weeks to the timestamp . |
19,593 | public static function subtractWeek ( $ ts = null , $ num = 1 ) { return sfTime :: subtract ( $ ts , $ num , sfTime :: WEEK ) ; } | Subtracts the specified number of weeks from the timestamp . |
19,594 | public static function addMonth ( $ ts = null , $ num = 1 ) { return sfTime :: add ( $ ts , $ num , sfTime :: MONTH ) ; } | Adds the specified number of months to the timestamp . |
19,595 | public static function subtractMonth ( $ ts = null , $ num = 1 ) { return sfTime :: subtract ( $ ts , $ num , sfTime :: MONTH ) ; } | Subtracts the specified number of months from the timestamp . |
19,596 | public static function addQuarter ( $ ts = null , $ num = 1 ) { return sfTime :: add ( $ ts , $ num , sfTime :: QUARTER ) ; } | Adds the specified number of quarters to the timestamp . |
19,597 | public static function subtractQuarter ( $ ts = null , $ num = 1 ) { return sfTime :: subtract ( $ ts , $ num , sfTime :: QUARTER ) ; } | Subtracts the specified number of quarters from the timestamp . |
19,598 | public static function addYear ( $ ts = null , $ num = 1 ) { return sfTime :: add ( $ ts , $ num , sfTime :: YEAR ) ; } | Adds the specified number of years to the timestamp . |
19,599 | public static function subtractYear ( $ ts = null , $ num = 1 ) { return sfTime :: subtract ( $ ts , $ num , sfTime :: YEAR ) ; } | Subtracts the specified number of years from the timestamp . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.