idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
12,900 | public function updateViewCounter ( ) { $ userId = Yii :: $ app -> user -> id ; $ viewCount = $ this -> viewCount ; if ( ! empty ( $ viewCount ) ) { $ viewCount -> updateCounters ( [ 'count' => 1 ] ) ; } else { $ viewCount = new ArticleViewCount ( ) ; $ viewCount -> article_id = $ this -> id ; $ viewCount -> viewer_id ... | Updates views counter . |
12,901 | public static function getDurations ( int $ precision = - 1 ) : array { $ ret = [ ] ; foreach ( self :: $ timers as $ t ) { Arr :: addValue ( $ ret , $ t -> getName ( ) , $ t -> getDuration ( $ precision ) ) ; } return $ ret ; } | Get all durations for named timers |
12,902 | public function stop ( int $ precision = - 1 ) { $ time = microtime ( true ) ; if ( $ this -> stopTime === null ) { $ this -> stopTime = $ time ; $ this -> duration = $ this -> stopTime - $ this -> startTime ; } return $ this -> fmtDuration ( $ this -> duration , $ precision ) ; } | Stop the timer and calculate the duration |
12,903 | public function getDuration ( int $ precision = - 1 ) { $ duration = $ this -> duration ?? microtime ( true ) - $ this -> startTime ; return $ this -> fmtDuration ( $ duration , $ precision ) ; } | Get the current duration |
12,904 | public static function sendErrorsToAdmin ( ) { $ found = false ; foreach ( \ Object \ Error \ Base :: $ errors as $ k => $ v ) { if ( $ v [ 'errno' ] != - 1 ) { $ found = true ; break ; } } if ( $ found || ! empty ( self :: $ data [ 'js' ] ) ) { $ message = '<hr/>' ; $ message .= '<br/>IP: ' . \ Request :: ip ( ) ; $ m... | Send errors to administrator |
12,905 | public function CreateElement ( $ pw ) { PhpWsdl :: Debug ( 'Create WSDL definition for element ' . $ this -> Name ) ; $ res = '<s:element minOccurs="' . $ this -> MinOccurs . '" maxOccurs="' . $ this -> MaxOccurs . '" nillable="' . ( ( $ this -> NillAble ) ? 'true' : 'false' ) . '" name="' . $ this -> Name . '" type="... | Create the WSDL |
12,906 | public static function InterpretElement ( $ data ) { $ info = explode ( ' ' , $ data [ 'keyword' ] [ 1 ] , 3 ) ; if ( sizeof ( $ info ) < 2 ) return true ; $ name = substr ( $ info [ 1 ] , 1 ) ; if ( substr ( $ name , strlen ( $ name ) - 1 , 1 ) == ';' ) $ name = substr ( $ name , 0 , strlen ( $ name ) - 1 ) ; PhpWsdl ... | Interpret a element keyword |
12,907 | public function reload ( $ onlyTaskWorker = false ) : int { if ( ! $ masterPid = $ this -> getPidFromFile ( true ) ) { return Show :: error ( "The swoole server({$this->name}) is not running." , true ) ; } $ sig = SIGUSR1 ; if ( $ onlyTaskWorker ) { $ sig = SIGUSR2 ; Show :: notice ( 'Will only reload task worker' ) ; ... | do Reload Workers |
12,908 | public function restart ( $ daemon = null ) : void { if ( $ this -> getPidFromFile ( true ) ) { $ this -> stop ( false ) ; } $ this -> start ( $ daemon ) ; } | Do restart server |
12,909 | public function stop ( $ quit = true ) : int { if ( ! $ masterPid = $ this -> getPidFromFile ( true ) ) { return Show :: error ( "The swoole server({$this->name}) is not running." ) ; } ProcessUtil :: killAndWait ( $ masterPid , $ error = null , $ this -> name ) ; if ( $ error ) { return Show :: error ( $ error ) ; } S... | Do stop swoole server |
12,910 | public function jqueryAjaxLink ( $ name , $ url , $ options = array ( ) , $ htmlOptions = array ( ) ) { return $ this -> jqueryHelper -> jQueryLinkToRemote ( $ name , $ url , $ options , $ htmlOptions ) ; } | Returns a link to a remote action defined by url |
12,911 | public function newPaymentAction ( Request $ request ) { $ context = $ this -> loadContext ( $ request ) ; $ order = $ context -> getResource ( ) ; $ this -> isGranted ( 'EDIT' , $ order ) ; $ redirectPath = $ this -> generateResourcePath ( $ order ) ; $ amount = $ this -> get ( 'ekyna_order.order.calculator' ) -> calc... | New payment action . |
12,912 | public function removePaymentAction ( Request $ request ) { $ context = $ this -> loadContext ( $ request ) ; $ order = $ context -> getResource ( ) ; $ this -> isGranted ( 'EDIT' , $ order ) ; if ( null === $ payment = $ order -> findPaymentById ( $ request -> attributes -> get ( 'paymentId' ) ) ) { throw new NotFound... | Remove payment action . |
12,913 | private function createRemovePaymentForm ( $ action , $ cancelPath ) { return $ this -> createFormBuilder ( null , [ 'action' => $ action , 'attr' => [ 'class' => 'form-horizontal' , ] , 'method' => 'POST' , 'admin_mode' => true , '_redirect_enabled' => true , ] ) -> add ( 'confirm' , 'checkbox' , [ 'label' => 'ekyna_o... | Creates the remove payment form . |
12,914 | public function transitionPaymentAction ( Request $ request ) { $ context = $ this -> loadContext ( $ request ) ; $ resourceName = $ this -> config -> getResourceName ( ) ; $ order = $ context -> getResource ( $ resourceName ) ; $ this -> isGranted ( 'EDIT' , $ order ) ; $ payment = null ; $ paymentId = intval ( $ requ... | Transition payment action . |
12,915 | public static function Initialize ( ) { self :: $ plugin_loader = new Plugins \ Loader ( ) ; if ( self :: ValidExtension ( ) ) { self :: $ plugin_loader -> Start ( self :: GetCwd ( ) . "/plugins" ) ; if ( file_exists ( self :: GetCwd ( ) . "/peg.conf" ) ) { Settings :: SetBackEnd ( new Config \ INI ) ; Settings :: Load... | Initialize all variables used by Peg . Has to be called before any usage of peg . |
12,916 | public static function ValidExtension ( ) { $ dir = self :: GetCwd ( ) ; if ( is_dir ( $ dir . "/templates" ) && ( file_exists ( $ dir . "/peg.conf" ) || file_exists ( $ dir . "/peg.json" ) ) ) { return true ; } return false ; } | Check if the current directory is of a valid extension . |
12,917 | public static function & GetDefinitions ( ) { if ( ! self :: ValidExtension ( ) ) { CommandLine \ Error :: Show ( t ( "Invalid extension directory, definitions could not be loaded." ) ) ; } if ( ! is_object ( self :: $ symbols ) ) { self :: $ symbols = new Definitions \ Symbols ; $ importer = new Definitions \ Importer... | Loads definitions files if not yet loaded and returns a reference to a symbols object that can be used throught the application . |
12,918 | public function index ( ) { $ pageTitle = __d ( 'cake_search_info' , 'Search information' ) ; $ breadCrumbs = $ this -> Search -> getBreadcrumbInfo ( ) ; $ breadCrumbs [ ] = __d ( 'cake_search_info' , 'New search' ) ; $ this -> set ( compact ( 'pageTitle' , 'breadCrumbs' ) ) ; $ this -> set ( 'search_urlActionSearch' ,... | Action index . Used to begin search . |
12,919 | public function search ( ) { $ this -> SearchFilter -> search ( ) ; $ pageTitle = __d ( 'cake_search_info' , 'Search information' ) ; $ breadCrumbs = $ this -> Search -> getBreadcrumbInfo ( ) ; $ breadCrumbs [ ] = __d ( 'cake_search_info' , 'Results of search' ) ; $ this -> set ( compact ( 'pageTitle' , 'breadCrumbs' )... | Action search . Used to view a result of search . |
12,920 | public function render ( $ view , array $ parameters = array ( ) , $ flag = false ) { $ content = $ this -> get ( 'kernel.dispatch' ) -> dispatch ( 'handle.tpl' ) -> render ( $ view , $ parameters ) ; return $ flag ? $ content : $ this -> responseHtml ( $ content ) ; } | Render template to html or return content . |
12,921 | public function initStatusFromResponse ( ) { if ( $ this -> serverRawResponse -> isSuccess ( ) ) { $ this -> status = true ; } else { $ this -> status = false ; } } | Inits the status field from the response |
12,922 | protected function getTagData ( $ tags , $ byIntersect = false ) { if ( is_array ( $ tags ) ) { $ tagsData = $ this -> getTagHolderBackend ( ) -> getMany ( $ tags ) ; if ( empty ( $ tagsData ) ) { return ; } if ( $ byIntersect ) { $ tagData = call_user_func_array ( 'array_intersect' , $ tagsData ) ; if ( empty ( $ tagD... | Get the tag s data by a tag s names |
12,923 | public function getTagHolderBackend ( ) { if ( $ this -> tagsBackend === null ) { $ this -> tagsBackend = $ this -> getBackend ( ) ; } return $ this -> tagsBackend ; } | Get the tags holding backend |
12,924 | public static function compare ( $ date1 , $ date2 , $ type = 'date' ) { if ( $ type == 'date' ) { return date ( 'Y-m-d' , strtotime ( $ date1 ) ) === date ( 'Y-m-d' , strtotime ( $ date2 ) ) ; } else if ( $ type == 'datetime' || $ type == 'time' ) { return date ( 'Y-m-d H:i:s' , strtotime ( $ date1 ) ) === date ( 'Y-m... | Compare two dates |
12,925 | public static function diff ( $ date1 , $ date2 , $ type = 'days' , $ round = true ) { $ result = strtotime ( $ date2 ) - strtotime ( $ date1 ) ; switch ( $ type ) { case 'days' : $ result = $ result / 86400 ; break ; case 'abs days' : $ result = abs ( $ result / 86400 ) ; break ; case 'seconds' : return $ result ; bre... | Compute difference between two dates |
12,926 | public static function extractMinutes ( \ DateTime $ datetime ) : int { return ( ( ( int ) $ datetime -> format ( 'H' ) ) * 60 ) + ( ( int ) $ datetime -> format ( 'i' ) ) ; } | Extract minutes from datetime object |
12,927 | public static function add ( $ option , $ value , $ deprecated = '' , $ autoload = 'yes' ) { add_option ( $ option , $ value , $ deprecated , $ autoload ) ; } | Force add a value into options |
12,928 | public static function get ( $ option , $ default = '' , $ item = '' ) { $ value = get_option ( $ option ) ; $ value = false === $ value ? $ default : $ value ; $ value = apply_filters ( 'ol_zeus_option_get_' . $ option , $ value ) ; return is_array ( $ value ) && isset ( $ value [ $ item ] ) ? $ value [ $ item ] : $ v... | Return a value from options |
12,929 | public static function set ( $ option , $ value , $ type = '' , $ id = 0 ) { $ value = apply_filters ( 'ol_zeus_option_set_' . $ option , $ value ) ; if ( ! empty ( $ id ) ) { $ func = 'term' === $ type ? 'updateTermMeta' : 'updatePostMeta' ; self :: $ func ( $ id , $ option , $ value ) ; } else if ( false === get_opti... | Set a value into options |
12,930 | public static function cleanValue ( $ value ) { if ( is_array ( $ value ) ) { $ new_value = [ ] ; foreach ( $ value as $ k => $ v ) { $ new_value [ $ k ] = self :: cleanValue ( $ v ) ; } return $ new_value ; } return stripslashes ( $ value ) ; } | Clean details on value |
12,931 | public static function getValue ( $ id , $ details , $ default ) { $ sep = '-' ; if ( empty ( $ id ) || null === $ id ) { return null ; } $ post = isset ( $ details [ 'post' ] ) ? $ details [ 'post' ] : 0 ; if ( ! empty ( $ post ) ) { $ value = self :: getPostMeta ( $ post -> ID , $ post -> post_type . $ sep . $ id ) ;... | Retrieve field value |
12,932 | public static function getTermMeta ( $ term_id , $ option , $ default = '' ) { if ( function_exists ( 'get_term_meta' ) ) { $ value = get_term_meta ( $ term_id , $ option , true ) ; } else { $ value = self :: get ( $ option , $ default ) ; } return $ value ; } | Get a value from term options |
12,933 | public function save ( User $ user ) { if ( $ user -> getId ( ) != null ) { return $ this -> update ( $ user ) ; } return $ this -> create ( $ user ) ; } | Create or update user |
12,934 | public function findAllKYC ( $ appUserId ) { $ url = sprintf ( 'users/%s/kyc/' , $ appUserId ) ; return $ this -> getAll ( $ url , $ this -> KYCEntityClassName ) ; } | Get user KYC demands |
12,935 | public function findKYCById ( $ appUserId , $ id ) { $ url = sprintf ( 'users/%s/kyc/%s' , $ appUserId , $ id ) ; return $ this -> getOne ( $ url , $ this -> KYCEntityClassName ) ; } | Get user KYC demand by id |
12,936 | public function createKYC ( $ appUserId , KYC $ kyc ) { $ url = sprintf ( 'users/%s/kyc/' , $ appUserId ) ; $ headers = [ 'Accept' => sprintf ( 'application/vnd.s-money.v%s+%s' , $ this -> getApiVersion ( ) , $ this -> getOutputFormat ( ) ) , 'Content-Type' => 'multipart/form-data' , ] ; $ body = [ ] ; $ count = 0 ; fo... | Create new KYC demand |
12,937 | public function hasConfig ( ) { if ( $ this -> _configSupplied !== null ) { return true ; } if ( $ this instanceof LocatorAwareInterface && $ this -> hasLocator ( ) && $ this -> getLocator ( ) -> has ( $ this -> getConfigServiceId ( ) ) ) { return true ; } return false ; } | Has a config |
12,938 | public function getConfigsFactory ( ) { if ( $ this -> _configsFactory === null ) { if ( $ this instanceof LocatorAwareInterface && $ this -> hasLocator ( ) ) { $ this -> _configsFactory = $ this -> getLocator ( ) -> get ( 'configsFactory' ) ; if ( ! $ this -> _configsFactory instanceof FactoryInterface ) { throw new N... | Get a configs factory |
12,939 | public function hasConfigsFactory ( ) { if ( $ this -> _configsFactory !== null ) { return true ; } if ( $ this instanceof LocatorAwareInterface && $ this -> hasLocator ( ) && $ this -> getLocator ( ) -> has ( 'configsFactory' ) ) { return true ; } return false ; } | Has a configs factory |
12,940 | public static function checkFileName ( $ file ) { return strpos ( $ file , '/' ) === false && strpos ( $ file , '\\' ) === false && strpos ( $ file , '..' ) === false ; } | Check that name of file or folder is allowed for file system and no odd symbols in it |
12,941 | public static function remdir ( $ path , $ leave_folder = false ) { if ( ! is_dir ( $ path ) ) { return false ; } $ slash = substr ( $ path , - 1 ) ; if ( $ slash != '/' && $ slash != '\\' ) { $ path .= '/' ; } foreach ( array_diff ( scandir ( $ path ) , [ '.' , '..' ] ) as $ v ) { if ( is_dir ( $ path . $ v ) ) { self... | Remove folder recursively with all content from file system |
12,942 | public static function copyRecursive ( $ source , $ destination ) { if ( is_dir ( $ source ) ) { $ dir_handle = opendir ( $ source ) ; while ( $ file = readdir ( $ dir_handle ) ) { if ( $ file != "." && $ file != ".." ) { self :: mkDir ( $ destination ) ; if ( is_dir ( $ source . "/" . $ file ) ) { if ( ! is_dir ( $ de... | Copy folder content to another directory |
12,943 | public static function scanDirs ( $ path , $ onlyLevel = false , $ lvl = 0 ) { static $ res ; if ( $ lvl == 0 ) { $ res = [ ] ; } if ( ! is_dir ( $ path ) ) { return [ ] ; } if ( substr ( $ path , - 1 ) == '/' ) { $ path = substr ( $ path , 0 , - 1 ) ; } $ dir_base_length = strlen ( DIR_BASE ) - 1 ; foreach ( array_dif... | Returns the directory and its content data recursively |
12,944 | public static function streamOutput ( $ filename , $ res , $ mimetype = 'application/octet-stream' ) { ob_clean ( ) ; header ( 'HTTP/1.1 200 OK' ) ; header ( 'Content-Length: ' . strlen ( $ res ) ) ; header ( 'Content-Type: ' . $ mimetype ) ; header ( 'Expires: ' . gmdate ( 'D, d M Y H:i:s' ) . ' GMT' ) ; header ( 'Con... | Make file downloadable in browser |
12,945 | public static function downloadDataAsCsvFile ( $ data ) { ob_clean ( ) ; header ( "Content-Type: text/csv" ) ; header ( "Content-Disposition: attachment; filename=file.csv" ) ; header ( "Cache-Control: no-cache, no-store, must-revalidate" ) ; header ( "Pragma: no-cache" ) ; header ( "Expires: 0" ) ; $ output = fopen ( ... | Download selected array of data as one export file with headers |
12,946 | public static function getDataURI ( $ image , $ mime = '' ) { return 'data: ' . ( function_exists ( 'mime_content_type' ) ? mime_content_type ( $ image ) : $ mime ) . ';base64,' . base64_encode ( file_get_contents ( $ image ) ) ; } | Generate base64 representation of image |
12,947 | public function jQueryLinkToRemote ( $ name , $ url , $ options = array ( ) , $ htmlOptions = array ( ) ) { $ htmlOptions [ 'href' ] = isset ( $ htmlOptions [ 'href' ] ) ? $ htmlOptions [ 'href' ] : '#' ; $ htmlOptions [ 'onclick' ] = $ this -> jQueryRemoteFunction ( $ url , $ options ) . '; return false;' ; return $ t... | Returns a link to remote action defined by url |
12,948 | function showInput ( $ fill ) { $ nextStep = $ this -> encodeURL ( 'makeSelection' ) ; $ addHref = htmlentities ( $ this -> element -> encodeURL ( array ( ) , 'showCreate' , array ( '' , $ this -> element -> encodeURL ( array ( ) , 'processCreate' , array ( $ nextStep ) ) ) ) ) ; return ' <span class="SimplO... | function input - this function displies the HTML to list and add new values into parent element . |
12,949 | public function showInputView ( ) { $ template = $ this -> parent -> templateFilePath ( 'View' ) ; if ( ! file_exists ( $ template ) ) { $ this -> parent -> showView ( ) ; } if ( $ this -> element -> getId ( ) ) { $ nextStep = $ this -> encodeURL ( 'makeSelection' , array ( $ this -> element -> getId ( ) ) ) ; $ href =... | function showInputView - this function works after function showInput after have listed or added new values you can edit them or delete them without modify the original values and put the HTML to do it . |
12,950 | function nestingLevelFix ( & $ dom ) { $ startingNestingLevel = $ this -> parent -> nestingLevel ( ) ; foreach ( $ dom [ '.SimplOn.Element, .SimplOn.Data' ] as $ node ) { $ domNode = pq ( $ node ) ; $ classes = explode ( ' ' , $ domNode -> attr ( 'class' ) ) ; if ( substr ( $ classes [ 2 ] , 0 , 4 ) == 'SNL-' ) { $ nes... | function nestingLevelFix - this function update the nesting level of the elements every time that a new element is added . |
12,951 | function makeSelection ( $ id ) { $ this -> element -> fillFromDSById ( $ id ) ; $ return = array ( 'status' => true , 'type' => 'commands' , 'data' => array ( array ( 'func' => 'changeValue' , 'args' => array ( $ this -> element -> getId ( ) ) ) , array ( 'func' => 'changePreview' , 'args' => array ( $ this -> showInp... | function makeSelection - this function pass the arguments to javascript file to display the light box . |
12,952 | protected function get ( string $ name , callable $ callback ) { if ( isset ( $ this -> cache [ $ name ] ) ) { return $ this -> cache [ $ name ] ; } return $ this -> cache [ $ name ] = call_user_func ( $ callback , $ name ) ; } | Retrieve a value that should not be created more than once |
12,953 | protected function reset ( string $ name , callable $ callback = null ) { if ( ! isset ( $ this -> cache [ $ name ] ) ) { return ; } if ( $ callback !== null ) { call_user_func ( $ callback , $ name , $ this -> cache [ $ name ] ) ; } unset ( $ this -> cache [ $ name ] ) ; } | Gracefully remove a value from the cache map |
12,954 | public static function getRouteUrl ( string $ route ) { $ host = env ( 'API_HOST' ) ?? 'api.ethicaljobs.com.au' ; $ scheme = env ( 'API_SCHEME' ) ?? 'https' ; return $ scheme . '://' . $ host . self :: sanitizeRoute ( $ route ) ; } | Returns full URL for a request route |
12,955 | protected function cleanup ( ) : void { $ this -> output -> writeln ( '' ) ; $ this -> output -> write ( 'Cleaning up... ' ) ; $ this -> output -> writeln ( '' ) ; $ this -> output -> writeln ( '' ) ; $ projectDir = $ this -> getContainer ( ) -> getParameter ( 'kernel.project_dir' ) ; try { $ fileSystem = $ this -> get... | Cleans up various leftover files . |
12,956 | protected function addMessage ( $ message ) { $ hash = crc32 ( json_encode ( func_get_args ( ) ) ) ; if ( isset ( $ this -> _messages [ $ hash ] ) ) { return ; } if ( func_num_args ( ) > 1 ) { $ this -> _messages [ $ hash ] = call_user_func_array ( 'sprintf' , func_get_args ( ) ) ; } else { $ this -> _messages [ $ hash... | Add a message about the validation fail |
12,957 | public function authenticate ( ) { $ email = Input :: get ( 'email' ) ; $ password = Input :: get ( 'password' ) ; $ returnURL = Input :: get ( 'returnURL' ) ; if ( Auth :: attempt ( [ 'email' => $ email , 'password' => $ password ] ) ) { return redirect ( $ returnURL ) ; } } | Handle an authentication attempt . |
12,958 | public static function validateXsdFromString ( $ xml ) { $ xmlDocument = new \ DOMDocument ( ) ; $ xmlDocument -> loadXML ( $ xml ) ; return $ xmlDocument -> schemaValidate ( __DIR__ . '/Resources/junit-4.xsd' ) ; } | Validate an XML string with JUnit XSD . |
12,959 | public function registerViewComposers ( ) : void { view ( ) -> composer ( 'admin.module.rating::back.partials.analytics.statistic' , function ( $ view ) { $ ratings = RatingModel :: select ( [ 'rating' , DB :: raw ( 'count(*) as total' ) ] ) -> groupBy ( 'rating' ) -> get ( ) ; $ view -> with ( 'ratings' , $ ratings ) ... | Register Comments s view composers . |
12,960 | protected function validateAttribute ( string $ attribute = NULL ) : bool { if ( ! property_exists ( $ this , $ attribute ) ) { $ this -> error = "Attribute: " . ucfirst ( $ attribute ) . " is not a class object." ; return FALSE ; } $ result = ( is_array ( $ this -> $ attribute ) ) ? ! empty ( $ this -> $ attribute ) :... | Validates the specified attribute |
12,961 | protected function processLogFile ( ) { $ this -> logFile = ( empty ( $ this -> logFile ) ) ? $ this -> logDir . strtolower ( $ this -> level ) . "Log.txt" : $ this -> logDir . $ this -> logFile ; return $ this ; } | Processes log file . |
12,962 | public function readFile ( string $ logFile = NULL , array $ keys = [ ] , string $ order = "desc" , string $ delimeter = "|" ) { $ this -> readResult = [ ] ; $ this -> logFile = $ logFile ; $ this -> keys = $ keys ; $ this -> delimeter = $ delimeter ; if ( $ this -> validateAttribute ( "logFile" ) == FALSE ) return $ t... | Read log file and return this |
12,963 | public function findWhere ( string $ column = NULL , ... $ values ) { if ( empty ( $ this -> filteredResult ) ) return $ this ; $ newReadResult = filterObject ( $ this -> filteredResult , $ column , ... $ values ) ; $ this -> filteredResult = $ newReadResult ; $ this -> result = $ newReadResult ; return $ this ; } | Find where a column is equal to a value |
12,964 | public function clear ( ) { if ( ! self :: $ session ) { Exception :: i ( ) -> setMessage ( self :: ERROR_NOT_STARTED ) -> trigger ( ) ; } $ _SESSION = array ( ) ; return $ this ; } | Removes all session data |
12,965 | public function current ( ) { if ( ! self :: $ session ) { Exception :: i ( ) -> setMessage ( self :: ERROR_NOT_STARTED ) -> trigger ( ) ; } return current ( $ _SESSION ) ; } | Returns the current item For Iterator interface |
12,966 | public function key ( ) { if ( ! self :: $ session ) { Exception :: i ( ) -> setMessage ( self :: ERROR_NOT_STARTED ) -> trigger ( ) ; } return key ( $ _SESSION ) ; } | Returns th current position For Iterator interface |
12,967 | public function next ( ) { if ( ! self :: $ session ) { Exception :: i ( ) -> setMessage ( self :: ERROR_NOT_STARTED ) -> trigger ( ) ; } next ( $ _SESSION ) ; } | Increases the position For Iterator interface |
12,968 | public function offsetExists ( $ offset ) { Argument :: i ( ) -> test ( 1 , 'scalar' , 'null' , 'bool' ) ; if ( ! self :: $ session ) { Exception :: i ( ) -> setMessage ( self :: ERROR_NOT_STARTED ) -> trigger ( ) ; } return isset ( $ _SESSION [ $ offset ] ) ; } | isset using the ArrayAccess interface |
12,969 | public function remove ( $ name ) { Argument :: i ( ) -> test ( 1 , 'string' ) ; if ( isset ( $ _SESSION [ $ name ] ) ) { unset ( $ _SESSION [ $ name ] ) ; } return $ this ; } | Removes a session . |
12,970 | public function rewind ( ) { if ( ! self :: $ session ) { Exception :: i ( ) -> setMessage ( self :: ERROR_NOT_STARTED ) -> trigger ( ) ; } reset ( $ _SESSION ) ; } | Rewinds the position For Iterator interface |
12,971 | public function setId ( $ sid ) { Argument :: i ( ) -> test ( 1 , 'int' ) ; if ( ! self :: $ session ) { Exception :: i ( ) -> setMessage ( self :: ERROR_NOT_STARTED ) -> trigger ( ) ; } return session_id ( ( int ) $ sid ) ; } | Sets the session ID |
12,972 | public function valid ( ) { if ( ! self :: $ session ) { Exception :: i ( ) -> setMessage ( self :: ERROR_NOT_STARTED ) -> trigger ( ) ; } return isset ( $ _SESSION [ $ this -> key ( ) ] ) ; } | Validates whether if the index is set For Iterator interface |
12,973 | public static function convert_from ( $ data , $ charset = 'cp1251' ) { if ( ! ReflectionTypeHint :: isValid ( ) ) return false ; return self :: _convert ( $ data , $ charset , 'UTF-8' ) ; } | Encodes data from another character encoding to UTF - 8 . |
12,974 | public static function convert_to ( $ data , $ charset = 'cp1251' ) { if ( ! ReflectionTypeHint :: isValid ( ) ) return false ; return self :: _convert ( $ data , 'UTF-8' , $ charset ) ; } | Encodes data from UTF - 8 to another character encoding . |
12,975 | public static function strict ( $ s ) { if ( ! ReflectionTypeHint :: isValid ( ) ) return false ; if ( is_null ( $ s ) ) return $ s ; return preg_replace ( '/[\x00-\x08\x0B\x0C\x0E-\x1F]+/sSX' , '' , $ s ) ; } | Strips out device control codes in the ASCII range . |
12,976 | public static function is_ascii ( $ data ) { if ( ! ReflectionTypeHint :: isValid ( ) ) return false ; if ( is_array ( $ data ) ) { foreach ( $ data as $ k => & $ v ) { if ( ! self :: is_ascii ( $ k ) || ! self :: is_ascii ( $ v ) ) return false ; } return true ; } if ( is_string ( $ data ) ) return ltrim ( $ data , "\... | Check the data accessory to the class of characters ASCII . For null integer float boolean returns TRUE . |
12,977 | public static function is_utf8 ( $ data , $ is_strict = true ) { if ( ! ReflectionTypeHint :: isValid ( ) ) return false ; if ( is_array ( $ data ) ) { foreach ( $ data as $ k => & $ v ) { if ( ! self :: is_utf8 ( $ k , $ is_strict ) || ! self :: is_utf8 ( $ v , $ is_strict ) ) return false ; } return true ; } if ( is_... | Returns true if data is valid UTF - 8 and false otherwise . For null integer float boolean returns TRUE . |
12,978 | public static function blocks_check ( $ data , $ blocks ) { if ( ! ReflectionTypeHint :: isValid ( ) ) return false ; if ( is_array ( $ data ) ) { foreach ( $ data as $ k => & $ v ) { if ( ! self :: blocks_check ( $ k , $ blocks ) || ! self :: blocks_check ( $ v , $ blocks ) ) return false ; } return true ; } if ( is_s... | Check the data in UTF - 8 charset on given ranges of the standard UNICODE . The suitable alternative to regular expressions . |
12,979 | public static function to_unicode ( $ s ) { if ( ! ReflectionTypeHint :: isValid ( ) ) return false ; if ( is_null ( $ s ) ) return $ s ; $ s2 = null ; if ( function_exists ( 'iconv' ) ) $ s2 = @ iconv ( 'UTF-8' , 'UCS-4BE' , $ s ) ; elseif ( function_exists ( 'mb_convert_encoding' ) ) $ s2 = @ mb_convert_encoding ( $ ... | Converts a UTF - 8 string to a UNICODE codepoints |
12,980 | public static function from_unicode ( $ a ) { if ( ! ReflectionTypeHint :: isValid ( ) ) return false ; if ( is_null ( $ a ) ) return $ a ; if ( function_exists ( 'iconv' ) ) { array_walk ( $ a , function ( & $ cp ) { $ cp = pack ( 'N' , $ cp ) ; } ) ; $ s = @ iconv ( 'UCS-4BE' , 'UTF-8' , implode ( '' , $ a ) ) ; if (... | Converts a UNICODE codepoints to a UTF - 8 string |
12,981 | public static function ord ( $ char ) { if ( ! ReflectionTypeHint :: isValid ( ) ) return false ; if ( is_null ( $ char ) ) return $ char ; static $ cache = array ( ) ; if ( array_key_exists ( $ char , $ cache ) ) return $ cache [ $ char ] ; switch ( strlen ( $ char ) ) { case 1 : return $ cache [ $ char ] = ord ( $ ch... | Converts a UTF - 8 character to a UNICODE codepoint |
12,982 | public static function chr ( $ cp ) { if ( ! ReflectionTypeHint :: isValid ( ) ) return false ; if ( is_null ( $ cp ) ) return $ cp ; static $ cache = array ( ) ; if ( array_key_exists ( $ cp , $ cache ) ) return $ cache [ $ cp ] ; if ( $ cp <= 0x7f ) return $ cache [ $ cp ] = chr ( $ cp ) ; if ( $ cp <= 0x7ff ) return... | Converts a UNICODE codepoint to a UTF - 8 character |
12,983 | public static function array_change_key_case ( $ a , $ mode ) { if ( ! ReflectionTypeHint :: isValid ( ) ) return false ; if ( ! is_array ( $ a ) ) return $ a ; $ a2 = array ( ) ; foreach ( $ a as $ k => $ v ) { if ( is_string ( $ k ) ) { $ k = self :: convert_case ( $ k , $ mode ) ; if ( $ k === false ) return false ;... | Changes all keys in an array |
12,984 | public static function stripos ( $ s , $ needle , $ offset = null ) { if ( ! ReflectionTypeHint :: isValid ( ) ) return false ; if ( is_null ( $ s ) ) return $ s ; if ( $ offset === null || $ offset < 0 ) $ offset = 0 ; if ( function_exists ( 'mb_stripos' ) ) return mb_stripos ( $ s , $ needle , $ offset , 'utf-8' ) ; ... | Find position of first occurrence of a case - insensitive string . |
12,985 | public function bootstrap ( ) { if ( ! $ this -> booted ) { $ this -> container = $ this -> buildContainer ( ) ; $ this -> router = $ this -> buildRouter ( ) ; $ this -> booted = true ; } } | bootstrap Bootstrap the application |
12,986 | public function handle ( Request $ request ) { if ( ! $ this -> booted ) { $ this -> bootstrap ( ) ; } $ this -> request = $ request ; $ response = new Response ( ) ; return ( $ response ) ; } | handle The main application handler extended by children kernels . |
12,987 | protected function buildRouter ( ) { $ routes = new RouteCollection ( ) ; $ context = new RequestContext ( ) ; $ router = new UrlMatcher ( $ routes , $ context ) ; return ( $ router ) ; } | buildRouter Build the router for matching requests to controllers extended by children kernels . |
12,988 | public function getPayURedirectUrl ( ) { $ mode = parent :: $ apiContext -> get ( 'mode' ) ; $ reference = $ this -> return -> payUReference ; if ( ! $ mode || ! $ reference ) return null ; $ url = sprintf ( self :: REDIRECT_URL , $ mode === 'sandbox' ? 'staging' : 'secure' , $ reference ) ; return $ url ; } | PayU redirect url . Customer is redirected to PayU to capture payment details . |
12,989 | protected function fillSave ( array $ attributes , array $ options = [ ] ) : Model { $ this -> forceFill ( $ attributes ) -> save ( $ options ) ; return $ this ; } | Force fill a model and save |
12,990 | public function updateOrCreateNew ( array $ attributes , $ key , array $ options = [ ] ) : Model { $ query = $ this -> newQuery ( ) ; if ( is_array ( $ key ) ) { foreach ( $ key as $ column ) { $ query -> where ( $ column , $ attributes [ $ column ] ) ; } } else { $ query -> where ( $ key , $ attributes [ $ key ] ) ; }... | Insert or update without dealing with mass assignment |
12,991 | public function setOption ( $ option , $ value ) { if ( $ this -> isValidOption ( $ option ) ) { $ this -> options [ $ option ] = $ value ; } return $ this ; } | Sets value to the option of the operation |
12,992 | public function getOption ( $ option ) { if ( ! isset ( $ this -> options [ $ option ] ) ) { throw new \ Exception ( 'This option does not exist' ) ; } return $ this -> options [ $ option ] ; } | Gets value from options |
12,993 | protected function registerOption ( $ option ) { if ( ! in_array ( $ option , $ this -> validOptions ) ) { array_push ( $ this -> validOptions , $ option ) ; } return $ this ; } | registers an option from the response object |
12,994 | public function render ( ) { if ( ! $ this :: OBJECT_IDENTIFIER ) { throw new \ Exception ( 'No operation was set' ) ; } $ operation = array ( 'operation' => $ this :: OBJECT_IDENTIFIER , 'options' => $ this -> options ) ; return $ operation ; } | Render the operation item |
12,995 | private function get ( string $ endpoint ) : array { return \ GuzzleHttp \ json_decode ( $ this -> client -> get ( self :: API_BASE_URI . $ endpoint , [ 'query' => [ 'client_id' => $ this -> apiKey , ] , ] ) -> getBody ( ) -> getContents ( ) , true ) ; } | Get the response from the API . |
12,996 | public function loadFromJson ( $ context = null ) { if ( $ context == null ) $ context = getenv ( 'ERDIKO_CONTEXT' ) ; return \ erdiko \ core \ Helper :: getConfig ( "authorize" , $ context ) ; } | Optional it might include guards and rules . |
12,997 | public function first ( $ value , $ label = null ) { $ this -> firstValue = array ( 'label' => $ label === null ? $ value : $ label , 'value' => $ label === null ? '' : $ value ) ; return $ this ; } | Set first option If label is not passed value will equal to and label set be using value |
12,998 | public static function user_has_rated ( $ args ) { if ( ! isset ( $ args [ 1 ] ) || ! is_numeric ( $ args [ 0 ] ) || ! is_numeric ( $ args [ 1 ] ) ) return null ; $ rateDataObj = ezsrRatingDataObject :: create ( array ( 'contentobject_id' => $ args [ 0 ] , 'contentobject_attribute_id' => $ args [ 1 ] ) ) ; return $ rat... | Check if user has rated . |
12,999 | private function getRequestUri ( ServerRequestInterface $ request ) : string { $ uri = $ request -> getUri ( ) -> getPath ( ) ; $ query = $ request -> getUri ( ) -> getQuery ( ) ; if ( ! empty ( $ query ) ) { return $ uri . '?' . \ urldecode ( $ query ) ; } return $ uri ; } | Returns the full URI |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.