idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
229,400 | public function key ( ) { $ keys = array_keys ( $ this -> data ) ; return isset ( $ keys [ $ this -> position ] ) ? $ keys [ $ this -> position ] : null ; } | Retrieve the current key . Part of the Iterator interface . |
229,401 | public function isValid ( $ value ) { $ filePath = GeneralUtility :: getFileAbsFileName ( $ value ) ; if ( false === GeneralUtility :: getUrl ( $ filePath ) ) { $ errorMessage = $ this -> translateErrorMessage ( 'validator.file_exists.not_valid' , 'configuration_object' , [ $ value ] ) ; $ this -> addError ( $ errorMes... | Checks if the value is a path to an existing file . |
229,402 | protected function setCssContent ( $ cssContent , $ optionalFlags = null ) { $ attr = [ ] ; if ( is_null ( $ optionalFlags ) ) { $ attr [ 'media' ] = 'all' ; } else { $ knownAttributes = [ 'media' ] ; foreach ( $ knownAttributes as $ value ) { if ( array_key_exists ( $ value , $ optionalFlags ) ) { $ attr [ $ value ] =... | Returns css codes |
229,403 | protected function setCssFile ( $ cssFileName , $ hostsWithoutCDNrq = null ) { if ( is_null ( $ hostsWithoutCDNrq ) ) { $ hostsWithoutCDNrq = [ ] ; } if ( in_array ( $ this -> getClientRealIpAddress ( ) , $ hostsWithoutCDNrq ) ) { return '<link rel="stylesheet" type="text/css" href="' . filter_var ( $ cssFileName , FIL... | Returns css link to a given file |
229,404 | protected function setFormJavascriptFinal ( $ frmId ) { $ cnt = implode ( PHP_EOL , [ '$(document).ready(function(){' , '$("form#' . $ frmId . '").submit(function(){' , '$("form#' . $ frmId . ' input[type=checkbox]").attr("readonly", true);' , '$("form#' . $ frmId . ' input[type=password]").attr("readonly", true);' , '... | Builds javascript to avoid multiple form submission |
229,405 | protected function setJavascriptFile ( $ jsFileName , $ hostsWithoutCDNrq = null ) { if ( is_null ( $ hostsWithoutCDNrq ) ) { $ hostsWithoutCDNrq = [ ] ; } if ( in_array ( $ this -> getClientRealIpAddress ( ) , $ hostsWithoutCDNrq ) ) { return '<script type="text/javascript" src="' . filter_var ( $ jsFileName , FILTER_... | Returns javascript link to a given file |
229,406 | protected function getStructureType ( string $ structure , int $ lvl ) : array { $ structureType = "" ; $ dataType = "" ; if ( $ structure === "mixed" || $ structure === "?mixed" ) { $ structureType .= "nullable-" ; $ structure = "mixed" ; } elseif ( strpos ( $ structure , "?" ) === 0 ) { $ structureType .= "nullable-"... | Retorna o tipo de estrutura de dados que a string passada representa . |
229,407 | public function exec ( $ sql = "" , $ bindingValues = array ( ) , $ insert = true ) { if ( preg_match ( "/.*(SELECT|INSERT|UPDATE|SHOW|DELETE).*/" , $ sql ) ) { $ this -> sql = $ sql ; $ query = $ this -> connection -> prepare ( $ sql ) ; if ( preg_match ( '/\s*:(.+?)\s/' , $ sql ) ) { if ( is_array ( $ bindingValues )... | Executes the current SQL query . Returns a ASSOC result set . |
229,408 | protected function convertWhereToString ( array $ whereArray = array ( ) , $ concatenationOperator = " AND " , $ assignmentOperator = "=" ) { if ( empty ( $ whereArray ) ) { return false ; } $ returnWhereStringToken = array ( ) ; foreach ( $ whereArray as $ key => $ val ) { $ _key = strtoupper ( $ key ) ; if ( ( in_arr... | This function converts an array into a Where String . |
229,409 | public function getOneResult ( $ table , $ where = null , $ groupBy = null , $ orderBy = null ) { return $ this -> Select ( $ table , $ where , $ groupBy , $ orderBy , 1 ) ; } | Executes the current SQL query and returns the first result as ASSOC result set |
229,410 | public function Insert ( $ table , $ data = array ( ) ) { if ( empty ( $ table ) || empty ( $ data ) ) { return false ; } foreach ( $ data as $ key => $ val ) { if ( empty ( $ val ) ) { unset ( $ data [ $ key ] ) ; } } $ columns = array_keys ( $ data ) ; if ( ! empty ( $ columns ) ) { $ insert = $ this -> queryFactory ... | Saves the data in the table with a new id ; |
229,411 | private function getClassExtends ( ) { if ( $ this -> isMultiton ( ) ) { $ this -> class -> addUses ( '\Bond\Repository\Multiton as RM' ) ; $ this -> class -> addExtends ( 'RM' ) ; } else { $ this -> class -> addUses ( '\Bond\Repository as R' ) ; $ this -> class -> addExtends ( 'R' ) ; } } | Class to extend |
229,412 | private function getClassConstants ( ) { $ pgClass = $ this -> entity -> pgClass ; $ this -> class -> classComponents [ ] = new ClassConstant ( 'TABLE' , new Sformatf ( "const TABLE = '%s';" , $ pgClass -> getFullyQualifiedName ( ) ) ) ; $ this -> class -> classComponents [ ] = new ClassConstant ( 'PARENT' , new Sforma... | Get class constants |
229,413 | private function setClassComment ( ) { $ connectionSettings = $ this -> entity -> pgClass -> getCatalog ( ) -> db -> resource -> connectionSettings ; $ header = new Sformatf ( <<<TEXT ConnectionInfo %s@%s:%s, Relation %sTEXT , $ connectionSettings -> dbname , $ connectionSettings -> user , $ conn... | Entity generated Headers |
229,414 | private function getOptionsResolverFunctionDeclaration ( ) { $ required = [ ] ; $ optional = [ ] ; $ allowedValues = [ ] ; foreach ( $ this -> entity -> dataTypes as $ name => $ dataType ) { if ( ! $ dataType -> getDefault ( ) and ! $ dataType -> isNullable ( ) ) { $ required [ ] = $ name ; } else { $ optional [ ] = $ ... | Generate a get Options Resolver component for the enity |
229,415 | public function getAndClearBuffer ( $ trim = "" , $ tolower = false ) { $ r = $ this -> getBuffer ( $ trim , $ tolower ) ; $ this -> buffer = "" ; return $ r ; } | Returns and clear the current buffer . |
229,416 | public function getPlugin ( $ class ) { static $ index = null ; if ( is_null ( $ index ) ) { $ index = array ( ) ; for ( $ i = 0 , $ l = count ( $ this -> plugins ) ; $ i < $ l ; $ i ++ ) { $ index [ get_class ( $ this -> plugins [ $ i ] ) ] = $ i ; } } return isset ( $ index [ $ class ] ) ? $ this -> plugins [ $ index... | Returns a plugin by class name . |
229,417 | public function popState ( ) { $ r = array_pop ( $ this -> states ) ; $ this -> state = $ this -> states [ count ( $ this -> states ) - 1 ] ; return $ r ; } | Remove the last state of the state stack and return the removed stack value . |
229,418 | public function pushState ( $ state ) { $ r = array_push ( $ this -> states , $ state ) ; $ this -> state = $ this -> states [ count ( $ this -> states ) - 1 ] ; return $ r ; } | Adds a new state onto the state stack . |
229,419 | public function minify ( $ source ) { $ r = "" ; $ parser = new CssParser ( $ source ) ; $ tokens = $ parser -> getTokens ( ) ; $ filters = $ this -> filters ; $ filterCount = count ( $ this -> filters ) ; $ plugins = $ this -> plugins ; $ pluginCount = count ( $ plugins ) ; $ pluginIndex = array ( ) ; $ pluginTriggerT... | Minifies the CSS source . |
229,420 | public static function initialise ( ) { $ paths = array ( dirname ( __FILE__ ) ) ; while ( list ( $ i , $ path ) = each ( $ paths ) ) { $ subDirectorys = glob ( $ path . "*" , GLOB_MARK | GLOB_ONLYDIR | GLOB_NOSORT ) ; if ( is_array ( $ subDirectorys ) ) { foreach ( $ subDirectorys as $ subDirectory ) { $ paths [ ] = $... | Initialises CssMin . |
229,421 | public static function minify ( $ source , array $ filters = null , array $ plugins = null ) { self :: $ errors = array ( ) ; $ minifier = new CssMinifier ( $ source , $ filters , $ plugins ) ; return $ minifier -> getMinified ( ) ; } | Minifies CSS source . |
229,422 | public static function parse ( $ source , array $ plugins = null ) { self :: $ errors = array ( ) ; $ parser = new CssParser ( $ source , $ plugins ) ; return $ parser -> getTokens ( ) ; } | Parse the CSS source . |
229,423 | private function hsl2hex ( $ hue , $ saturation , $ lightness ) { $ hue = $ hue / 360 ; $ saturation = $ saturation / 100 ; $ lightness = $ lightness / 100 ; if ( $ saturation == 0 ) { $ red = $ lightness * 255 ; $ green = $ lightness * 255 ; $ blue = $ lightness * 255 ; } else { if ( $ lightness < 0.5 ) { $ v2 = $ lig... | Convert a HSL value to hexadecimal notation . |
229,424 | private function hue2rgb ( $ v1 , $ v2 , $ hue ) { if ( $ hue < 0 ) { $ hue += 1 ; } if ( $ hue > 1 ) { $ hue -= 1 ; } if ( ( 6 * $ hue ) < 1 ) { return ( $ v1 + ( $ v2 - $ v1 ) * 6 * $ hue ) ; } if ( ( 2 * $ hue ) < 1 ) { return ( $ v2 ) ; } if ( ( 3 * $ hue ) < 2 ) { return ( $ v1 + ( $ v2 - $ v1 ) * ( ( 2 / 3 ) - $ ... | Apply hue to a rgb color value . |
229,425 | public function getChangelogMinDate ( ) { $ result = null ; $ asChange = 'c' ; $ tblChange = $ this -> resource -> getTableName ( EChange :: ENTITY_NAME ) ; $ query = $ this -> conn -> select ( ) ; $ query -> from ( [ $ asChange => $ tblChange ] , [ EChange :: A_DATE_CHANGED ] ) ; $ query -> order ( [ $ asChange . '.' ... | Select MIN date for the existing change log . |
229,426 | public static function requireView ( ) : void { $ medusa = new Medusa ( self :: $ viewsEngine ) ; $ medusa -> setCacheDirectory ( self :: $ viewsCache ) ; $ medusa -> setViewsDirectory ( self :: $ viewsDirectory ) ; $ medusa -> setViewsExtension ( self :: $ viewsExtension ) ; $ medusa -> register ( Partial :: class ) ;... | Create a new Medusa Object |
229,427 | private function getEmailDatas ( $ request , $ e ) { $ session = $ request -> session ( ) -> all ( ) ; return [ 'date' => Carbon :: now ( ) -> format ( 'd.m.Y H:i:s' ) , 'rUser' => $ request -> user ( ) , 'rSessionOld' => isset ( $ session [ 'flash' ] ) ? $ session [ 'flash' ] [ 'old' ] : [ ] , 'rSessionNew' => isset (... | get error email datas |
229,428 | public function toProfiles ( $ profiles , $ campaignId , $ meta = [ ] ) { $ data = [ 'profile_uids' => $ profiles , 'meta' => $ meta ] ; return $ this -> request -> send ( 'POST' , "profiles/campaigns/$campaignId" , $ data ) ; } | Triggers campaign for multiple profiles |
229,429 | public function toChannels ( $ channels , $ campaignId , $ meta = [ ] ) { $ data = [ 'channel_uids' => $ channels , 'meta' => $ meta ] ; return $ this -> request -> send ( 'POST' , "channels/campaigns/$campaignId" , $ data ) ; } | Triggers campaign for multiple channels |
229,430 | public function nextPageUrl ( ) { if ( $ this -> lastPage ( ) > $ this -> currentPage ( ) ) return $ this -> url ( $ this -> currentPage ( ) + 1 ) ; return null ; } | Get the URL for the next page . |
229,431 | 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 . |
229,432 | 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 . |
229,433 | 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 . |
229,434 | public function shuffle ( ) { $ string = $ this -> get ( ) ; $ value = str_shuffle ( $ string ) ; $ this -> update ( $ value ) ; return $ this ; } | Randomly shuffles the string . |
229,435 | 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 . |
229,436 | 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 . |
229,437 | 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 |
229,438 | 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 . |
229,439 | 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 |
229,440 | 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 |
229,441 | 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 |
229,442 | 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 . |
229,443 | 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 . |
229,444 | 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 . |
229,445 | 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 |
229,446 | 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 . |
229,447 | private function RedirectUrl ( ) { if ( $ this -> logout -> GetNextUrl ( ) ) { return FrontendRouter :: Url ( $ this -> logout -> GetNextUrl ( ) ) ; } return CurrentUrl ( ) ; } | Gets the actual redirect url |
229,448 | 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 . |
229,449 | 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 |
229,450 | 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 |
229,451 | 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 |
229,452 | 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 |
229,453 | public function addEndpoint ( Endpoint $ endpoint ) : Route { $ this -> endpoints [ get_class ( $ endpoint ) ] = $ endpoint ; return $ this ; } | Add an endpoint to route |
229,454 | 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 |
229,455 | 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 |
229,456 | 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 . |
229,457 | 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 . |
229,458 | 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 |
229,459 | 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 |
229,460 | 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 |
229,461 | 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 |
229,462 | 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 |
229,463 | 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 |
229,464 | 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 |
229,465 | 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 . |
229,466 | 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 . |
229,467 | 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 |
229,468 | public function setAuthentication ( $ username , $ password ) { $ this -> _mailer -> Username = $ username ; $ this -> _mailer -> Password = $ password ; return $ this ; } | Sets the authentication used to send the mail . |
229,469 | 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 . |
229,470 | 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 . |
229,471 | 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 . |
229,472 | 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 . |
229,473 | 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 . |
229,474 | 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 . |
229,475 | 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 . |
229,476 | 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 . |
229,477 | public function getCookieItem ( $ key ) { return isset ( $ this -> cookie [ $ key ] ) ? $ this -> cookie [ $ key ] : null ; } | Get a single cookie by index from the cookie array . |
229,478 | 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 . |
229,479 | 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 . |
229,480 | public function getGetItem ( $ key ) { return isset ( $ this -> get [ $ key ] ) ? $ this -> get [ $ key ] : null ; } | Get a single get by index from the get array . |
229,481 | 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 . |
229,482 | 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 . |
229,483 | public function getPostItem ( $ key ) { return isset ( $ this -> post [ $ key ] ) ? $ this -> post [ $ key ] : null ; } | Get a single post by index from the post array . |
229,484 | public function getSessionItem ( $ key ) { return isset ( $ this -> session [ $ key ] ) ? $ this -> session [ $ key ] : null ; } | Get a single session by index from the session array . |
229,485 | 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 . |
229,486 | 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 . |
229,487 | 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 |
229,488 | 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 |
229,489 | 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 |
229,490 | 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 . |
229,491 | 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 . |
229,492 | 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 |
229,493 | 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 . |
229,494 | 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 . |
229,495 | 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 ... |
229,496 | 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 . |
229,497 | 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 . |
229,498 | 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 |
229,499 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.