idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
48,500 | public function nextPageUrl ( ) { if ( $ this -> lastPage ( ) > $ this -> currentPage ( ) ) return $ this -> url ( $ this -> currentPage ( ) + 1 ) ; return null ; } | Get the URL for the next page . |
48,501 | public function render ( Presenter $ presenter = null ) { if ( is_null ( $ presenter ) && static :: $ presenterResolver ) $ presenter = call_user_func ( static :: $ presenterResolver , $ this ) ; $ presenter = $ presenter ? : new BootstrapThreePresenter ( $ this ) ; return $ presenter -> render ( ) ; } | Render the paginator using the given presenter . |
48,502 | public function pad ( $ pad_length , $ pad_string = ' ' , $ pad_type = STR_PAD_RIGHT ) { $ string = $ this -> get ( ) ; $ value = str_pad ( $ string , $ pad_length , $ pad_string , $ pad_type ) ; $ this -> update ( $ value ) ; return $ this ; } | Pad a string . |
48,503 | public function rot13 ( ) { $ string = $ this -> get ( ) ; $ value = str_rot13 ( $ string ) ; $ this -> update ( $ value ) ; return $ this ; } | Performs the ROT13 encoding on the str argument and returns the resulting string . |
48,504 | public function shuffle ( ) { $ string = $ this -> get ( ) ; $ value = str_shuffle ( $ string ) ; $ this -> update ( $ value ) ; return $ this ; } | Randomly shuffles the string . |
48,505 | public function possessive ( ) { $ string = $ this -> get ( ) ; $ value = $ string . "'" . ( 's' !== substr ( $ string , - 1 ) ? 's' : null ) ; $ this -> update ( $ value ) ; return $ this ; } | Get the possessive version of a string . |
48,506 | public function toShorten ( $ length = 32 , $ truncate = false ) { $ string = $ this -> get ( ) ; if ( is_bool ( $ length ) ) { $ truncate = $ length ; $ length = 32 ; } else { $ length = ( int ) $ length ; } if ( strlen ( $ string ) > $ length ) { $ length - 4 ; $ string = substr ( $ string , 0 , $ length ) ; if ( ! $... | Shorten a string . |
48,507 | protected function primeQuery ( $ statementString , array $ parameters ) { $ statement = $ this -> connection -> prepare ( $ statementString ) ; foreach ( $ parameters as $ name => $ value ) { if ( is_int ( $ name ) ) { ++ $ name ; } else { $ name = ':' . ltrim ( $ name , ':' ) ; } $ type = \ PDO :: PARAM_STR ; if ( is... | prepare a statement and bind parameters |
48,508 | public function message ( $ msg ) { foreach ( $ this as $ client ) { try { $ this -> execute ( "sendtextmessage" , array ( "msg" => $ msg , "target" => $ client , "targetmode" => Teamspeak :: TEXTMSG_CLIENT ) ) ; } catch ( TeamSpeak3_Adapter_ServerQuery_Exception $ e ) { if ( $ e -> getCode ( ) != 0x0200 ) { throw $ e ... | Sends a text message to all clients residing in the channel group on the virtual server . |
48,509 | protected function getTablegateway ( Resource \ ResourceType $ resourceType ) { $ type = $ resourceType -> getValue ( ) ; if ( ! isset ( $ this -> tableGateways [ $ type ] ) ) { $ this -> tableGateways [ $ type ] = new TableGateway ( $ type , $ this -> zendDbAdapter ) ; } return $ this -> tableGateways [ $ type ] ; } | Get the corresponding Tablegateway of the given ResourceType |
48,510 | protected function buildTree ( $ tree_data ) { $ parent_key = $ this -> config [ 'parent' ] ; $ default_root_id = $ this -> config [ 'default_root_id' ] ; while ( count ( $ tree_data ) ) { $ beginning_with = count ( $ tree_data ) ; foreach ( $ tree_data as $ node_id => $ node ) { $ node [ $ this -> config [ 'childs' ] ... | Build the tree from the received data |
48,511 | protected function ungracefulExit ( $ beginning_with , $ tree_data ) { if ( $ beginning_with == count ( $ tree_data ) ) { throw new \ Exception ( 'This tree has some missing parent items: ' . print_r ( $ tree_data , true ) ) ; } } | Exit the tree creation if the tree can t be built completely |
48,512 | public function add ( $ parent_id , $ node_id , $ node ) { if ( in_array ( $ parent_id , $ this -> config [ 'default_parent' ] ) ) { if ( ! $ this -> config [ 'create_root' ] ) { $ this -> tree [ $ node_id ] = $ node ; $ this -> finder [ $ node_id ] = & $ this -> tree [ $ node_id ] ; return true ; } $ node [ $ this -> ... | Add a leaf on the tree . |
48,513 | public function getChilds ( $ id ) { $ result = [ ] ; if ( array_key_exists ( $ id , $ this -> finder ) ) { return $ this -> recursiveGetChilds ( $ this -> finder [ $ id ] [ $ this -> config [ 'childs' ] ] , $ result ) ; } else { return $ result ; } } | Get all node s children . |
48,514 | private function recursiveGetChilds ( $ childs , $ result ) { foreach ( $ childs as $ node ) { $ result [ ] = $ node [ $ this -> config [ 'id' ] ] ; $ result = $ this -> recursiveGetChilds ( $ node [ $ this -> config [ 'childs' ] ] , $ result ) ; } return $ result ; } | Internal recursive function to get children . |
48,515 | private function recursiveSort ( & $ tree ) { usort ( $ tree , function ( $ a , $ b ) { if ( $ a [ $ this -> config [ 'sort_key' ] ] == $ b [ $ this -> config [ 'sort_key' ] ] ) { return 0 ; } return ( $ a [ $ this -> config [ 'sort_key' ] ] < $ b [ $ this -> config [ 'sort_key' ] ] ) ? - 1 : 1 ; } ) ; foreach ( $ tree... | Internal recursive function |
48,516 | public function execute ( $ hydrationMode = self :: RESULT_TYPE_HYDRATED ) { if ( $ hydrationMode !== self :: RESULT_TYPE_NONE ) { $ items = $ this -> getResultIterator ( ) ; } while ( ! empty ( $ this -> queue ) ) { $ pool = new \ Aws \ CommandPool ( $ this -> dm -> getClient ( ) , $ this -> getQueue ( ) , [ 'concurre... | Execute queued requests . Unprocessed items are automatically retried . |
48,517 | private function RedirectUrl ( ) { if ( $ this -> logout -> GetNextUrl ( ) ) { return FrontendRouter :: Url ( $ this -> logout -> GetNextUrl ( ) ) ; } return CurrentUrl ( ) ; } | Gets the actual redirect url |
48,518 | static public function getCsv ( $ handle , $ length = null , $ delimiter = ',' , $ enclosure = '"' ) { $ separator = preg_quote ( $ delimiter ) ; $ quoteSymbol = preg_quote ( $ enclosure ) ; $ line = '' ; $ eof = false ; do { $ line .= ( $ length === null ? fgets ( $ handle ) : fgets ( $ handle , ( int ) $ length ) ) ;... | Customized a method to read CSV file with Chinese content instead of using PHP fgetcsv function . |
48,519 | public function generateAutoNodeRoute ( RoutableNodeInterface $ node ) { $ repository = $ this -> manager -> getRepository ( AutoNodeRoute :: class ) ; $ route = ( new AutoNodeRoute ( ) ) -> setRoute ( '/' . $ this -> slugify ( $ node ) ) ; while ( ! is_null ( $ parent = $ node -> getParent ( ) ) ) { $ route -> setRout... | generates a AutoNodeRoute for a given Node |
48,520 | public function getAutoNodeRoutesRecursive ( NodeInterface & $ node , $ base = null , & $ routeObjects = array ( ) ) { $ route = $ this -> getAutoNodeRoute ( $ node ) ; if ( $ route ) { $ route -> setRoute ( $ base ? $ base . '/' . util :: slugify ( $ node -> getName ( ) ) : $ this -> generateAutoNodeRoute ( $ node ) -... | get updated AutoNodeRoutes recursive |
48,521 | protected function getIncrement ( $ route ) { $ mapper = new ResultSetMapping ( ) ; $ mapper -> addScalarResult ( 'route' , 'route' ) ; $ builder = $ this -> manager -> createNativeQuery ( 'SELECT route FROM node_route WHERE route REGEXP ?' , $ mapper ) -> setParameter ( '1' , $ this -> prepareMysqlRegexp ( $ route ) )... | check if the generated route already exists and return the count |
48,522 | protected function prepareMysqlRegexp ( $ string ) { $ regexp = $ string ; $ regexp = preg_replace ( '/\([0-9]\)$/' , "" , $ regexp ) ; $ regexp = preg_replace ( '(\(|\))' , '\\\\${0}' , $ regexp ) ; $ regexp .= "([[.left-parenthesis.]][0-9]*[[.right-parenthesis.]])*$" ; return $ regexp ; } | create regexp for mysql query |
48,523 | public function addEndpoint ( Endpoint $ endpoint ) : Route { $ this -> endpoints [ get_class ( $ endpoint ) ] = $ endpoint ; return $ this ; } | Add an endpoint to route |
48,524 | public function checkLength ( $ value ) { if ( ! is_string ( $ value ) ) { return false ; } $ fixum = strlen ( $ value ) ; $ found = false ; $ length = $ this -> getLength ( ) ; if ( is_array ( $ length ) ) { foreach ( $ length as $ value ) { if ( $ fixum == $ value ) { $ found = true ; } if ( $ value == - 1 ) { $ foun... | Checks the length of a barcode |
48,525 | public function checkChars ( $ value ) { if ( ! is_string ( $ value ) ) { return false ; } $ characters = $ this -> getCharacters ( ) ; if ( $ characters == 128 ) { for ( $ x = 0 ; $ x < 128 ; ++ $ x ) { $ value = str_replace ( chr ( $ x ) , '' , $ value ) ; } } else { $ chars = str_split ( $ characters ) ; foreach ( $... | Checks for allowed characters within the barcode |
48,526 | public function listAction ( ) { $ entities = $ this -> container -> get ( "haven_core.category.read_handler" ) -> getAll ( ) ; foreach ( $ entities as $ entity ) { $ delete_forms [ $ entity -> getId ( ) ] = $ this -> container -> get ( "haven_core.category.form_handler" ) -> createDeleteForm ( $ entity -> getId ( ) ) ... | Finds and all persona for admin . |
48,527 | public function addAction ( ) { $ edit_form = $ this -> container -> get ( "haven_core.category.form_handler" ) -> createNewForm ( ) ; $ request = $ this -> container -> get ( 'request_modifier' ) -> setRequest ( $ this -> container -> get ( "request" ) ) -> slug ( array ( "name" ) ) -> getRequest ( ) ; $ edit_form -> ... | Creates a new persona entity . |
48,528 | public function useAuthentication ( $ auth , array $ options = [ ] ) { if ( ! ( $ auth instanceof AuthStrategyInterface ) ) { $ auth = $ this -> getAuthFactory ( ) -> get ( $ auth ) ; $ auth -> setOptions ( $ options ) ; } $ this -> dispatcher -> addListener ( Events :: ON_REQUEST_EVENT , [ $ auth , 'auth' ] ) ; } | Allow the user to add an authentication to the request |
48,529 | function applyStyle ( $ text , $ styles = [ ] ) { if ( ! self :: $ supported ) return $ text ; if ( is_string ( $ styles ) ) { $ styles = [ $ styles ] ; } $ output = $ text ; foreach ( $ styles as $ style ) { if ( isset ( self :: $ theme [ $ style ] ) ) { $ output = $ this -> applyStyle ( $ output , self :: $ theme [ $... | Returns the text with the styles applied to it |
48,530 | public function read ( $ prompt , $ style = '' ) { $ this -> write ( $ prompt . ' ' , $ style ) ; $ stdin = fopen ( 'php://stdin' , 'r' ) ; $ str = fgets ( $ stdin , 4096 ) ; fclose ( $ stdin ) ; return preg_replace ( '{\r?\n$}D' , '' , $ str ) ; } | Read a line from input with an optional prompt and optional style |
48,531 | public function write ( $ text = '' , $ style = 'none' ) { if ( is_array ( $ text ) ) { $ max = 0 ; foreach ( $ text as $ txt ) { $ max = max ( $ max , strlen ( $ txt ) ) ; } $ outline = str_repeat ( ' ' , $ max + 4 ) ; $ this -> writeln ( $ outline , $ style ) ; foreach ( $ text as $ txt ) { $ len = strlen ( $ txt ) ;... | Write a line or a group of lines to output |
48,532 | public static function init ( ) { $ file = ROOT . 'storage/crispysystem.config.php' ; if ( ! is_readable ( $ file ) ) { showPlainError ( 'The file `crispysystem.config.php` in the `storage` directory is not readable' ) ; } $ config = unserialize ( file_get_contents ( $ file ) ) ; static :: $ config = $ config ; } | Read the config from the cached file |
48,533 | public static function cache ( ) { $ cache = [ ] ; $ finder = ( new Finder ( ) ) -> files ( ) -> name ( '/.+\.php/' ) -> in ( ROOT . 'config' ) ; foreach ( $ finder as $ file ) { $ category = str_ireplace ( '.php' , '' , $ file -> getFilename ( ) ) ; $ config = require $ file -> getRealPath ( ) ; $ cache [ $ category ]... | Cache the configuration files into one file |
48,534 | public static function get ( string $ key = null ) { if ( is_null ( $ key ) ) { return static :: $ config ; } $ config = static :: $ config ; $ key = explode ( '.' , $ key ) ; foreach ( $ key as $ k ) { if ( ! isset ( $ config [ $ k ] ) ) { return null ; } $ config = $ config [ $ k ] ; } return $ config ; } | Get the value of a configuration key |
48,535 | protected function savePresets ( array $ presets , $ logMessage ) { $ this -> driverComposite -> setFileContent ( $ this -> settings [ 'repositoryUrl' ] , $ this -> settings [ 'filePath' ] , json_encode ( $ presets , JSON_PRETTY_PRINT ) , '[SURFCAPTAIN] ' . $ logMessage ) ; $ this -> presets = null ; } | Saves the presets . |
48,536 | protected function loadPresets ( ) { if ( ! isset ( $ this -> presets ) ) { $ this -> presets = json_decode ( $ this -> driverComposite -> getFileContent ( $ this -> settings [ 'repositoryUrl' ] , $ this -> settings [ 'filePath' ] ) , true ) ; if ( empty ( $ this -> presets ) ) { throw new Exception ( 'Could not load p... | Load the presets . |
48,537 | public function createService ( ServiceLocatorInterface $ serviceLocator ) { $ config = $ serviceLocator -> get ( 'Config' ) ; if ( ! isset ( $ config [ 'cache_manager' ] ) ) { throw new Exception \ RuntimeException ( 'No cache manager config found.' ) ; } $ options = $ config [ 'cache_manager' ] ; $ manager = new Cach... | Create cache manager service |
48,538 | public function setAuthentication ( $ username , $ password ) { $ this -> _mailer -> Username = $ username ; $ this -> _mailer -> Password = $ password ; return $ this ; } | Sets the authentication used to send the mail . |
48,539 | public function create ( $ options = [ ] ) { if ( isset ( $ options [ 'to' ] ) ) { $ name = '' ; if ( is_array ( $ options [ 'to' ] ) ) { if ( isset ( $ options [ 'to' ] [ 1 ] ) ) { $ name = $ options [ 'to' ] [ 1 ] ; } $ this -> setTo ( $ options [ 'to' ] [ 0 ] , $ name ) ; } else { $ this -> setTo ( $ options [ 'to' ... | Creates the initial message . Takes in to from and subject . |
48,540 | public function setTo ( $ email , $ name = '' ) { if ( empty ( $ email ) ) { throw new MailerException ( 'email is required for setTo!' ) ; } if ( empty ( $ name ) ) { $ name = substr ( $ email , 0 , strrpos ( $ email , '@' ) ) ; } if ( is_null ( $ this -> to ) ) { $ this -> to = [ $ email , $ name ] ; } else { throw n... | Sets the Recipient of the email . |
48,541 | public function setFrom ( $ email , $ name = '' ) { if ( empty ( $ email ) ) { throw new MailerException ( 'email is required for setFrom!' ) ; } if ( empty ( $ name ) ) { $ name = substr ( $ email , 0 , strrpos ( $ email , '@' ) ) ; } if ( is_null ( $ this -> from ) ) { $ this -> from = [ $ email , $ name ] ; } else {... | Sets the Sender of the email . |
48,542 | public function cc ( $ email , $ name = '' ) { if ( empty ( $ email ) ) { throw new MailerException ( 'email is required for cc!' ) ; } $ this -> _mailer -> addCC ( $ email , $ name ) ; return $ this ; } | Adds a CC to the email . |
48,543 | public function bcc ( $ email , $ name = '' ) { if ( empty ( $ email ) ) { throw new MailerException ( 'email is required for bcc!' ) ; } $ this -> _mailer -> addBCC ( $ email , $ name ) ; return $ this ; } | Adds a VCC to the email . |
48,544 | public function addAddress ( $ email , $ name = '' ) { if ( empty ( $ email ) ) { throw new MailerException ( 'email is required for addAddress!' ) ; } $ this -> _mailer -> addAddress ( $ email , $ name ) ; return $ this ; } | Adds a recipient to the email . |
48,545 | public function attach ( $ file ) { if ( empty ( $ file ) ) { throw new MailerException ( 'a file is required to use attach!' ) ; } elseif ( ! file_exists ( $ file ) ) { throw new MailerException ( "$file does not exist!" ) ; } $ this -> _mailer -> addAttachment ( $ file ) ; return $ this ; } | Attaches a file to the email . |
48,546 | public function send ( ) { $ this -> _mailer -> addAddress ( $ this -> to [ 0 ] , $ this -> to [ 1 ] ) ; $ this -> _mailer -> setFrom ( $ this -> from [ 0 ] , $ this -> from [ 1 ] ) ; $ this -> _mailer -> isHtml ( $ this -> html ) ; $ this -> _mailer -> Subject = $ this -> subject ; $ this -> _mailer -> Body = $ this -... | Sends the constructed email . |
48,547 | public function getCookieItem ( $ key ) { return isset ( $ this -> cookie [ $ key ] ) ? $ this -> cookie [ $ key ] : null ; } | Get a single cookie by index from the cookie array . |
48,548 | public function removeCookieItem ( $ key ) { if ( isset ( $ this -> cookie [ $ key ] ) ) { unset ( $ this -> cookie [ $ key ] ) ; return true ; } else { return false ; } } | Remove a single cookie by index from the cookie array . |
48,549 | public function removeFile ( $ key ) { if ( isset ( $ this -> files [ $ key ] ) ) { unset ( $ this -> files [ $ key ] ) ; return true ; } else { return false ; } } | Remove a single file by index from the files array . |
48,550 | public function getGetItem ( $ key ) { return isset ( $ this -> get [ $ key ] ) ? $ this -> get [ $ key ] : null ; } | Get a single get by index from the get array . |
48,551 | public function removeGetItem ( $ key ) { if ( isset ( $ this -> get [ $ key ] ) ) { unset ( $ this -> get [ $ key ] ) ; return true ; } else { return false ; } } | Remove a single get by index from the get array . |
48,552 | public function removeParameter ( $ key ) { if ( isset ( $ this -> parameters [ $ key ] ) ) { unset ( $ this -> parameters [ $ key ] ) ; return true ; } else { return false ; } } | Remove a single parameter by index from the parameters array . |
48,553 | public function getPostItem ( $ key ) { return isset ( $ this -> post [ $ key ] ) ? $ this -> post [ $ key ] : null ; } | Get a single post by index from the post array . |
48,554 | public function getSessionItem ( $ key ) { return isset ( $ this -> session [ $ key ] ) ? $ this -> session [ $ key ] : null ; } | Get a single session by index from the session array . |
48,555 | public function removeSessionItem ( $ key ) { if ( isset ( $ this -> session [ $ key ] ) ) { unset ( $ this -> session [ $ key ] ) ; return true ; } else { return false ; } } | Remove a single session by index from the session array . |
48,556 | public static function getStoragePath ( $ path = '' ) { if ( function_exists ( 'storage_path' ) ) { return storage_path ( $ path ) ; } else { return ( __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '../storage' ) . ( $ path ? DIRECTORY_SEPARATOR . $ path : $ path ) ; } } | Get the path to the storage folder . |
48,557 | public function encode ( ) { if ( is_null ( $ this -> getParameter ( 'value' ) ) ) return '""' ; $ value = $ this -> getParameter ( 'value' ) ; $ index = $ this -> getParameter ( 'index' ) ; if ( $ index != null && is_array ( $ value ) ) return JSONUtils :: encode ( $ value [ $ index ] ) ; return JSONUtils :: encode ( ... | Escapes the specified parameter in value for use in json |
48,558 | public function set ( $ id , $ data , $ lifeTime = 0 ) { if ( $ lifeTime > ( int ) 2592000 ) { $ lifeTime = time ( ) + $ lifeTime ; } return $ this -> memcache -> add ( $ id , $ data , CacheFlags :: CACHE_COMPRESSED , ( int ) $ lifeTime ) ; } | Set the data content for memcache cache provider |
48,559 | public function get ( $ id ) { if ( function_exists ( 'memcache_get' ) ) { return $ this -> memcache -> get ( $ id ) ; } throw new MemcacheException ( sprintf ( 'key id memcache "%s" not found, are you sure memcache_get function already loaded ?' , $ id ) ) ; } | Get data content from cache key memcache |
48,560 | public function process ( PayloadInterface $ payload , ResponseGenerator $ generator ) { $ typeMap = $ generator -> checkContentResponseType ( ) ; $ availableTypes = array_keys ( $ typeMap ) ; $ type = $ this -> determineResponseType ( $ availableTypes ) ; if ( ! $ type ) { $ type = array_shift ( $ availableTypes ) ; }... | Processes the results of the Action . |
48,561 | protected function determineResponseType ( $ availableTypes ) { $ bestType = $ this -> contentNegotiation -> negotiateMedia ( $ availableTypes ) ; if ( $ bestType instanceof Accept \ Media \ MediaValue ) { $ contentType = $ bestType -> getValue ( ) ; $ subType = $ bestType -> getSubtype ( ) ; $ this -> contentType = $ ... | Determines if the Accepts header types match what this responder is configured to return . If not we throw an exception . |
48,562 | public function toJSON ( ) { $ allvals = Array ( ) ; $ reflection = new \ ReflectionObject ( $ this ) ; $ properties = $ reflection -> getProperties ( \ ReflectionProperty :: IS_PUBLIC ) ; foreach ( $ properties as $ prop ) { $ propkey = $ prop -> getName ( ) ; $ allvals [ $ propkey ] = $ this -> $ propkey ; } $ json =... | Outputs the object as a JSON |
48,563 | public function write ( $ contents ) { if ( $ this -> output != '' ) { $ this -> buffer .= "\t\t\$out->write(" . var_export ( $ this -> output , true ) . ");\n" ; $ this -> output = '' ; } $ this -> buffer .= $ contents ; } | Write instructions into the generated code . |
48,564 | public function generateCode ( $ key ) { if ( $ this -> extends === NULL && $ this -> output != '' ) { $ this -> buffer .= "\t\t\$out->write(" . var_export ( $ this -> output , true ) . ");\n" ; $ this -> output = '' ; } $ buffer = sprintf ( "<?php\n\nnamespace %s {\n\n" , __NAMESPACE__ ) ; $ buffer .= 'use KoolKode\Vi... | Generate code within a class and return it . |
48,565 | public function findCertificate ( $ name ) { foreach ( $ this -> accounttypes as $ type ) { foreach ( $ this -> accounts [ $ type ] as $ account ) { if ( ! isset ( $ account [ 'certificates' ] ) ) { continue ; } foreach ( $ account [ 'certificates' ] as $ certificate ) { if ( $ certificate [ 'name' ] == $ name ) { $ ce... | Really only necessary until I implement a direct API route to search for certificates ... |
48,566 | protected function getMappingData ( ) : array { $ mappings = [ ] ; foreach ( $ this -> locator -> getMappingFiles ( ) as $ mappingFile ) { $ mappings [ ] = $ this -> loadMappingFile ( $ mappingFile ) ; } $ mappingData = [ ] ; foreach ( $ mappings as $ mapping ) { $ mappingData = $ this -> mergeMappings ( $ mappingData ... | Get mapping data . |
48,567 | final protected function mergeMappings ( array $ mappingsA , array $ mappingsB ) : array { foreach ( $ mappingsB as $ key => $ value ) { if ( isset ( $ mappingsA [ $ key ] ) || \ array_key_exists ( $ key , $ mappingsA ) ) { if ( \ is_int ( $ key ) ) { $ mappingsA [ ] = $ value ; } elseif ( \ is_array ( $ value ) && \ i... | Merge mapping data . |
48,568 | private function checkPermission ( array $ properties ) { if ( empty ( $ properties ) ) return true ; if ( isset ( $ properties [ 'actions' ] ) && ! is_array ( $ properties [ 'actions' ] ) ) $ properties [ 'actions' ] = array ( $ properties [ 'actions' ] ) ; if ( isset ( $ properties [ 'actions' ] ) && ! empty ( $ prop... | Checks each permission |
48,569 | final public function execute ( ) { if ( ! is_array ( $ this -> controller -> accessRules ( ) ) ) throw new \ Exception ( 'Authentication failed: Method "accessRules" in "' . $ this -> controller -> getClass ( ) . '" must return an array' ) ; foreach ( $ this -> controller -> accessRules ( ) as $ rule ) { if ( ! is_arr... | Executes the authentication |
48,570 | public static function startOrder ( ArrayList $ list , $ order ) { $ order = LambdaUtils :: toSelectCallable ( $ order ) ; $ temp = new static ( $ list , $ order , self :: ORDER_ASC ) ; $ temp -> thenBy ( $ order ) ; return $ temp ; } | Create asc order instance |
48,571 | public static function startOrderDesc ( ArrayList $ list , $ order ) { $ order = LambdaUtils :: toSelectCallable ( $ order ) ; $ temp = new static ( $ list , $ order , self :: ORDER_DESC ) ; $ temp -> thenByDesc ( $ order ) ; return $ temp ; } | Create desc order instance |
48,572 | public function thenBy ( $ order ) { $ order = LambdaUtils :: toSelectCallable ( $ order ) ; $ this -> orders [ ] = array ( "property" => $ order , "direction" => self :: ORDER_ASC ) ; return $ this ; } | New asc order rule |
48,573 | public function thenByDesc ( $ order ) { $ order = LambdaUtils :: toSelectCallable ( $ order ) ; $ this -> orders [ ] = array ( "property" => $ order , "direction" => self :: ORDER_DESC ) ; return $ this ; } | New desc order rule |
48,574 | protected function setDefaultComparator ( ) { $ func = function ( $ a , $ b ) { $ temp = 0 ; $ cmpres = null ; foreach ( $ this -> orders as $ order ) { $ valuea = call_user_func ( $ order [ 'property' ] , $ a ) ; $ valueb = call_user_func ( $ order [ 'property' ] , $ b ) ; if ( $ valuea instanceof \ DateTime || $ valu... | Set the default compare method |
48,575 | public function toList ( ) { $ data = $ this -> list -> getData ( ) ; usort ( $ data , $ this -> getComparator ( ) ) ; $ newlist = $ this -> list -> newInstance ( ) ; $ newlist -> setData ( $ data ) ; return $ newlist ; } | Sort and get the result |
48,576 | protected function getFileContents ( ) { $ json = file_get_contents ( $ this -> sessionPath ) ; $ this -> items = json_decode ( $ json , TRUE ) ; } | Get file contents from file . |
48,577 | private function getEnvironment ( ) { $ env = new \ Dotenv \ Dotenv ( $ this -> basePath ) ; $ env -> load ( ) ; $ this -> env [ 'env' ] = getenv ( 'APP_ENV' ) ; $ this -> env [ 'debug' ] = getenv ( 'APP_DEBUG' ) ; $ this -> env [ 'appSecret' ] = getenv ( 'APP_KEY' ) ; } | Loads the environment from your . env file |
48,578 | public function boot ( ) { $ this -> session = Session :: getInstance ( ) ; $ this -> container = new AppContainer ; $ this -> container -> addServiceProvider ( new ServiceProvider ( $ this ) ) ; } | Application boot method . Loads the app providers and sets some default application variables |
48,579 | public function getParentsForBreadcrumbs ( $ entity , & $ parents = [ ] ) { array_push ( $ parents , $ entity ) ; if ( $ entity -> parent !== null ) { $ this -> getParentsForBreadcrumbs ( $ entity -> parent , $ parents ) ; } return array_reverse ( $ parents ) ; } | Finds all parents of the entity |
48,580 | public function deleteItem ( $ id = null ) { if ( $ id === null ) { throw new ItemNotSelectedException ; } $ entity = $ this -> getById ( $ id ) ; $ this -> deleteEntity ( $ entity ) ; } | Method for deleting an item |
48,581 | public function publishUnpublish ( $ id , User $ userEntity ) { if ( $ id === null ) { throw new ItemNotSelectedException ; } $ entity = $ this -> getById ( $ id ) ; $ entity -> published = ! $ entity -> published ; $ entity -> modifiedOn = new DateTime ( ) ; $ entity -> modifiedBy = $ userEntity ; $ this -> repository... | Method for publishing and unpublishing entity |
48,582 | public function getDefaultValues ( $ id = null ) { if ( $ id === null ) { return array ( ) ; } $ entity = $ this -> getById ( $ id ) ; $ values = $ this -> getDefaultFormValues ( $ entity ) ; return $ values ; } | Method for passing default values for form |
48,583 | public function getUniqueAlias ( $ entity , string $ titleProperty = 'title' , string $ titleValue = null , string $ aliasColumn = 'seoTitle' ) : string { return $ this -> repository -> getUniqueAlias ( $ entity , trim ( $ titleProperty ) , $ titleValue , $ aliasColumn ) ; } | Returns unique alias for SEF URL |
48,584 | public function getNormalizedName ( ) { if ( $ this -> normalizedName === null ) { $ this -> normalizedName = implode ( '_' , $ this -> getAncestorsNames ( ) ) ; } return $ this -> normalizedName ; } | Get NormalizedName . |
48,585 | public static function fromSchemaType ( $ qname ) { $ types = SchemaTypes :: getInstance ( ) ; $ type = $ types -> getType ( "{$qname->prefix}:{$qname->localName}" ) ; if ( ! $ type ) return null ; $ datatype = new DOMSchemaDatatype ( "{$qname->prefix}:{$qname->localName}" ) ; $ result = new DOMSchemaSimpleType ( $ qna... | Create an instance for a type in the SchemaTypes types list if there is one |
48,586 | public static function GetBuiltInComplexTypeByTypeCode ( $ typeCode ) { $ type = XmlTypeCode :: getTypeForCode ( $ typeCode ) ; if ( $ type === false ) { throw new \ InvalidArgumentException ( "The typecode passed to DOMSchemaType::GetBuiltInComplexTypeByTypeCode is not valid" ) ; } return DOMSchemaType :: GetBuiltInCo... | Returns an XmlSchemaComplexType that represents the built - in complex type of the complex type specified . |
48,587 | public static function GetBuiltInComplexTypeByQName ( $ qualifiedName ) { if ( is_null ( $ qualifiedName ) ) throw new \ lyquidity \ xml \ exceptions \ ArgumentNullException ( "The QName passed to DOMSchemaType::GetBuiltInComplexTypeByQName cannot be null" ) ; $ type = "" ; if ( $ qualifiedName instanceof QName ) { $ t... | Returns an XmlSchemaComplexType that represents the built - in complex type of the complex type specified by qualified name . |
48,588 | public static function getSchemaType ( $ domNode ) { try { $ types = SchemaTypes :: getInstance ( ) ; $ type = $ types -> getTypeForDOMNode ( $ domNode ) ; if ( $ type ) { $ resolves = SchemaTypes :: getInstance ( ) -> resolvesToBaseType ( $ type , array ( "xs:anySimpleType" , "xsd:anySimpleType" ) ) ; if ( $ resolves ... | Create a DOMSchemaType instance from a DOMNode |
48,589 | public function processRequest ( RequestInterface $ request ) { $ this -> response = $ this -> communicator -> getResponse ( $ request ) ; return $ this -> response ; } | Sends the request to the server and hands back the response . |
48,590 | public static function initialize ( Session $ session ) : void { static :: $ _session = $ session ; if ( ! static :: $ _session -> keyExists ( "_RESULTS" ) ) { static :: $ _session -> set ( "_RESULTS" , [ ] ) ; } } | Sets session object . |
48,591 | public static function flash ( string $ name , $ result ) : void { $ results = static :: $ _session -> get ( "_RESULTS" ) ; $ results [ $ name ] = [ "type" => "flash" , "result" => $ result ] ; static :: $ _session -> set ( "_RESULTS" , $ results ) ; } | Adds a flash result . |
48,592 | public static function delete ( string $ name ) : void { $ results = static :: $ _session -> get ( "_RESULTS" ) ; unset ( $ results [ $ name ] ) ; static :: $ _session -> set ( "_RESULTS" , $ results ) ; } | Deletes a result . |
48,593 | public static function get ( $ length = - 1 , int $ offset = 0 ) : array { $ ret = [ ] ; $ results = static :: $ _session -> get ( "_RESULTS" ) ; if ( ! is_numeric ( $ length ) && isset ( $ results [ $ length ] ) ) { $ ret = $ results [ $ length ] [ "result" ] ; if ( $ results [ $ length ] [ "type" ] === "flash" ) { un... | Returns the results . |
48,594 | public function match ( $ url = null ) { $ match = parent :: match ( $ url ) ; $ regex = $ this -> getRegex ( $ this -> getMatchUrl ( ) ) ; if ( $ regex !== ' ' ) { if ( preg_match ( "@" . ltrim ( $ regex ) . "@si" , $ this -> getRequestedUrl ( ) , $ matches ) || true === $ match ) { unset ( $ matches [ 0 ] ) ; Paramet... | Regex kontrolu yapar |
48,595 | protected function getValueFromReferencedEntity ( FieldInterface $ field ) { $ references = $ this -> model -> referredIn ( $ field -> name ( ) ) ; foreach ( $ references as $ foreign => $ reference ) { $ entity = $ this -> accessor -> getPropertyValue ( $ this -> instance , $ reference -> container ( ) ) ; if ( $ enti... | Gets value from first referenced entity that has it |
48,596 | public function getValue ( ArrayAccess $ item ) : string { $ value = $ item -> offsetExists ( $ this -> name ) ? $ item -> offsetGet ( $ this -> name ) : '' ; if ( is_callable ( $ this -> filter ) ) { if ( $ this -> filter instanceof ContextAwareFilterInterface ) { $ this -> filter -> setContext ( clone $ item ) ; } $ ... | Get the value from a data object the filter is applied . |
48,597 | public function getIndexes ( $ oid ) { $ query = new Query ( "SELECT string_to_array( indkey::text, ' ') AS keys, * FROM pg_index WHERE indrelid = %oid:int%" , array ( 'oid' => $ this -> get ( 'oid' ) ) ) ; $ indexes = $ this -> db -> query ( $ query ) -> fetch ( Result :: TYPE_DETECT ) ; foreach ( $ this -> indexes as... | Get relation indexes from a oid |
48,598 | public function findByIdentifier ( $ identifier ) { $ identifier = explode ( '.' , $ identifier ) ; if ( count ( $ identifier ) < 2 ) { throw new \ InvalidArgumentException ( "yeah, not a table.column level identifier" ) ; } $ columnName = array_pop ( $ identifier ) ; $ tableName = implode ( '.' , $ identifier ) ; $ ta... | Initalise a attribute by a schema . table . column or table . column identifier AFAICT due to the ambiguity of the identifier this is probably best doen with a round trip to the database . It isn t slow . |
48,599 | protected function buildComments ( ) { if ( is_null ( $ this -> comments ) ) { $ this -> comments = array ( ) ; } else { return ; } $ sql = <<<SQLSELECT a.attrelid::text || '.' || a.attnum AS key, d.description AS textFROM pg_attribute AS aINNER JOIN pg_description AS d ON a.attrelid = d.objoid AND ... | It s a hassle complicating all the column source queries with a join to pg_description . This is a lazy load comment solution . Midly hacky . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.