idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
235,000 | public static function script ( $ text , array $ attributes = [ ] , $ type = 'text/javascript' ) { return static :: openTag ( 'script' , array_merge ( $ attributes , [ 'type' => $ type ] ) ) . ' /*<![CDATA[*/ ' . $ text . ' /*]]>*/ ' . static :: closeTag ( 'script' ) ; } | Render script source |
235,001 | protected function generateDependencyData ( $ cache ) { $ timestamps = $ this -> getTimestamps ( $ cache , ( array ) $ this -> tags ) ; $ newKeys = [ ] ; foreach ( $ timestamps as $ key => $ timestamp ) { if ( $ timestamp === false ) { $ newKeys [ ] = $ key ; } } if ( ! empty ( $ newKeys ) ) { $ timestamps = array_merg... | Generates the data needed to determine if dependency has been changed . This method does nothing in this class . |
235,002 | public function getHasChanged ( $ cache ) { $ timestamps = $ this -> getTimestamps ( $ cache , ( array ) $ this -> tags ) ; return $ timestamps !== $ this -> data ; } | Performs the actual dependency checking . |
235,003 | protected function CreateSubLevel ( NavigationItem $ parent ) { $ navigation = new self ( ) ; $ navigation -> isSubLevel = true ; $ navigation -> naviParent = $ parent ; $ navigation -> SetTreeItem ( $ this -> tree , $ this -> item ) ; return $ navigation ; } | Creates a navigation renderer for a sub level |
235,004 | private function IsActive ( ) { $ pageItem = $ this -> naviItem -> GetPageItem ( ) ; if ( ! $ pageItem ) { return false ; } return $ pageItem -> GetPage ( ) -> Equals ( PageRenderer :: Page ( ) ) ; } | Returns true if the current item points to the current page |
235,005 | private function IsTrail ( ) { $ pageItem = $ this -> naviItem -> GetPageItem ( ) ; if ( ! $ pageItem ) { return false ; } $ parent = PageRenderer :: Page ( ) -> GetParent ( ) ; $ itemPage = $ pageItem -> GetPage ( ) ; while ( $ parent ) { if ( $ itemPage -> Equals ( $ parent ) ) { return true ; } $ parent = $ parent -... | Checks if the current navigation item points to a parent of the current page |
235,006 | public function validateTimestamps ( ) { if ( $ this -> encrypted ) { $ document = $ this -> decryptedDocument ; } else { $ document = $ this -> document ; } $ timestampNodes = $ document -> getElementsByTagName ( 'Conditions' ) ; for ( $ i = 0 ; $ i < $ timestampNodes -> length ; $ i ++ ) { $ nbAttribute = $ timestamp... | Verifies that the document is still valid according Conditions Element . |
235,007 | public function execute ( ) { $ this -> doAction ( self :: ON_BEFORE_MIGRATE_CMD_EXECUTE_ACTION ) ; if ( NULL === $ this -> migrator ) { throw new MigrationException ( 'You must set the migrator before executing this command.' ) ; } $ verbose = self :: getOption ( $ this , 'verbose' ) -> value ; $ direction = self :: g... | Executes the command action . |
235,008 | public function addPClass ( $ pclass ) { if ( ! $ pclass instanceof KlarnaPClass ) { throw new Klarna_InvalidTypeException ( 'pclass' , 'KlarnaPClass' ) ; } if ( ! isset ( $ this -> pclasses ) || ! is_array ( $ this -> pclasses ) ) { $ this -> pclasses = array ( ) ; } if ( $ pclass -> getDescription ( ) === null || $ p... | Adds a PClass to the storage . |
235,009 | public function getPClass ( $ id , $ eid , $ country ) { if ( ! is_int ( $ id ) ) { throw new InvalidArgumentException ( 'Supplied ID is not an integer!' ) ; } if ( ! is_array ( $ this -> pclasses ) ) { throw new Klarna_PClassException ( 'No match for that eid!' ) ; } if ( ! isset ( $ this -> pclasses [ $ eid ] ) || ! ... | Gets the PClass by ID . |
235,010 | public function getPClasses ( $ eid , $ country , $ type = null ) { if ( ! is_int ( $ country ) ) { throw new Klarna_ArgumentNotSetException ( 'country' ) ; } $ tmp = false ; if ( ! is_array ( $ this -> pclasses ) ) { return ; } $ tmp = array ( ) ; foreach ( $ this -> pclasses as $ eid => $ pclasses ) { $ tmp [ $ eid ]... | Returns an array of KlarnaPClasses keyed with pclass ID . If type is specified only that type will be returned . |
235,011 | public function render ( $ templateFile , array $ vars = [ ] ) { $ this -> getService ( 'retriever' ) -> setLocalVars ( $ vars ) ; return $ this -> getService ( 'template' ) -> render ( $ templateFile , $ vars ) ; } | renders a template . uses template service . |
235,012 | public function retrieve ( $ key , $ default = '' ) { $ retriever = $ this -> getService ( 'retriever' ) ; if ( $ retriever -> has ( $ key ) ) { return $ retriever -> get ( $ key ) ; } return $ default ; } | retrieves a param from - the matches of the uri - the request - the flash |
235,013 | static function ModuleClass ( $ type , ModuleLocation $ location ) { $ parts = \ explode ( self :: $ bundleModuleSeparator , $ type ) ; if ( count ( $ parts ) != 2 ) { throw new \ InvalidArgumentException ( 'Module type string must be in the format <bundle>-<module>' ) ; } $ bundle = $ parts [ 0 ] ; $ module = $ parts ... | Gets the class name by type string and module loation |
235,014 | static function CreateModule ( $ type , ModuleLocation $ location ) { $ class = self :: ModuleClass ( $ type , $ location ) ; if ( ! class_exists ( $ class ) ) { return null ; } return new $ class ( ) ; } | Finds the module associated with the given type and returns an instance |
235,015 | static function BackendNavModules ( ) { $ result = array ( ) ; $ allBundles = PathUtil :: Bundles ( ) ; $ coreKey = array_search ( 'Core' , $ allBundles ) ; unset ( $ allBundles [ $ coreKey ] ) ; array_unshift ( $ allBundles , 'Core' ) ; $ bundles = array_values ( $ allBundles ) ; foreach ( $ bundles as $ bundle ) { $ ... | The modules for the backend navigation |
235,016 | private static function SortByNavIndex ( array & $ result ) { $ sorted = array ( ) ; foreach ( $ result as $ bundle => $ modules ) { ksort ( $ modules ) ; $ sorted [ $ bundle ] = $ modules ; } return $ sorted ; } | Sorts the the navigation items by index |
235,017 | private static function AddBackendNavModule ( array & $ result , BackendModule $ module ) { $ bundle = $ module -> MyBundle ( ) ; if ( ! isset ( $ result [ $ bundle ] ) ) { $ result [ $ bundle ] = array ( ) ; } $ result [ $ bundle ] [ $ module -> SideNavIndex ( ) ] = $ module ; } | Adds the module to the side navigation |
235,018 | public function run ( ) { if ( false === function_exists ( 'exec' ) ) { return trigger_error ( 'Function "exec" is not enabled' , E_USER_ERROR ) ; } if ( false === is_readable ( Path :: get ( 'schedule' ) ) ) { return trigger_error ( printf ( 'Could not read schedule folder "%s"' , Path :: get ( 'schedule' ) ) ) ; } if... | Iterate over all schedule files and execute tasks |
235,019 | public function task ( $ script ) { if ( false === is_string ( $ script ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ script ) ) , E_USER_ERROR ) ; } $ script = sprintf ( '%s%s%s.php' , Path :: get ( 'schedule' ) , Application :: get... | Execute individual task of schedule file |
235,020 | private function exec ( $ command , $ background = false ) { exec ( escapeshellcmd ( $ command ) . ( $ background === true ? ' > /dev/null &' : '' ) , $ output ) ; return $ output ; } | Runs system command |
235,021 | private function checkRun ( $ crontab ) { $ time = explode ( ' ' , date ( 'i G j n w' ) ) ; $ crontab = explode ( ' ' , $ crontab ) ; foreach ( $ crontab as $ k => & $ v ) { $ time [ $ k ] = preg_replace ( '/^0+(?=\d)/' , '' , $ time [ $ k ] ) ; $ v = explode ( ',' , $ v ) ; foreach ( $ v as & $ v1 ) { $ v1 = preg_repl... | Checks if script should run |
235,022 | private function bootstrap ( ) { include ( dirname ( dirname ( dirname ( dirname ( dirname ( dirname ( __FILE__ ) ) ) ) ) ) . DIRECTORY_SEPARATOR . 'bootstrap.php' ) ; new \ Bootstrap ( false ) ; } | Load the bootstrap |
235,023 | protected function verifySchema ( array $ schema ) { $ customTypes = isset ( $ schema [ 'customTypes' ] ) ? $ schema [ 'customTypes' ] : [ ] ; if ( ! is_array ( $ customTypes ) ) { throw new Exception ( "Given value for key 'customTypes' is not an array." ) ; } $ properties = isset ( $ schema [ 'properties' ] ) ? $ sch... | Ensures that the given schema has valid values . Will yield defaults where available . |
235,024 | protected function validateMappedValues ( array $ data ) { $ errors = [ ] ; foreach ( array_diff_key ( $ this -> properties , [ ':any_name:' => 1 ] ) as $ key => $ property ) { $ result = $ this -> selectValue ( $ property , $ data ) ; if ( $ result instanceof Ok ) { $ value = $ result -> unwrap ( ) ; if ( $ value === ... | Validates the values of all explicitly defined schema properties . |
235,025 | protected function selectValue ( PropertyInterface $ property , array $ data ) { $ errors = [ ] ; $ key = $ property -> getName ( ) ; $ value = array_key_exists ( $ key , $ data ) ? $ data [ $ key ] : null ; if ( $ value === null && $ property -> isRequired ( ) ) { if ( ! array_key_exists ( $ key , $ data ) ) { $ error... | Returns the property s corresponding value from the given data array . |
235,026 | public function renderNodeTreeFunction ( \ Twig_Environment $ twig , NodeInterface $ node , array $ options = array ( ) ) { return $ twig -> render ( 'MMCmfContentBundle:Form/NodeTree:list.html.twig' , array ( 'node' => $ node , 'icon' => $ this -> getIcon ( get_class ( $ node ) ) , 'options' => $ options ) ) ; } | renders the menu |
235,027 | protected function pretty ( ) { $ xml = $ this -> getParameter ( 'value' ) ; $ level = $ this -> getParameter ( 'level' ) != null ? intval ( $ this -> getParameter ( 'level' ) ) : 6 ; $ xml = explode ( "\n" , preg_replace ( '/>\s*</' , ">\n<" , $ xml ) ) ; $ indent = 0 ; $ pretty = array ( ) ; if ( count ( $ xml ) && p... | Formats an XML string |
235,028 | public function getAllActive ( ) { $ dto = new DTO ( ) ; $ dto -> setParameter ( "Status" , "enabled" ) ; $ dto -> setParameter ( "Installed" , "1" ) ; $ dto -> setOrderBy ( "Priority" ) ; $ dto = $ this -> findAll ( $ dto ) ; return $ dto -> getResults ( ) ; } | Returns an array of all active plugins |
235,029 | public static function isAbsoluteUrl ( $ _path ) { $ url = parse_url ( $ _path ) ; return $ url !== false && isset ( $ url [ 'scheme' ] ) && $ url [ 'scheme' ] != '' ; } | Check is url absolute |
235,030 | public static function invokeSoap ( $ wsdlURL , $ method , array $ params = array ( ) , array $ options = array ( ) ) { try { $ soapClient = new \ SoapClient ( $ wsdlURL , $ options ) ; $ result = $ soapClient -> $ method ( $ params ) ; } catch ( \ SoapFault $ ex ) { $ result = false ; } return $ result ; } | Invoke SOAP method |
235,031 | public function fromUdb2Item ( CultureFeed_Cdb_Item_Base $ item ) { $ dutch = new Language ( 'nl' ) ; $ dutchDetail = $ item -> getDetails ( ) -> getDetailByLanguage ( 'nl' ) ; $ title = $ dutchDetail -> getTitle ( ) ; return $ this -> fromUdb2Media ( $ dutchDetail -> getMedia ( ) , new Description ( $ title ) , new Co... | Create an ImageCollection from the media in the Dutch details of on an UDB2 item . |
235,032 | protected function outputFormat ( $ data , $ default = null ) { switch ( $ this -> getParam ( array ( 'f' ) , $ default ) ) { case 'print-r' : $ this -> line ( print_r ( $ data , true ) ) ; break ; case 'var-export' : $ this -> line ( var_export ( $ data , true ) ) ; break ; case 'json' : $ this -> line ( json_encode (... | Output formatted data |
235,033 | protected function getLimit ( array $ default_limit = array ( ) ) { if ( empty ( $ default_limit ) ) { $ default_limit = $ this -> config -> get ( 'module_cli_limit' , array ( 0 , 100 ) ) ; } $ limit = $ this -> getParam ( 'l' ) ; if ( ! isset ( $ limit ) || ! is_numeric ( $ limit ) ) { return $ default_limit ; } $ exp... | Returns an array of limits form the limit option or a default value |
235,034 | protected function explodeList ( $ value , $ separator = null ) { if ( is_array ( $ value ) ) { return $ value ; } if ( $ value === '' || ! is_string ( $ value ) ) { return array ( ) ; } if ( ! isset ( $ separator ) ) { $ separator = $ this -> config -> get ( 'module_cli_list_separator' , '|' ) ; } return array_map ( '... | Explode a string using a separator character |
235,035 | protected function setSubmittedJson ( $ field ) { $ json = $ this -> getSubmitted ( $ field ) ; if ( isset ( $ json ) ) { $ decoded = json_decode ( $ json , true ) ; if ( json_last_error ( ) === JSON_ERROR_NONE ) { $ this -> setSubmitted ( $ field , $ decoded ) ; } else { $ decoded = json_decode ( base64_decode ( $ jso... | Convert a submitted JSON string into an array or FALSE on error |
235,036 | protected function setSubmittedList ( $ field ) { $ value = $ this -> getSubmitted ( $ field ) ; if ( isset ( $ value ) ) { $ this -> setSubmitted ( $ field , $ this -> explodeList ( $ value ) ) ; } } | Converts a submitted string into an array using a character as an separator |
235,037 | protected function validatePromptList ( $ field , $ label , $ validator , $ default = null ) { $ input = $ this -> prompt ( $ label , $ default ) ; if ( $ this -> isValidInput ( $ this -> explodeList ( $ input ) , $ field , $ validator ) ) { $ this -> setSubmitted ( $ field , $ input ) ; } else { $ this -> errors ( ) ;... | Validate prompt input when dealing with multiple values separated by a list character |
235,038 | public function fetch ( array $ params = [ ] , AssetManagerInterface $ assetManager = null ) { $ asset = $ this -> asset ; $ this -> set ( $ params ) ; return $ this -> validate ( $ asset ( $ this , $ assetManager ) ) ; } | Validate and retrieve an instantiated asset . |
235,039 | public function merge ( \ sndsgd \ Form ... $ forms ) : Form { foreach ( $ forms as $ form ) { $ fields = array_values ( $ form -> getFields ( ) ) ; $ this -> addFields ( ... $ fields ) ; } return $ this ; } | Merge the fields of one or more forms into this one |
235,040 | static public function isValidSelectionMode ( $ mode , $ throw = false ) { $ valid = in_array ( $ mode , [ static :: SELECTION_SINGLE , static :: SELECTION_MULTIPLE , ] , true ) ; if ( ! $ valid && $ throw ) { throw new Exception \ InvalidArgumentException ( "Invalid selection mode '{$mode}'." ) ; } return $ valid ; } | Returns whether the given selection mode is valid or not . |
235,041 | static public function validateName ( $ name ) { if ( null !== $ name && ! is_string ( $ name ) ) { throw new Exception \ UnexpectedTypeException ( $ name , 'string, integer or null' ) ; } if ( ! preg_match ( '/^[a-zA-Z0-9_]+$/' , $ name ) ) { throw new Exception \ InvalidArgumentException ( sprintf ( 'The name "%s" co... | Validates whether the given variable is a valid name . |
235,042 | public function isThreat ( DataInterface $ data ) { $ response = $ this -> client -> post ( self :: API_ENDPOINT , [ 'secret' => $ this -> secret , 'response' => $ data -> getValue ( ) , ] ) ; if ( ! $ response -> isSuccess ( ) ) { return true ; } $ validation = json_decode ( $ response -> getBody ( ) ) ; if ( is_null ... | Flags if the used Control impl detected a threat |
235,043 | private function loadDelegates ( $ entity ) { if ( ! $ this instanceof LazyLoaderInterface ) { return $ entity ; } if ( ! $ entity instanceof LazyPropertiesInterface ) { throw new \ InvalidArgumentException ( sprintf ( '%s objects cannot be hydrated with properties loading delegates without implementing %s.' , get_clas... | Hydrate lazy loads delegate into given Collectionnable if enabled and if entity supports it . |
235,044 | public function get_large_object ( $ key ) { $ encoded = $ this -> get ( $ key ) ; if ( false === $ encoded ) { return false ; } $ uncompressed = @ \ gzdecode ( \ base64_decode ( $ encoded ) ) ; if ( false === $ uncompressed ) { return false ; } return $ this -> maybe_fix_object ( \ unserialize ( $ uncompressed ) ) ; } | Retrieves a cached large object . |
235,045 | public function set_large_object ( $ key , $ value , $ duration = 0 ) { $ compressed = \ gzencode ( \ serialize ( $ value ) ) ; if ( false === $ compressed ) { return false ; } return $ this -> set ( $ key , \ base64_encode ( $ compressed ) , $ duration ) ; } | Sets a transient for a large PHP object . The object will be stored in serialized and gzip encoded form using Base64 encoding to ensure binary safety . |
235,046 | protected function setFiles ( array $ files ) { foreach ( $ files as $ associativeName => $ details ) { foreach ( $ details as $ fileKey => $ detail ) { $ this -> files [ $ fileKey ] [ $ associativeName ] = $ detail ; } } } | store the request files in a nice way |
235,047 | public function getActionClassByName ( $ name ) { if ( method_exists ( $ this , 'actions' ) ) { $ actions = $ this -> actions ( ) ; if ( ! empty ( $ actions [ $ name ] ) && class_exists ( $ actions [ $ name ] ) && is_subclass_of ( $ actions [ $ name ] , '\Micro\Mvc\Action' ) ) { return $ actions [ $ name ] ; } } return... | Get action class by name |
235,048 | public function confirmDeletionMultipleRows ( Request $ request ) { $ checkboxes = $ request -> input ( 'checkbox' ) ; if ( ! $ checkboxes ) { Session :: flash ( 'status_code' , 400 ) ; $ message = 'You have not selected any rows for deletion.' ; Session :: flash ( 'message' , $ message ) ; return Redirect :: route ( '... | Confirm multiple row deletions |
235,049 | public function getFieldLIst ( ) { if ( ! isset ( $ this -> model -> field_list ) ) { return $ this -> model -> getFieldList ( ) ; } return $ this -> model -> field_list ; } | get the Model s Field List |
235,050 | protected function loadDefinitionFromFile ( $ file ) { $ this -> checkFileExistence ( $ file ) ; list ( $ type , $ class ) = $ this -> getFileTypeClass ( $ file ) ; $ data = $ class :: loadFromFile ( $ file ) ; return $ type ? [ $ type => $ data ] : $ data ; } | Load definitions from a file |
235,051 | protected function getFileTypeClass ( $ filename ) { $ parts = explode ( '.' , strtolower ( basename ( $ filename ) ) ) ; $ count = count ( $ parts ) ; $ suffix = $ count > 1 ? $ parts [ $ count - 1 ] : 'php' ; $ type = $ count > 2 ? $ parts [ $ count - 2 ] [ 0 ] : '_' ; $ types = [ 's' => 'services' , 'p' => 'paramete... | Get definition type and loader class |
235,052 | protected function checkFileExistence ( $ file ) { if ( ! file_exists ( $ file ) || ! is_readable ( $ file ) ) { throw new NotFoundException ( Message :: get ( Message :: DEFINITION_NOT_FOUND , $ file ) , Message :: DEFINITION_NOT_FOUND ) ; } } | Check file exists and readable |
235,053 | protected function getLoaderClass ( $ suffix , $ filename ) { $ class = __NAMESPACE__ . '\\Loader' . ucfirst ( $ suffix ) ; if ( ! class_exists ( $ class ) ) { throw new LogicException ( Message :: get ( Message :: FILE_SUFFIX_UNKNOWN , $ filename ) , Message :: FILE_SUFFIX_UNKNOWN ) ; } return $ class ; } | Get loader class name base on suffix |
235,054 | public function setName ( $ name ) { $ this -> name = $ name ; if ( $ this -> node ) { $ this -> node -> name = $ name ; } } | Set the node name . |
235,055 | public function getInfo ( $ path = '.' ) { if ( ! $ this -> svnEnabled ) return false ; $ user = escapeshellarg ( $ this -> svnUsername ) ; $ pw = escapeshellarg ( $ this -> svnPassword ) ; $ creds = ! empty ( $ this -> svnUsername ) && ! empty ( $ this -> svnPassword ) ? "--username {$user} --password {$pw}" : "" ; $ ... | Performs an svn info on the provided path . Returns an array of SVN commit data or false on failure . |
235,056 | public function update ( $ path = '.' ) { if ( ! $ this -> svnEnabled ) return false ; $ user = escapeshellarg ( $ this -> svnUsername ) ; $ pw = escapeshellarg ( $ this -> svnPassword ) ; $ creds = ! empty ( $ this -> svnUsername ) && ! empty ( $ this -> svnPassword ) ? "--username {$user} --password {$pw}" : "" ; $ c... | performs an svn update of the path provided |
235,057 | public function copyPath ( $ fromPath , $ toPath , $ commitMessage ) { $ this -> _validateSvnConfig ( ) ; $ user = escapeshellarg ( $ this -> svnUsername ) ; $ pw = escapeshellarg ( $ this -> svnPassword ) ; $ fromPath = trim ( $ fromPath , '/' ) ; $ toPath = trim ( $ toPath , '/' ) ; $ fromPath = "{$this->svnRepositor... | Performs an svn copy of a repository path to another svn path in the same repository |
235,058 | protected function _validateSvnConfig ( ) { if ( ! $ this -> svnEnabled ) throw new SubversionToolsException ( "Subversion support must be enabled for this action!" ) ; if ( empty ( $ this -> svnUsername ) ) throw new SubversionToolsException ( "Property svn.username is required" ) ; if ( empty ( $ this -> svnPassword ... | validates that all properties needed to work with the svn repository are populated |
235,059 | final public function socketAccept ( $ socket = null ) { if ( is_resource ( $ socket ) ) { $ this -> socket = socket_accept ( $ socket ) ; return $ this -> socket ; } else { throw new InvalidArgumentException ( __METHOD__ . ' expects $socket to be an instance of resource. ' . gettype ( $ resource ) . ' given instead' )... | Creates a client side sockets from a server side one |
235,060 | final public function socketWrite ( $ message = '' , $ length = null ) { return @ socket_write ( $ this -> socket , "{$message}" , is_int ( $ length ) ? $ length : strlen ( $ message ) ) ; } | Write to client socket |
235,061 | public function toSQL ( Parameters $ params , bool $ inner_clause ) { $ scope = $ params -> getSubScope ( $ this -> scope_id ) ; $ this -> scope_id = $ scope -> getScopeID ( ) ; $ q = $ this -> getQuery ( ) ; return '(' . $ params -> getDriver ( ) -> toSQL ( $ scope , $ q , false ) . ')' ; } | Write a sub query as SQL query syntax |
235,062 | public function getViewEngine ( ) { if ( $ this -> app -> exists ( ViewEngineInterface :: class ) ) { return $ this -> app -> get ( ViewEngineInterface :: class ) ; } $ view = View :: forge ( $ this -> web -> view_dir ) ; $ this -> app -> set ( ViewEngineInterface :: class , $ view , true ) ; return $ view ; } | get shared view engine Renderer as default . |
235,063 | public function getErrorView ( ) { if ( $ this -> app -> exists ( ErrorView :: class ) ) { return $ this -> app -> get ( ErrorView :: class ) ; } $ error_files = ( array ) $ this -> app -> get ( Web :: ERROR_VIEWS ) ; if ( empty ( $ error_files ) ) { $ this -> app -> set ( ErrorView :: class , null , true ) ; return nu... | get error view render ErrorView |
235,064 | protected function registerManager ( ) { $ this -> app -> singleton ( 'afroware.jwT.manager' , function ( $ app ) { $ instance = new Manager ( $ app [ 'afroware.jwT.provider.jwT' ] , $ app [ 'afroware.jwT.blacklist' ] , $ app [ 'afroware.jwT.payload.factory' ] ) ; return $ instance -> setBlacklistEnabled ( ( bool ) $ t... | Register the bindings for the JwT Manager . |
235,065 | protected function registerClaimFactory ( ) { $ this -> app -> singleton ( 'afroware.jwT.claim.factory' , function ( $ app ) { $ factory = new ClaimFactory ( $ app [ 'request' ] ) ; $ app -> refresh ( 'request' , $ factory , 'setRequest' ) ; return $ factory -> setTTL ( $ this -> config ( 'ttl' ) ) ; } ) ; } | Register the bindings for the Claim Factory . |
235,066 | public function isAuthenticatedByRole ( Role $ role ) { return ! isset ( $ this -> auth ) || $ this -> auth === $ role -> getRoleName ( ) ; } | check whether a role matches the auth attribute of the menu entry |
235,067 | public function getHref ( ) { if ( is_null ( $ this -> href ) ) { if ( $ this -> localPage ) { $ pathSegments = [ ] ; $ e = $ this ; do { $ pathSegments [ ] = $ e -> path ; } while ( $ e = $ e -> menu -> getParentEntry ( ) ) ; if ( Application :: getInstance ( ) -> getRouter ( ) -> getServerSideRewrite ( ) ) { if ( ( $... | get href attribute value of menu entry |
235,068 | public function arrayToJson ( $ content = null ) { if ( $ this -> getJsonEncodeArray ( ) && is_array ( $ content ) ) { $ this -> header ( 'Content-Type: application/json' ) ; return json_encode ( $ content ) ; } return $ content ; } | Encode array to json if configured |
235,069 | public function objectToJson ( $ content = null ) { if ( $ this -> getJsonEncodeObject ( ) && is_object ( $ content ) ) { if ( method_exists ( $ content , '__toString' ) ) { return ( string ) $ content ; } if ( method_exists ( $ content , 'toJson' ) ) { $ this -> header ( 'Content-Type: application/json' ) ; return jso... | Encode object to json if configured |
235,070 | public function printRecursiveNonAlphaNum ( $ content = null ) { if ( is_array ( $ content ) || is_object ( $ content ) ) { ob_start ( ) ; if ( php_sapi_name ( ) != 'cli' && ! defined ( 'STDIN' ) ) { d ( $ content ) ; } else { var_dump ( $ content ) ; } $ content = ob_get_contents ( ) ; ob_end_clean ( ) ; } return $ co... | Does a print_r with objects and array recursive |
235,071 | public function getReport ( ) { if ( isset ( $ this -> centrifuge ) && $ this -> centrifuge ) { $ this -> report -> setCentrifuge ( $ this -> centrifuge ) ; } return $ this -> report ; } | Returns report object providing various functions to work with detected results . Also the centrifuge data is being set as property of the report object . |
235,072 | public function getReplacedCount ( ) : int { return intval ( array_reduce ( $ this -> fieldResultList , function ( int $ count , FieldReplaceResult $ fieldResult ) { return $ count + $ fieldResult -> getReplacedCount ( ) ; } , 0 ) ) ; } | Get the number of replacements in all fields in this row . |
235,073 | public function getErrorList ( ) : array { $ errorList = $ this -> errorList ; foreach ( $ this -> fieldResultList as $ fieldResult ) { foreach ( $ fieldResult -> getErrorList ( ) as $ error ) { $ errorList [ ] = $ error ; } } return $ errorList ; } | Get any replacement errors . |
235,074 | public function get ( $ key , $ default = '' ) { if ( ! is_null ( $ this -> _env ) ) { $ item = ( $ this -> has ( $ key ) ) ? getenv ( $ key ) : $ default ; if ( is_numeric ( $ item ) ) { if ( strrpos ( $ item , '.' ) !== false ) { return floatval ( $ item ) ; } else { return intval ( $ item ) ; } } switch ( $ item ) {... | Gets an environment variable . |
235,075 | protected function getPath ( $ key ) { if ( ( $ pos = strrpos ( $ key , '/' ) ) !== false ) { $ dir = $ this -> dir_root . DIRECTORY_SEPARATOR . substr ( $ key , 0 , $ pos ) . DIRECTORY_SEPARATOR ; $ key = substr ( $ key , $ pos + 1 ) ; } else { $ dir = $ this -> dir_root . DIRECTORY_SEPARATOR ; } if ( is_callable ( $ ... | Get path base on key . |
235,076 | protected function hashIt ( $ key ) { $ md5 = md5 ( $ key ) ; $ hash = $ this -> file_pref . $ md5 . $ this -> file_suff ; if ( ! $ this -> hash_level ) { return $ hash ; } $ pref = '' ; for ( $ i = 0 ; $ i < $ this -> hash_level ; $ i ++ ) { $ pref .= $ md5 [ $ i ] . '/' ; } return $ pref . $ hash ; } | Get hashed filename |
235,077 | protected function deleteFromDir ( $ dir , $ maxlife = 0 , $ removeDir = false ) { $ now = time ( ) ; if ( is_dir ( $ dir ) ) { $ files = scandir ( $ dir ) ; foreach ( $ files as $ file ) { if ( $ file == "." || $ file == ".." ) { continue ; } $ sub = $ dir . DIRECTORY_SEPARATOR . $ file ; $ res = true ; if ( is_dir ( ... | Remove all contents under one directory |
235,078 | public function register ( ) { $ this -> app -> register ( \ Laravel \ Passport \ PassportServiceProvider :: class ) ; $ this -> app -> register ( \ Railken \ Amethyst \ Providers \ ApiServiceProvider :: class ) ; $ this -> app -> register ( \ Railken \ Amethyst \ Providers \ UserServiceProvider :: class ) ; $ this -> ... | Register any application services . so . |
235,079 | public static function getCountyID ( $ county ) { if ( in_array ( $ county , self :: $ counties ) ) { $ names = array_keys ( self :: $ counties , $ county ) ; return $ names [ 0 ] ; } return false ; } | Returns the id of a given county name |
235,080 | public static function getCountyName ( $ id ) { if ( is_numeric ( $ id ) && array_key_exists ( intval ( $ id ) , self :: $ counties ) ) { return self :: $ counties [ intval ( $ id ) ] ; } return false ; } | Returns the county name of a given county id |
235,081 | protected function metaString ( ) : string { if ( ! $ this -> meta ) { return '' ; } return \ join ( ' ' , \ array_map ( function ( string $ key , $ value ) : string { return $ this -> slugify ( $ key ) . '="' . $ this -> escape -> attr ( $ value ) . '"' ; } , \ array_keys ( $ this -> meta ) , \ array_values ( $ this -... | Convert meta to string |
235,082 | protected function equiv ( $ a , $ b ) : bool { if ( \ is_array ( $ a ) && \ is_scalar ( $ b ) ) { return \ in_array ( $ b , $ a ) ; } if ( \ is_array ( $ b ) && \ is_scalar ( $ a ) ) { return \ in_array ( $ a , $ b ) ; } return ( $ a == $ b ) ; } | Are two values equivalent . |
235,083 | public function addRunner ( $ name , WorkerRunnerInterface $ runner , array $ options = array ( ) ) { $ this -> runners [ $ name ] = array ( 'runner' => $ runner , 'options' => $ options , ) ; } | Register runner . |
235,084 | public function run ( $ name , OutputInterface $ output = null ) { if ( ! $ this -> has ( $ name ) ) { throw new InvalidArgumentException ( "No runner service registered for provided name." ) ; } $ runner = $ this -> runners [ $ name ] [ 'runner' ] ; $ runner -> run ( $ this -> runners [ $ name ] [ 'options' ] , $ outp... | Run worker . |
235,085 | public function insertSnippet ( Plugin $ plugin , $ text , & $ log = '' ) { $ snippetProperties = $ this -> readProperties ( $ text ) ; $ configContents = file_get_contents ( $ this -> configFileLocation ) ; if ( stripos ( $ configContents , "BEGIN PLUGIN CONFIG: {$plugin->Slug}" ) === false ) { $ configContents .= "\n... | Write the specified text to the config file |
235,086 | public function readProperties ( $ config = null , $ filter = null ) { if ( is_null ( $ config ) ) $ config = file_get_contents ( $ this -> configFileLocation ) ; $ props = preg_match_all ( '/\s*\$properties\[[\'\"]([^\"^\']+)[\'\"]\]\s*=\s*(.*?);[\n\r\t]?/s' , $ config , $ m ) ; $ config = array ( ) ; foreach ( $ m [ ... | Parses the properties file . |
235,087 | public function saveContents ( $ contents ) { $ path = pathinfo ( $ this -> configFileLocation ) ; $ backup = $ this -> backupPath . '/pluginconfig.' . date ( 'Y_m_d_His' ) . '.php' ; FileSystemUtils :: safeCopy ( $ this -> configFileLocation , $ backup ) ; FileSystemUtils :: safeFilePutContents ( $ this -> configFileL... | Writes the contents to the config file after first backing up the current config |
235,088 | public function header ( ) { $ args = func_get_args ( ) ; $ name = $ args [ 0 ] ; if ( count ( $ args ) == 2 ) { $ this -> headers [ $ name ] = $ args [ 1 ] ; } return $ this -> headers [ $ name ] ; } | Get and optionally set a header . |
235,089 | public function url ( ) { $ url = $ this -> client -> endpoint ( ) . $ this -> resource . '.json' ; if ( in_array ( $ this -> method , [ 'GET' , 'DELETE' ] ) && $ this -> params !== null ) { $ url .= '?' . http_build_query ( $ this -> params ) ; } return $ url ; } | Return the request url . |
235,090 | public function send ( ) { $ url = $ this -> url ( ) ; $ this -> curl = curl_init ( ) ; curl_setopt ( $ this -> curl , CURLOPT_CUSTOMREQUEST , $ this -> method ) ; if ( in_array ( $ this -> method , [ 'POST' , 'PUT' ] ) ) { $ this -> buildBody ( ) ; } else { $ this -> header ( 'Content-Type' , null ) ; } curl_setopt ( ... | Make a request and return the response data if successful . |
235,091 | protected function buildBody ( ) { if ( count ( $ this -> files ( ) ) ) { $ body = [ ] ; foreach ( $ this -> params as $ key => $ value ) { $ body [ ] = implode ( "\r\n" , [ "Content-Disposition: form-data; name=\"{$key}\"" , "" , $ value ] ) ; } foreach ( $ this -> files as $ key => $ path ) { $ file = new File ( $ pa... | Build the request body . |
235,092 | public function cmdGetTrigger ( ) { $ result = $ this -> getListTrigger ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableTrigger ( $ result ) ; $ this -> output ( ) ; } | Callback for trigger - get command |
235,093 | public function cmdUpdateTrigger ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! is_numeric ( $ params [ 0 ] ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ this ... | Callback for trigger - update command |
235,094 | protected function addTrigger ( ) { if ( ! $ this -> isError ( ) ) { $ state_id = $ this -> trigger -> add ( $ this -> getSubmitted ( ) ) ; if ( empty ( $ state_id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> line ( $ state_id ) ; } } | Add a new trigger |
235,095 | protected function submitAddTrigger ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> setSubmitted ( 'data.conditions' , $ this -> getSubmitted ( 'conditions' ) ) ; $ this -> setSubmittedList ( 'data.conditions' ) ; $ this -> validateComponent ( 'trigger' ) ; $ this -> addTrigger ( ) ; } | Add a new trigger at once |
235,096 | protected function wizardAddTrigger ( ) { $ this -> validatePrompt ( 'name' , $ this -> text ( 'Name' ) , 'trigger' ) ; $ this -> validatePrompt ( 'store_id' , $ this -> text ( 'Store' ) , 'trigger' ) ; $ this -> validatePromptList ( 'data.conditions' , $ this -> text ( 'Conditions' ) , 'trigger' ) ; $ this -> validate... | Add a trigger step by step |
235,097 | public function getIdentity ( ) { if ( $ this -> hasIdentity ( ) ) { if ( $ this -> identity === null ) { $ identity = $ this -> authenticationService -> getIdentity ( ) ; $ identity = array_merge ( $ identity , $ this -> getOption ( 'identity' ) ) ; if ( $ this -> getServiceBroker ( ) -> exists ( 'User' ) ) { $ userSe... | Returns the identity or null if no identity is available |
235,098 | public function getStorage ( ) { if ( ! $ this -> storage && $ this -> getServiceLocator ( ) -> has ( self :: STORAGE_LOCATOR_KEY ) ) { $ this -> setStorage ( $ this -> getServiceLocator ( ) -> get ( self :: STORAGE_LOCATOR_KEY ) ) ; } return $ this -> storage ; } | Retrieve storage instance |
235,099 | protected function getAuthenticationService ( ) { if ( $ this -> authenticationService === null ) { $ this -> authenticationService = new AuthenticationService ( $ this -> getStorage ( ) ) ; } return $ this -> authenticationService ; } | Retrieve AuthenticationService instance |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.