idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
56,600 | protected function getContents ( $ searchCriterias ) { $ searchCriterias = array_merge ( array ( 'contentType' => '' , 'choiceType' => ReadContentRepositoryInterface :: CHOICE_AND , 'keywords' => null , ) , $ searchCriterias ) ; $ language = $ this -> currentSiteManager -> getSiteLanguage ( ) ; $ siteId = $ this -> cur... | Return block contents |
56,601 | public function format ( $ how , $ class_name = "stdClass" , $ ctor_args = [ ] ) { switch ( $ how ) { case PDO :: FETCH_ASSOC : $ data = $ this -> formatAssoc ( ) ; break ; case PDO :: FETCH_BOTH : $ data = $ this -> formatBoth ( ) ; break ; case PDO :: FETCH_CLASS : $ data = $ this -> formatClass ( $ class_name , $ ct... | Formats and returns the row s data according to the formatting options specified |
56,602 | protected function formatBoth ( ) { $ data = [ ] ; $ index = 0 ; foreach ( $ this -> getData ( ) as $ key => $ value ) { $ data [ $ key ] = $ value ; $ data [ $ index ] = $ value ; $ index ++ ; } return $ data ; } | Formats and returns the row s data as a single array with each column repeated - once with a string key describing the column name and once with an integer key representing the column s numerical position . |
56,603 | protected function fetchAvailableShippingMethods ( ) { if ( ! $ this -> methods ) { $ activeCarriers = $ this -> getShippingConfig ( ) -> getActiveCarriers ( ) ; foreach ( $ activeCarriers as $ carrierCode => $ carrierModel ) { $ this -> addShippingMethodsFromCarrier ( $ carrierCode , $ carrierModel ) ; } } return $ th... | collect all available shipping methods that are mapped to a ROM shipping method |
56,604 | protected function addShippingMethodsFromCarrier ( $ carrierCode , Mage_Shipping_Model_Carrier_Abstract $ model ) { $ carrierTitle = $ this -> getCarrierTitle ( $ model ) ; foreach ( ( array ) $ model -> getAllowedMethods ( ) as $ methodCode => $ method ) { $ this -> storeShippingMethodInfo ( $ carrierCode . '_' . $ me... | add valid shipping methods from the carrier to the list . |
56,605 | protected function storeShippingMethodInfo ( $ shippingMethod , $ displayString ) { $ sdkId = $ this -> lookupShipMethod ( $ shippingMethod ) ; if ( ! $ sdkId ) { $ this -> logger -> warning ( 'Encountered active shipping method with no ROM mapping.' , $ this -> logContext -> getMetaData ( __CLASS__ , [ 'shipping_metho... | add the shipping method to the the list if it is a valid ROM shipping method |
56,606 | protected function getFirstAvailable ( ) { if ( $ this -> methods ) { reset ( $ this -> methods ) ; return key ( $ this -> methods ) ; } return null ; } | get the first available magento shipping method code |
56,607 | public function getRandomBytesString ( $ byteCount ) { $ chars = '' ; if ( $ this -> mcrypt ) { $ chars = mcrypt_create_iv ( $ byteCount , MCRYPT_DEV_URANDOM ) ; } if ( ! $ chars && $ this -> openssl ) { $ chars = openssl_random_pseudo_bytes ( $ byteCount ) ; } if ( ! $ chars && $ this -> urandom ) { while ( ( $ len = ... | generates crypto safe bytes and puts them into a string of chars |
56,608 | public function rand ( $ min = 0 , $ max = null ) { if ( $ max === null ) { $ max = $ this -> defaultMax ; } if ( ! is_int ( $ min ) || ! is_int ( $ max ) ) { throw new Exception ( '$min and $max must be integers' ) ; } if ( $ min > $ max ) { throw new Exception ( '$min must be <= $max' ) ; } $ maxSafe = ( int ) floor ... | generates crypto safe ints inside a given range |
56,609 | public function open ( String $ name = NULL , Array $ _attributes = [ ] ) { $ this -> clearValidationSessions ( ) ; $ this -> setFormName ( $ name , $ _attributes ) ; $ this -> isEnctypeAttribute ( $ _attributes ) ; $ this -> isWhereAttribute ( $ name ) ; $ this -> isQueryAttribute ( ) ; $ this -> isPreventAttribute ( ... | Open form tag . |
56,610 | public function close ( ) { unset ( $ this -> settings [ 'getrow' ] ) ; if ( isset ( $ this -> getJavascriptValidationFunction ) ) { $ this -> outputElement .= Inclusion \ View :: use ( 'JavascriptValidationFunctions' , $ this -> getJavascriptValidationFunction , true , __DIR__ . '/' ) ; $ this -> getJavascriptValidati... | Closes form object . |
56,611 | public function datetimeLocal ( String $ name = NULL , String $ value = NULL , Array $ _attributes = [ ] ) { return $ this -> _input ( $ name , $ value , $ _attributes , 'datetime-local' ) ; } | datetime - local form object . |
56,612 | public function textarea ( String $ name = NULL , String $ value = NULL , Array $ _attributes = [ ] ) { $ this -> setNameAttribute ( $ name ) ; $ this -> setValueAttribute ( $ value ) ; if ( ! empty ( $ this -> settings [ 'attr' ] [ 'name' ] ) ) { $ this -> _postback ( $ this -> settings [ 'attr' ] [ 'name' ] , $ value... | textarea form object . |
56,613 | public function select ( String $ name = NULL , Array $ options = [ ] , $ selected = NULL , Array $ _attributes = [ ] , Bool $ multiple = false ) { $ this -> isTableOrQueryData ( $ options ) ; $ this -> setOptionAttribute ( $ options ) ; $ this -> isExcludeAttribute ( $ options ) ; $ this -> isIncludeAttribute ( $ opti... | select form object . |
56,614 | public function multiselect ( String $ name = NULL , Array $ options = [ ] , $ selected = NULL , Array $ _attributes = [ ] ) { return $ this -> select ( $ name , $ options , $ selected , $ _attributes , true ) ; } | select type multiselect form object . |
56,615 | public function hidden ( $ name = NULL , String $ value = NULL ) { $ name = $ this -> settings [ 'attr' ] [ 'name' ] ?? $ name ; $ value = $ this -> settings [ 'attr' ] [ 'value' ] ?? $ value ; $ this -> settings [ 'attr' ] = [ ] ; $ hiddens = NULL ; if ( is_array ( $ name ) ) foreach ( $ name as $ key => $ val ) { $ h... | hidden form object . |
56,616 | public function file ( String $ name = NULL , Bool $ multiple = false , Array $ _attributes = [ ] ) { if ( ! empty ( $ this -> settings [ 'attr' ] [ 'multiple' ] ) ) { $ multiple = true ; } $ name = $ this -> settings [ 'attr' ] [ 'name' ] ?? $ name ; if ( $ multiple === true ) { $ this -> settings [ 'attr' ] [ 'multip... | file form object . |
56,617 | public function group ( $ code = '' , String $ class = '' ) { if ( is_string ( $ code ) ) { $ this -> settings [ 'group' ] [ 'class' ] = $ this -> bootstrapClassResolution ( 'form-group' , $ code ) ; return $ this ; } elseif ( is_callable ( $ code ) ) { $ this -> callableGroup = true ; $ result = $ this -> getHTMLClass... | Use of bootstrap group |
56,618 | public function label ( String $ for = NULL , String $ value = NULL , String $ class = NULL ) { $ this -> settings [ 'label' ] [ 'for' ] = $ for ; $ this -> settings [ 'label' ] [ 'value' ] = $ value ; $ this -> settings [ 'label' ] [ 'class' ] = $ class ; return $ this ; } | Use of bootstrap label |
56,619 | protected function createSelectElement ( $ options , $ selected , $ _attributes , & $ return ) { $ return = '<select' . $ this -> attributes ( $ _attributes ) . '>' ; if ( is_array ( $ options ) ) foreach ( $ options as $ key => $ value ) { if ( is_array ( $ selected ) ) { if ( in_array ( $ key , $ selected ) ) { $ sel... | Protected create select element |
56,620 | protected function setSelectedAttribute ( & $ selected , $ options ) { $ selected = $ this -> settings [ 'selectedKey' ] ?? $ selected ; if ( isset ( $ this -> settings [ 'selectedValue' ] ) ) { $ flip = array_flip ( $ options ) ; $ selected = $ flip [ $ this -> settings [ 'selectedValue' ] ] ; } } | Protected set selected attribute |
56,621 | protected function isOrderAttribute ( & $ options ) { if ( isset ( $ this -> settings [ 'order' ] [ 'type' ] ) ) { $ options = Arrays \ Sort :: order ( $ options , $ this -> settings [ 'order' ] [ 'type' ] , $ this -> settings [ 'order' ] [ 'flags' ] ) ; } } | Protected is order attribute |
56,622 | protected function isExcludeAttribute ( & $ options ) { if ( isset ( $ this -> settings [ 'exclude' ] ) ) { $ options = Arrays \ Excluding :: use ( $ options , $ this -> settings [ 'exclude' ] ) ; } } | Protected is exclude attribute |
56,623 | protected function isIncludeAttribute ( & $ options ) { if ( isset ( $ this -> settings [ 'include' ] ) ) { $ options = Arrays \ Including :: use ( $ options , $ this -> settings [ 'include' ] ) ; } } | Protected is include attribute |
56,624 | protected function isTableOrQueryData ( & $ options ) { if ( ! empty ( $ this -> settings [ 'table' ] ) || ! empty ( $ this -> settings [ 'query' ] ) ) { $ key = key ( $ options ) ; $ current = current ( $ options ) ; array_shift ( $ options ) ; $ dbClass = Singleton :: class ( 'ZN\Database\DB' ) ; if ( ! empty ( $ thi... | Protected is table or query data |
56,625 | protected function setNameAttribute ( $ name ) { if ( ! isset ( $ this -> settings [ 'attr' ] [ 'name' ] ) && ! empty ( $ name ) ) { $ this -> settings [ 'attr' ] [ 'name' ] = $ name ; } } | Protected set textarea name attribute |
56,626 | protected function isEnctypeAttribute ( & $ _attributes ) { if ( isset ( $ _attributes [ 'enctype' ] ) ) { $ enctype = $ _attributes [ 'enctype' ] ; if ( isset ( $ this -> enctypes [ $ enctype ] ) ) { $ _attributes [ 'enctype' ] = $ this -> enctypes [ $ enctype ] ; } } } | Protected is enctype attribute |
56,627 | protected function isWhereAttribute ( $ name ) { if ( isset ( $ this -> settings [ 'where' ] ) ) { $ this -> settings [ 'getrow' ] = Singleton :: class ( 'ZN\Database\DB' ) -> get ( $ name ) -> row ( ) ; } } | Protected is where attribute |
56,628 | protected function isQueryAttribute ( ) { if ( $ query = ( $ this -> settings [ 'query' ] ?? NULL ) ) { $ this -> settings [ 'getrow' ] = Singleton :: class ( 'ZN\Database\DB' ) -> query ( $ query ) -> row ( ) ; } } | Protected is query attribute |
56,629 | protected function _unsetselect ( ) { unset ( $ this -> settings [ 'table' ] ) ; unset ( $ this -> settings [ 'query' ] ) ; unset ( $ this -> settings [ 'option' ] ) ; unset ( $ this -> settings [ 'exclude' ] ) ; unset ( $ this -> settings [ 'include' ] ) ; unset ( $ this -> settings [ 'order' ] ) ; unset ( $ this -> s... | protected unset select variables |
56,630 | protected function _unsetopen ( ) { unset ( $ this -> settings [ 'where' ] ) ; unset ( $ this -> settings [ 'whereValue' ] ) ; unset ( $ this -> settings [ 'whereColumn' ] ) ; unset ( $ this -> settings [ 'query' ] ) ; unset ( $ this -> settings [ 'token' ] ) ; unset ( $ this -> settings [ 'process' ] ) ; unset ( $ thi... | protected unset open variables |
56,631 | public function send ( $ opt = null ) { $ http = new $ this -> request_class ( ) ; $ response = $ http -> send_multi_request ( $ this -> queue , array ( 'limit' => $ this -> limit ) ) ; return $ response ; } | Executes the batch request queue . |
56,632 | public function many ( array $ keys ) { $ results = [ ] ; foreach ( $ keys as $ key ) { $ results [ $ key ] = $ this -> get ( $ key ) ; } return $ results ; } | Retrieve multiple items from the cache by key . Items not found in the cache will have a null value . |
56,633 | public function getPrefix ( ) { $ uuid = uniqid ( static :: CACHE_CHECK_PREFIX , true ) ; $ prefix = wp_cache_get ( $ this -> prefix , static :: CACHE_GROUP_KEY , false , $ uuid ) ; if ( $ prefix !== $ uuid ) { return $ prefix ; } $ this -> setPrefix ( $ this -> prefix ) ; return $ this -> getPrefix ( ) ; } | Get the cache key prefix . |
56,634 | public function setPrefix ( $ prefix ) { global $ wpdb ; $ this -> prefix = ! empty ( $ prefix ) ? $ prefix : $ wpdb -> prefix ; wp_cache_set ( $ prefix , uniqid ( $ prefix , true ) , static :: CACHE_GROUP_KEY , 0 ) ; } | Set the cache key prefix . |
56,635 | public function tags ( $ names ) { return new WordPressTaggedCache ( $ this , new TagSet ( $ this , is_array ( $ names ) ? $ names : func_get_args ( ) ) ) ; } | begin executing a new tags operation |
56,636 | public static function updateNginx ( $ srcFilename , $ dstFilename , $ backupDir = null ) { return self :: updateFile ( $ srcFilename , $ dstFilename , 'nginx' , $ backupDir ) ; } | Update nginx config |
56,637 | public static function updateCrontab ( $ sourceFilename , $ backupDir = null ) { if ( empty ( $ sourceFilename ) ) { throw new \ InvalidArgumentException ( 'Invalid argument $srcFilename, must be not empty' ) ; } if ( ! FileHelper :: fileExists ( $ sourceFilename ) ) { throw new \ RuntimeException ( sprintf ( 'File cro... | Update user crontab |
56,638 | public function deliverMessage ( UserEventInterface $ event , EventQueueInterface $ queue ) { if ( $ event -> getNick ( ) != $ event -> getConnection ( ) -> getNickname ( ) ) { $ messages = $ this -> database -> retrieveMessages ( $ event -> getNick ( ) ) ; foreach ( $ messages as $ row ) { $ message = sprintf ( '(%s) ... | Listen for an user activity and send all stored messages . |
56,639 | public function handleCommand ( CommandEventInterface $ event , EventQueueInterface $ queue ) { $ params = $ event -> getCustomParams ( ) ; if ( count ( $ params ) < 2 ) { $ queue -> ircNotice ( $ event -> getNick ( ) , 'Can\'t identify nickname or message.' ) ; $ this -> helpMessages ( [ $ queue , 'ircNotice' ] , $ ev... | Handles command calls |
56,640 | public function helpCommand ( CommandEventInterface $ event , EventQueueInterface $ queue ) { $ command = strpos ( $ event -> getCustomCommand ( ) , '.help' ) !== false ? substr ( $ event -> getCustomCommand ( ) , 0 , - 5 ) : $ event -> getCustomParams ( ) [ 0 ] ; $ this -> helpMessages ( [ $ queue , 'irc' . $ event ->... | Handles help command calls |
56,641 | private function helpMessages ( callable $ callback , $ target , $ command ) { call_user_func ( $ callback , $ target , 'Usage: ' . $ command . ' <nickname> <message>' ) ; call_user_func ( $ callback , $ target , 'Stores a <message> to be send next time the <nickname> is seen.' ) ; } | Reply with usage help messages |
56,642 | public function start ( ) { $ whoops = new Run ( ) ; $ handler = new PrettyPageHandler ( ) ; $ handler -> addResourcePath ( __DIR__ . '/Resources' ) ; $ handler -> setEditor ( 'sublime' ) ; $ whoops -> pushHandler ( $ handler ) ; $ whoops -> register ( ) ; $ this -> whoops = $ whoops ; } | Register the Whoops! Exception Handler |
56,643 | public function run ( ) { $ this -> runCompilationByArrangedPriority ( ) ; foreach ( $ this -> components as $ name => $ classes ) { $ this -> compileGroupClasses ( $ name , $ classes ) ; } $ original = $ this -> config -> get ( 'compile.files' , [ ] ) ; foreach ( $ original as $ class ) { $ this -> collection [ 'added... | Run compile optimization list . |
56,644 | protected function runCompilationByArrangedPriority ( ) { foreach ( $ this -> arrange as $ name ) { if ( ! isset ( $ this -> components [ $ name ] ) ) { continue ; } $ classes = $ this -> components [ $ name ] ; $ this -> compileGroupClasses ( $ name , $ classes ) ; unset ( $ this -> components [ $ name ] ) ; } } | Compilation should be appended by priority to avoid class redeclared issue . |
56,645 | protected function compileGroupClasses ( $ name , array $ classes ) { $ path = "{$this->path}/{$name}" ; if ( ! $ this -> files -> isDirectory ( $ path ) ) { return ; } foreach ( $ classes as $ class ) { $ file = "{$path}/{$class}.php" ; if ( $ this -> files -> exists ( $ file ) ) { $ this -> collection [ 'added' ] [ ]... | Compile classes by group . |
56,646 | public function addPaths ( $ paths ) { if ( is_string ( $ paths ) ) { $ paths = array ( $ paths ) ; } foreach ( $ paths as $ path ) { $ this -> searchPaths [ ] = $ path ; } } | Adds paths to the default search array . |
56,647 | public static function make ( array $ config = [ ] , $ name = '' ) { if ( ! \ is_array ( $ config ) ) { throw new \ InvalidArgumentException ( 'Logger config is must be an array and not allow empty.' ) ; } $ name = $ name ? : ( $ config [ 'name' ] ?? '' ) ; if ( ! $ name ) { throw new \ InvalidArgumentException ( 'Logg... | create new instance or get exists instance |
56,648 | public static function arrayRemove ( $ arr , $ key , $ default = null ) { if ( isset ( $ arr [ $ key ] ) ) { $ value = $ arr [ $ key ] ; unset ( $ arr [ $ key ] ) ; return $ value ; } return $ default ; } | get value and unset it |
56,649 | public function instance ( $ name = null ) { if ( empty ( $ instance ) ) { throw new Exception ( "A cart name is mandatory." ) ; } $ this -> instance = $ name ; return $ this ; } | Set the current cart instance |
56,650 | public function add ( $ id , $ name = null , $ qty = null , $ price = null , Array $ options = array ( ) ) { if ( Arrays :: is ( $ id ) ) { if ( $ this -> isMulti ( $ id ) ) { foreach ( $ id as $ item ) { $ options = Arrays :: exists ( 'options' , $ item ) ? $ item [ 'options' ] : array ( ) ; $ this -> addRow ( $ item ... | Add a row to the cart |
56,651 | public function update ( $ rowId , $ attribute ) { if ( ! $ this -> hasRowId ( $ rowId ) ) { throw new Exception ( 'This cart does not contain this row.' ) ; } if ( Arrays :: isArray ( $ attribute ) ) { return $ this -> updateAttribute ( $ rowId , $ attribute ) ; } return $ this -> updateQty ( $ rowId , $ attribute ) ;... | Update the quantity of one row of the cart |
56,652 | public function remove ( $ rowId ) { if ( ! $ this -> hasRowId ( $ rowId ) ) { throw new Exception ( 'This cart does not contain this row.' ) ; } $ cart = $ this -> getContent ( ) ; $ cart -> forget ( $ rowId ) ; return $ this -> updateCart ( $ cart ) ; } | Remove a row from the cart |
56,653 | public function get ( $ rowId ) { $ cart = $ this -> getContent ( ) ; $ rows = $ cart -> _fields ; return ( Arrays :: inArray ( $ rowId , $ rows ) ) ? $ cart -> $ rowId : null ; } | Get a row of the cart by its ID |
56,654 | public function content ( ) { $ cart = $ this -> getContent ( ) ; $ rows = $ cart -> _fields ; if ( ! count ( $ rows ) ) { return null ; } $ content = array ( ) ; foreach ( $ rows as $ rowId ) { $ content [ $ rowId ] = $ cart -> $ rowId ; } return $ content ; } | Get the cart content |
56,655 | public function total ( ) { $ total = 0 ; $ cart = $ this -> getContent ( ) ; if ( empty ( $ cart -> _fields ) ) { return $ total ; } foreach ( $ cart -> _fields as $ rowId ) { $ row = $ cart -> $ rowId ; $ total += $ row -> subtotal ; } return $ total ; } | Get the price total |
56,656 | public function count ( $ totalItems = true ) { $ cart = $ this -> getContent ( ) ; if ( false === $ totalItems ) { return count ( $ cart -> _fields ) ; } $ count = 0 ; foreach ( $ cart -> _fields as $ rowId ) { $ row = $ cart -> $ rowId ; $ count += $ row -> qty ; } return $ count ; } | Get the number of items in the cart |
56,657 | public function search ( array $ search ) { $ results = array ( ) ; $ cart = $ this -> getContent ( ) ; $ rows = $ cart -> _fields ; foreach ( $ rows as $ rowId ) { $ item = $ cart -> $ rowId ; $ found = $ item -> search ( $ search ) ; if ( true === $ found ) { $ results [ ] = $ item ; } } return ( empty ( $ results ) ... | Search if the cart has a item |
56,658 | protected function addRow ( $ id , $ name , $ qty , $ price , array $ options = array ( ) ) { if ( empty ( $ id ) || empty ( $ name ) || empty ( $ qty ) || empty ( $ price ) ) { throw new Exception ( 'Some mandatory info are missing' ) ; } if ( ! is_numeric ( $ qty ) ) { throw new Exception ( 'Quantity must be numeric.... | Add row to the cart |
56,659 | protected function hasRowId ( $ rowId ) { $ cart = $ this -> getContent ( ) ; $ rows = $ cart -> _fields ; return Arrays :: in ( $ rowId , $ rows ) ; } | Check if a rowid exists in the current cart instance |
56,660 | protected function updateRow ( $ rowId , $ attributes ) { $ cart = $ this -> getContent ( ) ; $ row = $ cart -> $ rowId ; $ row -> populate ( $ attributes ) ; if ( ! is_null ( array_keys ( $ attributes , array ( 'qty' , 'price' ) ) ) ) { $ row -> put ( 'subtotal' , $ row -> qty * $ row -> price ) ; } $ cart -> put ( $ ... | Update a row if the rowId already exists |
56,661 | protected function createRow ( $ rowId , $ id , $ name , $ qty , $ price , $ options ) { $ cart = $ this -> getContent ( ) ; $ newRow = new Container ( ) ; $ values = array ( 'rowid' => $ rowId , 'id' => $ id , 'name' => $ name , 'qty' => $ qty , 'price' => $ price , 'options' => new Container ( $ options ) , 'subtotal... | Create a new row Object |
56,662 | protected function updateQty ( $ rowId , $ qty ) { if ( 1 > $ qty ) { return $ this -> remove ( $ rowId ) ; } return $ this -> updateRow ( $ rowId , array ( 'qty' => $ qty ) ) ; } | Update the quantity of a row |
56,663 | private function getLength ( string $ string ) : ? int { if ( extension_loaded ( 'mbstring' ) && ! defined ( 'NO_PHP_EXTENSIONS' ) ) { if ( ! mb_check_encoding ( $ string , 'UTF-8' ) ) { return null ; } return mb_strlen ( $ string , 'UTF-8' ) ; } $ charLength = 0 ; $ length = strlen ( $ string ) ; for ( $ i = 0 ; $ i <... | Returns the length of the given string or null if not a valid UTF - 8 string . |
56,664 | protected function checkServerAndAbort ( $ server = null ) { $ server = $ server ? $ server : fp_env ( 'ACACHA_FORGE_SERVER' ) ; if ( ! $ this -> checkServer ( $ server ) ) { $ this -> error ( 'Server ' . $ server . ' not valid' ) ; die ( ) ; } } | Check server and abort . |
56,665 | protected function checkValue ( $ env_var , $ field , $ value = null , $ servers = null ) { $ value = $ value ? $ value : fp_env ( $ env_var ) ; $ servers = $ servers ? $ servers : $ this -> obtainServers ( ) ; return in_array ( $ value , collect ( $ servers ) -> pluck ( $ field ) -> toArray ( ) ) ; } | Check value in servers . |
56,666 | public function render ( ) { if ( ! $ this -> checkAnsiAwareSystem ( ) ) { return $ this -> str ; } if ( $ this -> has_tags ) { return $ this -> tag_format -> parse ( $ this -> str ) ; } elseif ( ! empty ( $ this -> str ) ) { $ this -> output -> useEffect ( $ this -> format ) ; return $ this -> output -> build ( ) ; } ... | Renders the text with color and effet applied . |
56,667 | public static function authorize ( $ code ) { $ config = self :: config ( ) ; if ( ! $ config ) { return false ; } $ url = self :: $ clef_base_url . "authorize" ; $ postdata = http_build_query ( array ( 'code' => $ code , 'app_id' => $ config [ 'app_id' ] , 'app_secret' => $ config [ 'app_secret' ] ) ) ; $ opts = array... | Return authorization from Clef . io for an account |
56,668 | public static function info ( $ access_token ) { $ opts = array ( 'http' => array ( 'method' => 'GET' ) ) ; $ url = self :: $ clef_base_url . "info?access_token=" . $ access_token ; $ context = stream_context_create ( $ opts ) ; $ response = file_get_contents ( $ url , false , $ context ) ; if ( ! $ response ) { $ resp... | Get info about member by access_token |
56,669 | public static function authentication ( $ code = '' ) { if ( empty ( $ code ) ) { return false ; } $ authorize = self :: authorize ( $ code ) ; if ( ! $ authorize ) { return false ; } if ( isset ( $ authorize [ 'error' ] ) ) { return $ authorize ; } return self :: info ( $ authorize [ 'access_token' ] ) ; } | Get authentication of a Clef account |
56,670 | public static function button ( $ url , $ params = array ( ) ) { $ config = self :: config ( ) ; if ( ! $ config ) { return null ; } $ color = ( isset ( $ params [ 'color' ] ) && $ params [ 'color' ] == "white" ) ? "white" : "blue" ; $ style = ( isset ( $ params [ 'style' ] ) && $ params [ 'style' ] == "button" ) ? "bu... | Display button for Login |
56,671 | public static function customButton ( $ title , $ url , $ attributes = array ( ) ) { $ config = self :: config ( ) ; if ( ! $ config ) { return null ; } $ attributes = Helpers :: addClass ( $ attributes , "clef" ) ; return '<a href="https://clef.io/iframes/qr?app_id=' . $ config [ 'app_id' ] . '&redirect_url=' . $ ... | Display custom button for Login |
56,672 | private function makeMigration ( $ option ) { if ( $ option ) { $ table = Str :: plural ( Str :: snake ( class_basename ( $ this -> argument ( 'name' ) ) ) ) ; $ this -> call ( 'make:migration' , [ 'name' => "create_{$table}_table" , '--create' => $ table ] ) ; } } | Create migration file if not null |
56,673 | private function makeResourceController ( $ option ) { if ( $ option ) { $ controllerName = Str :: studly ( class_basename ( $ this -> argument ( 'name' ) ) ) ; $ controllerNameFile = $ controllerName . 'Controller.php' ; try { $ controllerPath = __DIR__ . '/controller.stub' ; $ controllerAppPath = app_path ( 'Http/Con... | Create resource controller if not null |
56,674 | private function createObjectFiles ( $ name , $ newObject , $ newContract , $ newConcrete ) { try { $ objectPath = __DIR__ . '/object.stub' ; $ objectAppPath = app_path ( 'Models/Objects/' . $ newObject ) ; $ this -> helper -> replaceAndSave ( $ objectPath , '{{name}}' , $ name , $ objectAppPath ) ; } catch ( \ Excepti... | Create oject repository files |
56,675 | private function makeBindings ( $ newContract , $ newConcrete ) { $ appBindContract = substr ( 'App\Models\Contracts\Repositories\\' . $ newContract , 0 , - 4 ) ; $ appBindConcrete = substr ( 'App\Models\Concrete\Eloquent\\' . $ newConcrete , 0 , - 4 ) ; $ bindImplementation = "public function register() { \$... | Make the necessary bindings for the repository |
56,676 | public function run ( $ handler , $ data = null , array $ options = [ ] ) { $ this -> _handler = Handlers :: get ( $ handler ) ; $ this -> _data = $ data === null ? $ this -> _data : $ data ; $ options += $ this -> _handler -> options ( ) + [ 'queue' => 'default' , 'priority' => static :: PRIORITY_NORMAL , 'wait' => fa... | Enqueues a job . |
56,677 | public function accionarEvento ( $ nombre ) { if ( isset ( $ this -> eventos [ $ nombre ] ) ) { $ argumentos = func_get_args ( ) ; array_shift ( $ argumentos ) ; if ( count ( $ this -> eventos [ $ nombre ] ) > 1 ) { $ resultado = [ ] ; foreach ( $ this -> eventos [ $ nombre ] as $ definicion ) { $ resultado [ ] = call_... | Dispara un evento pasando argumentos de forma opcional . |
56,678 | private function setCustomizersPosition ( ) { if ( ! preg_match ( '/^\s*return[\n\s]+(?:\[|array[\s\n]*\()/ims' , $ this -> contents , $ m ) ) { throw new Exception ( 'Failed to determine the start of the return array' ) ; } $ this -> customizersPosition = strpos ( $ this -> contents , $ m [ 0 ] ) ; } | Set the position inside the read content where we can add custom code . |
56,679 | public function authenticate ( TokenInterface $ token = null ) { $ token = $ token ? : $ this -> authenticator -> present ( ) ; if ( ! $ token instanceof TokenInterface ) { return new Result ( Result :: FAILURE_NO_TOKEN ) ; } $ result = new Result ( ) ; try { $ token = $ this -> authenticator -> authenticate ( $ token ... | Authenticate a token or ask providers to provide a token to authenticate |
56,680 | public function isGranted ( $ attributes , $ object = null ) { if ( ! is_array ( $ attributes ) ) { $ attributes = [ $ attributes ] ; } return $ this -> authorizationManager -> decide ( $ this -> getToken ( ) , $ attributes , $ object ) ; } | Check if the current token is granted permissions . |
56,681 | public function initialize ( ) { if ( ! isset ( $ this -> authenticator ) ) { throw new \ RuntimeException ( 'Aegis is missing an authentication authenticator.' ) ; } if ( ! isset ( $ this -> storage ) ) { throw new \ RuntimeException ( 'Aegis is missing a persistent storage engine.' ) ; } $ this -> setToken ( new Anon... | Initialize Aegis . |
56,682 | public function SetServiceName ( $ sServiceName ) { $ bRet = false ; if ( CLib :: IsExistingString ( $ sServiceName ) ) { $ bRet = true ; $ this -> m_sServiceName = $ sServiceName ; } return $ bRet ; } | set service name and url |
56,683 | public function GetResponseVData ( $ arrResponse ) { if ( CLib :: IsArrayWithKeys ( $ arrResponse , 'vdata' ) || CLib :: IsObjectWithProperties ( $ arrResponse , 'vdata' ) ) { return $ arrResponse [ 'vdata' ] ; } else { return null ; } } | get error id from response VData array |
56,684 | public function GetVDataArray ( $ nErrorId , $ sErrorDesc = '' , $ arrVData = [ ] , $ sVersion = '1.0' , $ bCached = null , $ arrExtra = [ ] ) { $ arrHeader = [ ] ; $ arrRet = [ ] ; if ( is_numeric ( $ nErrorId ) ) { $ nErrorId = intval ( $ nErrorId ) ; $ sErrorDesc = ( ( is_string ( $ sErrorDesc ) || is_numeric ( $ sE... | get json in virtual data format |
56,685 | public function GetVDataString ( $ nErrorId , $ sErrorDesc = '' , $ arrVData = [ ] , $ sVersion = '1.0' , $ bCached = null , $ arrExtra = [ ] ) { $ sRet = '' ; $ arrJson = $ this -> GetVDataArray ( $ nErrorId , $ sErrorDesc , $ arrVData , $ sVersion , $ bCached , $ arrExtra ) ; if ( $ this -> IsValidVData ( $ arrJson )... | get json encoded string in virtual data format |
56,686 | public function GetVDataResponse ( $ nErrorId , $ sErrorDesc = '' , $ arrVData = [ ] , $ sVersion = self :: SERVICE_DEFAULT_VERSION , $ bCached = null , $ arrExtra = [ ] , $ nHttpStatus = Response :: HTTP_OK ) { $ cResponse = new Response ( ) ; $ sContentJson = '' ; $ sContentType = '' ; if ( ! is_numeric ( $ nHttpStat... | get response object instance contains json encoded string in virtual data format |
56,687 | public function IsValidVData ( $ arrJson ) { return ( is_array ( $ arrJson ) && array_key_exists ( 'errorid' , $ arrJson ) && array_key_exists ( 'errordesc' , $ arrJson ) && array_key_exists ( 'vdata' , $ arrJson ) && is_numeric ( $ arrJson [ 'errorid' ] ) && is_string ( $ arrJson [ 'errordesc' ] ) && is_array ( $ arrJ... | if the variable being evaluated is a valid json in virtual data format ? |
56,688 | public function IsReservedKey ( $ sKey ) { $ bRet = false ; if ( CLib :: IsExistingString ( $ sKey , true ) ) { $ sKey = strtolower ( trim ( $ sKey ) ) ; $ bRet = in_array ( $ sKey , self :: ARR_RESERVED_KEYS ) ; } return $ bRet ; } | if the variable being evaluated is the reserved key |
56,689 | public function GetContentTypeWithVersion ( $ sVersion ) { return sprintf ( "%s%s" , CConst :: HTTP_HEADER_VERSION_CONTENT_TYPE , ( is_string ( $ sVersion ) && strlen ( $ sVersion ) > 0 ) ? $ sVersion : self :: SERVICE_DEFAULT_VERSION ) ; } | get content type of HTTP header |
56,690 | public function authorize ( Application $ app ) { $ server = $ this -> getAuthorizationServer ( $ app ) ; $ grant = $ server -> getGrantType ( 'password' ) ; try { $ result = $ grant -> completeFlow ( ) ; return new JsonResponse ( $ result ) ; } catch ( OAuthException $ e ) { return new JsonResponse ( [ 'error' => $ e ... | For password grant type |
56,691 | public function create ( $ url ) { if ( ! preg_match ( '!^\w+://! i' , $ url ) ) { $ url = url ( $ url ) ; } $ this -> url = $ url ; $ this -> session = curl_init ( $ this -> url ) ; return $ this ; } | Start a session from a URL |
56,692 | public function upload ( UploadedFile $ file ) { self :: $ generic_file -> moveUploadedFile ( new File ( $ file , $ file -> getClientOriginalName ( ) ) , null , $ this ) ; return $ this ; } | Store uploaded file by configured path pattern and fill data to this model . |
56,693 | public function delete ( ) { if ( self :: $ generic_file -> canRemoveFiles ( ) ) { $ file_usage_count = 0 ; if ( method_exists ( $ this , 'getFileUsageCount' ) ) { $ file_usage_count = $ this -> getFileUsageCount ( $ this ) ; } if ( $ file_usage_count <= 1 ) { self :: $ generic_file -> delete ( $ this ) ; } } return pa... | Delete file if not use in other models . |
56,694 | private function parseTokens ( ) { $ this -> tokens = $ this -> tokenStore -> getTokens ( $ this -> tokenMask ) ; $ this -> keys = array_keys ( $ this -> tokens ) ; $ this -> keyLengths = array_unique ( array_map ( 'strlen' , $ this -> keys ) ) ; arsort ( $ this -> keyLengths ) ; $ this -> maxLen = reset ( $ this -> ke... | Parse the current set ok tokens and cache some metadata about them for speed |
56,695 | public function loadConfig ( $ parsedConfig ) { $ this -> _footerController = $ parsedConfig [ 'moduleConf' ] [ 'automatic_controller_footer' ] ; $ this -> _footerGlobal = $ parsedConfig [ 'moduleConf' ] [ 'automatic_global_footer' ] ; $ this -> _headerController = $ parsedConfig [ 'moduleConf' ] [ 'automatic_controlle... | Initializes the module with defined configuration |
56,696 | public function doBeforeView ( $ context = null ) { if ( $ this -> _headerController ) { $ viewPath = ROOT . DS . 'app' . DS . 'views' . DS . strtolower ( $ this -> _controller -> getControllerName ( ) ) . DS . strtolower ( $ this -> _controller -> getAction ( ) ) . DS . 'header.php' ; if ( file_exists ( $ viewPath ) )... | Adds the header as the first view to be rendered . The controller based - header has always the precedence on the global header |
56,697 | public function doAfter ( ) { if ( $ this -> _footerController ) { $ viewPath = ROOT . DS . 'app' . DS . 'views' . DS . strtolower ( $ this -> _controller -> getControllerName ( ) ) . DS . strtolower ( $ this -> _controller -> getAction ( ) ) . DS . 'footer.php' ; if ( file_exists ( $ viewPath ) ) { $ this -> _controll... | Executes actions after the views are rendered |
56,698 | public function staticRoleTitle ( $ roleKey ) { $ role = $ this -> roleCollection -> getRoleByKey ( $ roleKey ) ; return null !== $ role ? $ role -> getTitle ( ) : null ; } | Returns the static role name |
56,699 | public static function getAll ( ) : array { return [ self :: GET , self :: HEAD , self :: POST , self :: PUT , self :: DELETE , self :: CONNECT , self :: OPTIONS , self :: TRACE , self :: PATCH , ] ; } | Returns list of all valid HTTP request methods . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.