idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
239,300 | public function renderDropDownMenu ( $ container = null , array $ options = array ( ) ) { $ menu = $ this -> getNavigationMenu ( ) -> renderMenu ( $ container , $ options ) ; $ query = new Query ( $ menu , strtolower ( mb_detect_encoding ( $ menu ) ) ) ; $ uls = $ query -> execute ( 'li>ul' ) ; foreach ( $ uls as $ key... | Render a dropdown menu |
239,301 | protected function addCss ( $ css , \ DOMElement $ el ) { $ el -> setAttribute ( 'class' , $ el -> getAttribute ( 'class' ) ? $ el -> getAttribute ( 'class' ) . ' ' . $ css : $ css ) ; return $ el ; } | Add css to a DomElement |
239,302 | public function flushQueue ( $ table , $ onduplicate = null ) { if ( gettype ( $ table ) != 'string' ) { throw new Exception ( 'First parameter should be string, ' . gettype ( $ table ) . ' given.' ) ; } if ( isset ( $ this -> queue [ $ table ] ) && $ this -> queue [ $ table ] ) { $ query = "INSERT INTO `" . $ table . ... | Bulk insert logic |
239,303 | public function deleteFromList ( $ key_array = array ( ) ) { if ( empty ( $ key_array ) ) return false ; foreach ( $ key_array as $ key_del ) { if ( empty ( $ this -> cacheListing ) ) break ; foreach ( $ this -> cacheListing as $ key ) { if ( mb_strpos ( mb_strtolower ( $ key ) , mb_strtolower ( $ key_del ) ) !== false... | delete memcached values based on an input array |
239,304 | public function handle ( Specification $ spec ) { $ factory = $ this -> registry -> getFactory ( $ spec ) ; return $ factory -> create ( $ spec , $ this -> qb ) ; } | handle specification for queryfactory |
239,305 | public static function isValid ( $ value ) { if ( __CLASS__ === get_called_class ( ) ) { throw new \ RuntimeException ( 'Cannot call isValid() on ' . __CLASS__ ) ; } $ reflectionClass = new \ ReflectionClass ( get_called_class ( ) ) ; $ validValues = $ reflectionClass -> getConstants ( ) ; if ( static :: isBitFlag ( ) ... | Checks if the value is valid according to the enumeration . |
239,306 | public function withCode ( string $ code ) : ViewSource { $ context = clone $ this ; $ context -> code = $ code ; return $ context ; } | Get source copy with redefined code . |
239,307 | public function setRedirect ( $ url , $ code = 302 ) { $ this -> canSendHeaders ( true ) ; $ this -> setHeader ( 'Location' , $ url , true ) -> setHttpResponseCode ( $ code ) ; return $ this ; } | Set redirect URL |
239,308 | public function sendHeaders ( ) { if ( count ( $ this -> _headersRaw ) || count ( $ this -> _headers ) || ( 200 != $ this -> _httpResponseCode ) ) { $ this -> canSendHeaders ( true ) ; } elseif ( 200 == $ this -> _httpResponseCode ) { return $ this ; } $ httpCodeSent = false ; foreach ( $ this -> _headersRaw as $ heade... | Send all headers |
239,309 | public function setBody ( $ content , $ name = null ) { if ( ( null === $ name ) || ! is_string ( $ name ) ) { $ this -> _body = array ( 'default' => ( string ) $ content ) ; } else { $ this -> _body [ $ name ] = ( string ) $ content ; } return $ this ; } | Set body content |
239,310 | public function appendBody ( $ content , $ name = null ) { if ( ( null === $ name ) || ! is_string ( $ name ) ) { if ( isset ( $ this -> _body [ 'default' ] ) ) { $ this -> _body [ 'default' ] .= ( string ) $ content ; } else { return $ this -> append ( 'default' , $ content ) ; } } elseif ( isset ( $ this -> _body [ $... | Append content to the body content |
239,311 | public function clearBody ( $ name = null ) { if ( null !== $ name ) { $ name = ( string ) $ name ; if ( isset ( $ this -> _body [ $ name ] ) ) { unset ( $ this -> _body [ $ name ] ) ; return true ; } return false ; } $ this -> _body = array ( ) ; return true ; } | Clear body array |
239,312 | public function append ( $ name , $ content ) { if ( ! is_string ( $ name ) ) { throw new \ Exception ( 'Invalid body segment key ("' . gettype ( $ name ) . '")' ) ; } if ( isset ( $ this -> _body [ $ name ] ) ) { unset ( $ this -> _body [ $ name ] ) ; } $ this -> _body [ $ name ] = ( string ) $ content ; return $ this... | Append a named body segment to the body content array |
239,313 | public function insert ( $ name , $ content , $ parent = null , $ before = false ) { if ( ! is_string ( $ name ) ) { throw new \ Exception ( 'Invalid body segment key ("' . gettype ( $ name ) . '")' ) ; } if ( ( null !== $ parent ) && ! is_string ( $ parent ) ) { throw new \ Exception ( 'Invalid body segment parent key... | Insert a named segment into the body content array |
239,314 | public function hasExceptionOfType ( $ type ) { foreach ( $ this -> _exceptions as $ e ) { if ( $ e instanceof $ type ) { return true ; } } return false ; } | Does the response object contain an exception of a given type? |
239,315 | public function hasExceptionOfMessage ( $ message ) { foreach ( $ this -> _exceptions as $ e ) { if ( $ message == $ e -> getMessage ( ) ) { return true ; } } return false ; } | Does the response object contain an exception with a given message? |
239,316 | public function hasExceptionOfCode ( $ code ) { $ code = ( int ) $ code ; foreach ( $ this -> _exceptions as $ e ) { if ( $ code == $ e -> getCode ( ) ) { return true ; } } return false ; } | Does the response object contain an exception with a given code? |
239,317 | public function getExceptionByType ( $ type ) { $ exceptions = array ( ) ; foreach ( $ this -> _exceptions as $ e ) { if ( $ e instanceof $ type ) { $ exceptions [ ] = $ e ; } } if ( empty ( $ exceptions ) ) { $ exceptions = false ; } return $ exceptions ; } | Retrieve all exceptions of a given type |
239,318 | public function getExceptionByMessage ( $ message ) { $ exceptions = array ( ) ; foreach ( $ this -> _exceptions as $ e ) { if ( $ message == $ e -> getMessage ( ) ) { $ exceptions [ ] = $ e ; } } if ( empty ( $ exceptions ) ) { $ exceptions = false ; } return $ exceptions ; } | Retrieve all exceptions of a given message |
239,319 | public function getExceptionByCode ( $ code ) { $ code = ( int ) $ code ; $ exceptions = array ( ) ; foreach ( $ this -> _exceptions as $ e ) { if ( $ code == $ e -> getCode ( ) ) { $ exceptions [ ] = $ e ; } } if ( empty ( $ exceptions ) ) { $ exceptions = false ; } return $ exceptions ; } | Retrieve all exceptions of a given code |
239,320 | public function sendResponse ( ) { $ this -> sendHeaders ( ) ; if ( $ this -> isException ( ) && $ this -> renderExceptions ( ) ) { $ exceptions = '' ; foreach ( $ this -> getException ( ) as $ e ) { $ exceptions .= $ e -> __toString ( ) . "\n" ; } echo $ exceptions ; return ; } $ this -> outputBody ( ) ; } | Send the response including all headers rendering exceptions if so requested . |
239,321 | private function getContaoFile ( $ uuid ) { $ uuid = StringUtil :: deserialize ( $ uuid ) ; if ( is_array ( $ uuid ) ) return FilesModel :: findMultipleByUuids ( $ uuid ) ; return FilesModel :: findByUuid ( $ uuid ) ; } | Always return a contao file model since its more suitable when working with contao |
239,322 | private function setContaoFile ( $ file ) { if ( is_array ( $ file ) ) { return serialize ( array_map ( [ __CLASS__ , 'setContaoFile' ] , $ file ) ) ; } if ( $ file instanceof FilesModel ) { return $ file -> uuid ; } if ( Validator :: isStringUuid ( $ file ) ) { return StringUtil :: uuidToBin ( $ file ) ; } return $ fi... | we check if its a file model and extract the uuid . If its a string we convert it . |
239,323 | public function resolveSnippet ( $ name , array & $ parameters ) { $ name = strtoupper ( $ name ) ; if ( isset ( $ this -> clauses [ $ name ] ) ) { $ snippet = $ this -> clauses [ $ name ] -> resolveClauses ( $ parameters ) ; } elseif ( isset ( $ this -> snippets [ $ name ] ) ) { $ snippet = $ this -> snippets [ $ name... | Resolve template snippet . |
239,324 | public function resolveParameter ( $ idx , $ type , $ name ) { return $ this -> dialect -> resolveParameter ( $ idx , $ type , $ name ) ; } | Resolve query parameter . |
239,325 | protected function addClause ( $ name , $ sql , array $ parameters , $ joiner , $ prefix = '' , $ postfix = '' , $ is_inclusive = false ) { $ name = strtoupper ( $ name ) ; if ( ! isset ( $ this -> clauses [ $ name ] ) ) { $ this -> clauses [ $ name ] = new \ Octris \ Sqlbuilder \ Clauses ( $ joiner , $ prefix , $ post... | Add clause . |
239,326 | public function addPaging ( $ limit , $ page = 1 ) { $ this -> addClause ( 'PAGING' , $ this -> dialect -> getLimitString ( $ limit , ( $ page - 1 ) * $ limit ) , [ ] , '' , '' , "\n" , false ) ; return $ this ; } | Add paging . |
239,327 | public function requestPdo ( $ request , $ param = null ) { $ this -> result = $ this -> tableGateway -> requestPdo ( $ request , $ param ) ; return $ this -> result ; } | Excecute request directly by PDO . |
239,328 | public function selectWith ( \ Zend \ Db \ Sql \ Select $ select ) { if ( $ this -> usePaginator === true ) { return $ this -> initPaginator ( $ select ) ; } $ this -> result = $ this -> tableGateway -> selectWith ( $ select ) ; return $ this -> result ; } | Select request . |
239,329 | public function fetchAll ( ) { if ( $ this -> usePaginator === true ) { return $ this -> initPaginator ( $ this -> tableGateway -> getSql ( ) -> select ( ) ) ; } $ this -> result = $ this -> tableGateway -> select ( ) ; return $ this -> result ; } | Fetch All . |
239,330 | public function deleteWith ( \ Zend \ Db \ Sql \ Delete $ delete ) { return $ this -> tableGateway -> deleteWith ( $ delete ) ; } | Delete request . |
239,331 | public function insertWith ( \ Zend \ Db \ Sql \ Insert $ insert ) { return $ this -> tableGateway -> insertWith ( $ insert ) ; } | Insert request . |
239,332 | public function updateWith ( \ Zend \ Db \ Sql \ Update $ update ) { return $ this -> tableGateway -> updateWith ( $ update ) ; } | Update request . |
239,333 | public function fetchRow ( $ column , $ value ) { $ where = array ( $ column , $ value ) ; return $ this -> tableGateway -> select ( $ where ) -> current ( ) ; } | Get row . |
239,334 | public function delete ( AbstractModel $ model ) { $ array = $ model -> toArrayCurrent ( ) ; if ( empty ( $ array ) ) { throw new \ Exception ( 'Error : delete used an empty model' ) ; } return $ this -> tableGateway -> delete ( $ array ) ; } | Delete full modele . |
239,335 | public function usePaginator ( $ options ) { if ( $ options === null ) { $ this -> usePaginator = false ; return $ this ; } $ this -> usePaginator = true ; $ this -> paginatorOptions [ 's' ] = ( isset ( $ options [ 's' ] ) ) ? $ options [ 's' ] : null ; $ this -> paginatorOptions [ 'd' ] = ( isset ( $ options [ 'd' ] )... | Set the mapper options and enable the mapper . |
239,336 | protected function initPaginator ( $ select ) { $ this -> usePaginator = false ; $ this -> paginator = new Paginator ( $ select , $ this -> tableGateway -> getAdapter ( ) , $ this -> tableGateway -> getResultSetPrototype ( ) ) ; if ( isset ( $ this -> paginatorOptions [ 'n' ] ) ) { $ this -> paginator -> setN ( $ this ... | Init the paginator with a select object . |
239,337 | public function printSql ( \ Zend \ Db \ Sql \ SqlInterface $ request ) { return $ request -> getSqlString ( $ this -> tableGateway -> getAdapter ( ) -> getPlatform ( ) ) ; } | Return request sql . |
239,338 | public function register ( $ namespace , $ includePath ) { if ( array_key_exists ( $ namespace , $ this -> includePaths ) ) { throw new \ Exception ( "Error: Namespace '$namespace' is already registered!" ) ; } $ this -> includePaths [ $ namespace ] = rtrim ( $ includePath , DS ) . DS ; } | Register a determinated namespace and its include path to find it . |
239,339 | public function registerClass ( $ className , $ includeFile ) { if ( array_key_exists ( $ className , $ this -> includePaths ) ) { throw new \ Exception ( "Error: Class '$className' is already registered!" ) ; } $ this -> includePaths [ $ className ] = $ includeFile ; } | Register a determinated class to autoloader |
239,340 | protected function createFolders ( ) { foreach ( $ this -> getFolderStructure ( ) as $ folder ) { $ newFolder = $ this -> twigStringRenderer -> renderToString ( $ folder , $ this -> data ) ; $ this -> fs -> mkdir ( $ this -> targetPath . DIRECTORY_SEPARATOR . $ newFolder , self :: DIRECTORY_MODE ) ; $ msg = '[mkdir] ' ... | Creates all folders specified by getFolderStructure within the target location . |
239,341 | protected function copyFiles ( ) { $ skeletonFinder = new SkeletonFinder ( $ this -> lookupPaths ) ; $ sourcePath = $ skeletonFinder -> findByName ( $ this -> skeletonName ) -> getRealpath ( ) ; $ finder = $ this -> getFinderForFilesToCopy ( $ sourcePath ) ; foreach ( $ finder as $ file ) { $ targetFilePath = $ this ->... | Copies all files from the source location to the target location . |
239,342 | protected function renderTemplates ( ) { $ finder = new Finder ; $ finder -> files ( ) -> name ( '*' . self :: TEMPLATE_FILENAME_EXTENSION ) -> in ( $ this -> targetPath ) ; $ twigRenderer = TwigRenderer :: create ( [ 'twig_extensions' => [ new ProjectExtension ( $ this -> configProvider ) ] , 'twig_options' => [ 'auto... | Renders all files within the target location whose extension is . tmpl . twig onto a file that has the same name without that extension . After the rendering all the . tmpl . twig files will be deleted in the target location . |
239,343 | public static function end ( $ edition , $ used , $ start , $ timeNow ) { if ( ! $ used ) { return 0 ; } $ end = $ edition / ( $ used / ( $ timeNow - $ start ) ) ; $ end += $ timeNow ; return $ end ; } | Estimate time to end by given current usage value and max value |
239,344 | public function getValue ( ) { $ val = $ this -> base [ 'value' ] ; if ( is_array ( $ val ) ) { if ( isset ( $ val [ 'ID' ] ) ) { return $ this -> authorFactory -> create ( $ val [ 'ID' ] ) ; } else { $ authors = array ( ) ; foreach ( $ val as $ a ) { $ authors [ ] = $ this -> authorFactory -> create ( $ a [ 'ID' ] ) ;... | Get a single author object or array of author objects . |
239,345 | public static function applyformatToText ( ) { $ args = func_get_args ( ) ; $ count = func_num_args ( ) ; $ text = $ args [ $ count - 1 ] ; if ( $ count == 1 ) { return $ text ; } $ mode_texts = array_slice ( $ args , 0 , $ count - 1 ) ; return self :: buildEscapeCodes ( $ mode_texts ) . $ text . self :: buildEscapeCod... | Applies one or more console formatting codes to text |
239,346 | protected static function buildEscapeCodes ( $ mode_texts ) { if ( ! is_array ( $ mode_texts ) ) { $ mode_texts = array ( $ mode_texts ) ; } $ code_text = '' ; foreach ( $ mode_texts as $ mode ) { $ constant_name = 'self::CONSOLE_' . strtoupper ( $ mode ) ; if ( defined ( $ constant_name ) ) { $ code_text .= ( strlen (... | builds ANSI escape codes |
239,347 | public function getParameter ( $ key ) { if ( isset ( $ this -> queryParts [ $ key ] ) ) { return $ this -> queryParts [ $ key ] ; } else { return false ; } } | getParameter function . |
239,348 | private function getPathForTreeGenerator ( $ pathKey , $ path ) { if ( is_array ( $ path ) && array_key_exists ( 'type' , $ path ) && array_key_exists ( 'path' , $ path ) ) { return $ path ; } if ( ! Str :: contains ( $ pathKey , ']' ) ) { throw new InvalidArgumentException ( 'Missing key options. Supplied key was ' . ... | Converts the key and path into an array that various tree generators expect . |
239,349 | public function create ( $ exclude = array ( ) , $ cache = FALSE ) { if ( $ cache === FALSE || ! ( $ this -> memcached instanceof \ Memcached ) ) { return parent :: create ( $ exclude ) ; } $ parent = parent :: create ( $ exclude ) ; if ( $ parent === FALSE ) { return FALSE ; } $ this -> memcached -> set ( $ this -> ge... | Create object in the database and set in memcached |
239,350 | public function read ( $ pkValue = FALSE , $ cache = FALSE ) { if ( $ cache === FALSE || ! ( $ this -> memcached instanceof \ Memcached ) ) { return parent :: read ( $ pkValue ) ; } if ( $ pkValue !== FALSE ) { $ this -> iset ( static :: $ pk , $ pkValue ) ; } $ obj = $ this -> memcached -> get ( $ this -> getMemcached... | Read an object from memcached if it exists otherwise load the object from the database and then cache it |
239,351 | public function delete ( $ pkValue = FALSE ) { if ( $ pkValue === FALSE ) { $ pkValue = $ this -> iget ( static :: $ pk ) ; } $ parent = parent :: delete ( $ pkValue ) ; if ( $ parent === FALSE ) { return FALSE ; } if ( $ this -> memcached instanceof \ Memcached ) { $ this -> memcached -> delete ( static :: _getMemcach... | Delete an object in the database and memcached |
239,352 | private function getCacheAttributes ( ) { $ attributes = array ( ) ; foreach ( array_keys ( self :: $ attributes ) as $ name ) { $ attributes [ $ name ] = $ this -> iget ( $ name ) ; } return $ attributes ; } | Return object attributes to cache |
239,353 | private function setCacheAttributes ( $ arr ) { foreach ( $ arr as $ name => $ val ) { $ this -> iset ( $ name , $ val , FALSE ) ; } } | Set object attributes from cache |
239,354 | public function getCollection ( $ name ) { $ name = strtolower ( $ name ) ; if ( $ this -> collections -> containsKey ( $ name ) ) { return $ this -> collections -> get ( $ name ) ; } $ this -> collections -> set ( $ name , $ this -> createCollection ( $ name ) ) ; return $ this -> collections -> get ( $ name ) ; } | Gets a Collection by name |
239,355 | public function all ( ) { $ results = [ ] ; foreach ( $ this -> collections as $ collection ) { $ results [ ] = array_merge ( [ 'name' => $ collection -> name ] , $ collection -> info ( ) ) ; } return $ results ; } | Lists the available Collections by name |
239,356 | public function drop ( $ collection ) { if ( ! $ this -> collections -> containsKey ( $ collection ) ) { return false ; } $ this -> collections -> get ( $ collection ) -> drop ( ) ; $ this -> collections -> remove ( $ collection ) ; return true ; } | Drops a Collection - removing all data |
239,357 | private function loadCollections ( ) { $ collections = new ArrayCollection ( ) ; $ finder = new Finder ( ) ; $ finder -> files ( ) -> name ( '*.dat' ) -> in ( $ this -> filepath ) ; foreach ( $ finder as $ file ) { $ name = $ file -> getBasename ( '.dat' ) ; $ collections -> set ( $ name , $ this -> createCollection ( ... | Loads the collections for the Database |
239,358 | public function collectXmlMetadata ( array $ metadataCollection ) : array { if ( file_exists ( $ this -> configPath ) ) { $ xmlConfigurator = new XmlResolver ( new CollectionClassResolver ( [ Scope :: class , Name :: class , ClassName :: class , \ samsonframework \ containercollection \ attribute \ Service :: class ] )... | Get xml metadata collection |
239,359 | public function getDefaultPropertyValue ( $ className , $ propertyName ) { $ reflection = new \ ReflectionClass ( $ className ) ; $ values = $ reflection -> getDefaultProperties ( ) ; return $ values [ $ propertyName ] ?? null ; } | Get default property value by property name |
239,360 | public function createMetadata ( $ class , $ name , $ path , $ scope = 'module' ) : ClassMetadata { $ metadata = new ClassMetadata ( ) ; $ class = ltrim ( $ class , '\\' ) ; $ name = strtolower ( ltrim ( $ name , '\\' ) ) ; $ metadata -> className = $ class ; $ metadata -> name = str_replace ( [ '\\' , '/' ] , '_' , $ ... | Create metadata for module |
239,361 | public function collectAnnotationMetadata ( $ classes , $ metadataCollection ) { new Injectable ( ) ; new InjectArgument ( [ 'var' => 'type' ] ) ; new Service ( [ 'value' => '' ] ) ; $ reader = new AnnotationReader ( ) ; $ resolver = new AnnotationResolver ( new AnnotationClassResolver ( $ reader ) , new AnnotationProp... | Get annotation metadata |
239,362 | public function getRenderer ( ) { $ config = new Config ( $ this -> configDirectory ) ; $ rendererClass = $ config -> getRenderer ( ) ; $ reflection = new ReflectionClass ( $ rendererClass ) ; if ( false === $ reflection -> implementsInterface ( 'Signalert\Renderer\RendererInterface' ) ) { throw new SignalertResolverEx... | Returns a valid renderer class |
239,363 | public function getDriver ( ) { $ config = new Config ( $ this -> configDirectory ) ; $ driverClass = $ config -> getDriver ( ) ; $ reflection = new ReflectionClass ( $ driverClass ) ; if ( false === $ reflection -> implementsInterface ( 'Signalert\Storage\DriverInterface' ) ) { throw new SignalertResolverException ; }... | Returns a valid driver class |
239,364 | public function activateAction ( ) { $ object = $ this -> getObject ( ) ; if ( method_exists ( $ object , 'setActive' ) && method_exists ( $ object , 'getActive' ) ) { $ object -> setActive ( ( $ object -> getActive ( ) == 1 ) ? 0 : 1 ) ; } $ this -> admin -> update ( $ object ) ; return new RedirectResponse ( $ this -... | Activate or inactivate the object |
239,365 | public function assertIsArray ( $ value , $ message = '%s must be an Array' , $ exception = 'Asserts' ) { if ( isset ( $ value ) === false || is_array ( $ value ) === false ) { $ this -> throwException ( $ exception , $ message , $ value ) ; } } | Verifies that the specified condition is array . The assertion fails if the condition is not array . |
239,366 | public function make ( ICategory $ category ) { $ category -> setResponse ( $ this -> response -> view ( \ OogleeBConfig :: get ( 'config.category_view.view' ) , compact ( 'category' ) ) ) ; } | Make the category response . |
239,367 | public function addAction ( $ action ) { if ( $ action instanceof Action ) { $ action = $ action -> getName ( ) ; } $ this -> actionList [ ] = $ action ; $ this -> valid = null ; return $ this ; } | Adds a action name to the list of actions the worker listens to . |
239,368 | public function getFormattedImage ( $ format ) { $ formatName = $ format instanceof FormatInterface ? $ format -> getName ( ) : $ format ; return $ this -> formattedImages -> filter ( function ( FormattedImageInterface $ formattedImage ) use ( $ formatName ) { return ( $ format = $ formattedImage -> getFormat ( ) ) && ... | Returns image formatted for given format name or FormatInterface object . |
239,369 | public function getFormatWebPath ( $ format = null ) { if ( ! $ format = $ format ? : $ this -> defaultFormat ) { return $ this -> getWebPath ( ) ; } return ( $ formattedImage = $ this -> getFormattedImage ( $ format ) ) ? $ formattedImage -> getWebPath ( ) : $ this -> getWebPath ( ) ; } | Returns requested format web path or original one if format doesnt exists . |
239,370 | public function getArea ( ) : float { $ event = new MeasurementOpEvent ( $ this ) ; $ this -> fireOperationEvent ( MeasurementOpEvent :: AREA_EVENT , $ event ) ; return $ event -> getResults ( ) ; } | Gets the area of this MultiSurface as measured in the spatial reference system of this Surface . |
239,371 | public function getPointOnSurface ( ) : Point { $ event = new ProcessOpEvent ( $ this ) ; $ this -> fireOperationEvent ( ProcessOpEvent :: POINT_ON_SURFACE_EVENT , $ event ) ; return $ event -> getResults ( ) ; } | Gets a Point guaranteed to be on the MultiSurface . |
239,372 | function add ( $ selector , $ callbackOrFilterName = null , $ options = null , $ recursive = false , $ priority = 0 ) { if ( is_array ( $ selector ) ) { foreach ( $ selector as $ key => $ filters ) { $ this -> add ( $ key , $ filters ) ; } return $ this ; } if ( ! is_string ( $ selector ) ) { throw new \ InvalidArgumen... | Add a filter to the filters stack |
239,373 | function remove ( $ selector , $ callbackOrName = true ) { if ( array_key_exists ( $ selector , $ this -> filters ) ) { if ( $ callbackOrName === true ) { unset ( $ this -> filters [ $ selector ] ) ; } else { if ( ! is_object ( $ callbackOrName ) ) { $ filter = $ this -> filterFactory -> createFilter ( $ callbackOrName... | Remove a filter from the stack |
239,374 | function filter ( $ data = array ( ) ) { if ( ! is_array ( $ data ) ) { return $ data ; } if ( isset ( $ this -> filters [ self :: SELECTOR_ROOT ] ) ) { $ rootFilters = $ this -> filters [ self :: SELECTOR_ROOT ] ; $ data = $ rootFilters -> applyFilters ( $ data ) ; } foreach ( $ data as $ key => $ value ) { $ data [ $... | Apply filters to an array |
239,375 | function filterItem ( $ data , $ valueIdentifier ) { $ value = Utils :: arrayGetByPath ( $ data , $ valueIdentifier ) ; $ value = $ this -> applyFilters ( $ value , $ valueIdentifier , $ data ) ; if ( is_array ( $ value ) ) { foreach ( array_keys ( $ value ) as $ k ) { $ value [ $ k ] = $ this -> filterItem ( $ data , ... | Apply filters on a single item in the array |
239,376 | function applyFilters ( $ value , $ valueIdentifier , $ context ) { foreach ( $ this -> filters as $ selector => $ filterSet ) { if ( $ selector != self :: SELECTOR_ROOT && $ this -> itemMatchesSelector ( $ valueIdentifier , $ selector ) ) { $ value = $ filterSet -> applyFilters ( $ value , $ valueIdentifier , $ contex... | Apply filters to a single value |
239,377 | protected function itemMatchesSelector ( $ item , $ selector ) { if ( strpos ( $ selector , '*' ) === false ) { return $ item === $ selector ; } $ regex = '/' . str_replace ( '*' , '[^\]]+' , str_replace ( array ( '[' , ']' ) , array ( '\[' , '\]' ) , $ selector ) ) . '/' ; return preg_match ( $ regex , $ item ) ; } | Checks if an item matches a selector |
239,378 | public function get ( $ html = null ) { if ( null === $ html ) { if ( file_exists ( $ this -> _path ) ) { $ html = file_get_contents ( $ this -> _path ) ; } } $ this -> _path = null ; return $ this -> parse ( $ html ) ; } | Get Packed HTML |
239,379 | public static function run_hive_script ( $ script , $ args = null ) { if ( ! $ args ) $ args = array ( ) ; $ args = is_array ( $ args ) ? $ args : array ( $ args ) ; $ args = array_merge ( array ( '--run-hive-script' , '--args' , '-f' , $ script ) , $ args ) ; return self :: hive_pig_script ( 'hive' , $ args ) ; } | Step that runs a Hive script on your job flow . |
239,380 | public static function run_pig_script ( $ script , $ args = null ) { if ( ! $ args ) $ args = array ( ) ; $ args = is_array ( $ args ) ? $ args : array ( $ args ) ; $ args = array_merge ( array ( '--run-pig-script' , '--args' , '-f' , $ script ) , $ args ) ; return self :: hive_pig_script ( 'pig' , $ args ) ; } | Step that runs a Pig script on your job flow . |
239,381 | public static function normalizeProperty ( $ property ) { if ( substr ( $ property , 0 , 1 ) == '_' ) { $ property = substr ( $ property , 1 ) ; } $ property = lcfirst ( $ property ) ; return $ property ; } | Normalizes a property name by making it lowercase and stripping off ies or s |
239,382 | public static function copy ( string $ source , string $ dest , bool $ override = false ) : void { if ( is_file ( $ source ) ) { self :: copyFile ( $ source , $ dest , $ override ) ; return ; } if ( ! is_dir ( $ source ) ) { Helpers :: consoleMessage ( "File or directory '%s' not found." , [ $ source ] ) ; return ; } $... | Copies files recursively and automatically creates nested directories |
239,383 | protected function _captureOutput ( callable $ callable , $ args = null ) { if ( is_null ( $ args ) ) { $ args = [ ] ; } ob_start ( ) ; $ this -> _invokeCallable ( $ callable , $ args ) ; $ output = ob_get_clean ( ) ; return $ output ; } | Invokes the given callable and returns the output as a string . |
239,384 | private function walker ( $ keys , & $ arr ) { if ( count ( $ keys ) == 0 ) { return true ; } $ current = array_shift ( $ keys ) ; return ( is_array ( $ arr ) ? array_key_exists ( $ current , $ arr ) : false ) && ( ( is_array ( $ arr [ $ current ] ) ) ? $ this -> walker ( $ keys , $ arr [ $ current ] ) : ( count ( $ ke... | Recursive walker to check . |
239,385 | public function validate ( & $ arr ) { if ( count ( $ this -> list ) == 0 ) { return true ; } $ ok = true ; foreach ( $ this -> list as $ key => $ value ) { $ list = explode ( '.' , $ value ) ; $ ok = $ ok && $ this -> walker ( $ list , $ arr ) ; } return $ ok ; } | Tries to validate a hash list . |
239,386 | public function handle ( string $ event , callable $ callback , int $ priority = 0 ) : Route { return $ this -> collection -> createRoute ( $ event , $ callback ) -> set ( 'priority' , $ priority ) ; } | Handle an event |
239,387 | public function emit ( string $ name , bool $ cancelable = false ) : Event { return $ this -> dispatch ( new Event ( $ name , $ cancelable ) ) ; } | Emits an event |
239,388 | public function getFacebookHelper ( ) { $ redirectHelper = new FacebookRedirectLoginHelper ( $ this -> getRedirectUrl ( ) , $ this -> appId , $ this -> appSecret ) ; $ redirectHelper -> disableSessionStatusCheck ( ) ; return $ redirectHelper ; } | Get Facebook Redirect Login Helper . |
239,389 | public function getLoginUrl ( $ scope = array ( ) , $ version = null ) { $ scope = $ this -> getScope ( $ scope ) ; return $ this -> getFacebookHelper ( ) -> getLoginUrl ( $ scope , $ version ) ; } | Get Login Url . |
239,390 | public function getCallback ( ) { $ token = $ this -> getAccessToken ( ) ; if ( ! empty ( $ token ) ) { $ this -> putSessionToken ( $ token ) ; return true ; } return false ; } | Get callback from facebook . |
239,391 | public function api ( $ method , $ path , $ parameters = null , $ version = null , $ etag = null ) { $ session = new FacebookSession ( $ this -> getAccessToken ( ) ) ; $ request = with ( new FacebookRequest ( $ session , $ method , $ path , $ parameters , $ version , $ etag ) ) -> execute ( ) -> getGraphObject ( GraphU... | Facebook API Call . |
239,392 | public function get ( $ path , $ parameters = null , $ version = null , $ etag = null ) { return $ this -> api ( 'GET' , $ path , $ parameters , $ version , $ etag ) ; } | Facebook API Request with GET method . |
239,393 | public function post ( $ path , $ parameters = null , $ version = null , $ etag = null ) { return $ this -> api ( 'POST' , $ path , $ parameters , $ version , $ etag ) ; } | Facebook API Request with POST method . |
239,394 | public function delete ( $ path , $ parameters = null , $ version = null , $ etag = null ) { return $ this -> api ( 'DELETE' , $ path , $ parameters , $ version , $ etag ) ; } | Facebook API Request with DELETE method . |
239,395 | public function put ( $ path , $ parameters = null , $ version = null , $ etag = null ) { return $ this -> api ( 'PUT' , $ path , $ parameters , $ version , $ etag ) ; } | Facebook API Request with PUT method . |
239,396 | public function patch ( $ path , $ parameters = null , $ version = null , $ etag = null ) { return $ this -> api ( 'PATCH' , $ path , $ parameters , $ version , $ etag ) ; } | Facebook API Request with PATCH method . |
239,397 | public function getProfile ( $ parameters = [ ] , $ version = null , $ etag = null ) { return $ this -> get ( '/me' , $ parameters , $ version , $ etag ) ; } | Get user profile . |
239,398 | public function verifyPassword ( UserInterface $ user , $ password ) { if ( ! $ password ) { return false ; } $ hashedPassword = $ user -> getHashedPassword ( ) ; if ( ! $ hashedPassword ) { return false ; } return password_verify ( $ password , $ hashedPassword ) ; } | Checks if a given password matches the user s password . |
239,399 | function getRateLimiter ( ) { if ( $ this -> rateLimiter ) { return $ this -> rateLimiter ; } $ app = $ this -> auth -> getApp ( ) ; $ class = $ app [ 'config' ] -> get ( 'auth.loginRateLimiter' , NullRateLimiter :: class ) ; $ this -> rateLimiter = new $ class ( ) ; if ( method_exists ( $ this -> rateLimiter , 'setApp... | Gets the login rate limiter . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.