idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
60,000
public function check_storage ( ) { $ this -> line ( ' * Checking storage' ) ; if ( ! File :: isWritable ( storage_path ( ) ) ) $ this -> error ( storage_path ( ) . ' is not writable' ) ; else $ this -> info ( storage_path ( ) . ' is writable' ) ; if ( ! File :: isWritable ( config ( 'eveapi.config.eseye_logfile' ) ) )...
Check access to some important storage paths .
60,001
public function check_database ( ) { $ this -> line ( ' * Checking Database' ) ; $ this -> table ( [ 'Setting' , 'Value' ] , [ [ 'Connection' , env ( 'DB_CONNECTION' ) ] , [ 'Host' , env ( 'DB_HOST' ) ] , [ 'Database' , env ( 'DB_DATABASE' ) ] , [ 'Username' , env ( 'DB_USERNAME' ) ] , [ 'Password' , str_repeat ( '*' ,...
Check if database access is OK .
60,002
public function check_redis ( ) { $ this -> line ( ' * Checking Redis' ) ; $ this -> table ( [ 'Setting' , 'Value' ] , [ [ 'Host' , config ( 'database.redis.default.host' ) ] , [ 'Port' , config ( 'database.redis.default.port' ) ] , [ 'Database' , config ( 'database.redis.default.database' ) ] , ] ) ; $ test_key = str_...
Check of redis access is OK .
60,003
public function check_pheal ( ) { $ this -> line ( ' * Checking ESI Access' ) ; $ esi = app ( 'esi-client' ) -> get ( ) ; $ esi -> setVersion ( 'v1' ) ; Configuration :: getInstance ( ) -> cache = NullCache :: class ; try { $ result = $ esi -> invoke ( 'get' , '/status/' ) ; $ this -> info ( 'Server Online Since: ' . $...
Check if access to the EVE API OK .
60,004
public function init ( $ data = null ) { if ( $ this -> initialized ) { return $ this ; } if ( is_null ( $ data ) ) { $ data = $ this -> fetchData ( ) ; } if ( $ this -> isInitialized ( $ data ) ) { $ this -> initialized = true ; } $ this -> data = $ data ; if ( $ this -> initialized ) { $ this -> onData ( $ data ) ; }...
Load data onto this object . Chainable method .
60,005
protected function url ( $ path = '' , $ query = [ ] ) { $ path = $ this -> urlBase ( ) . $ path ; $ query = http_build_query ( array_merge ( $ this -> params , $ query ) ) ; $ url = $ path ; if ( ! empty ( $ query ) ) { $ url .= '?' . $ query ; } return $ url ; }
Build a relative URL for a resource .
60,006
public function getItem ( ) { if ( isset ( $ this -> barcode ) ) { return $ this -> client -> items -> fromBarcode ( $ this -> barcode ) ; } }
Get the related Item if any .
60,007
public function parseSections ( array $ sections , Configuration $ configuration = null ) { if ( is_null ( $ configuration ) ) { $ configuration = new Configuration ( ) ; } foreach ( $ sections as $ sectionName => $ section ) { $ name = explode ( ':' , $ sectionName , 2 ) ; $ class = $ configuration -> findSection ( $ ...
Parses a section array .
60,008
protected function arrayToHtml ( $ content , $ html = '' ) { if ( is_scalar ( $ content ) ) { return $ content ; } $ html = "<ul>\n" ; foreach ( $ content as $ field => $ value ) { $ html .= "<li><strong>" . $ field . ":</strong> " ; if ( is_array ( $ value ) ) { $ html .= $ this -> arrayToHtml ( $ value ) ; } else { i...
Recursively render an array to an HTML list
60,009
protected function determineMediaType ( $ acceptHeader ) { if ( ! empty ( $ acceptHeader ) ) { $ negotiator = new Negotiator ( ) ; $ mediaType = $ negotiator -> getBest ( $ acceptHeader , $ this -> knownMediaTypes ) ; if ( $ mediaType ) { return $ mediaType -> getValue ( ) ; } } return $ this -> getDefaultMediaType ( )...
Read the accept header and determine which media type we know about is wanted .
60,010
public function determinePeferredFormat ( $ acceptHeader , $ allowedFormats = [ 'json' , 'xml' , 'html' ] , $ default = 'json' ) { if ( empty ( $ acceptHeader ) ) { return $ default ; } $ negotiator = new Negotiator ( ) ; try { $ elements = $ negotiator -> getOrderedElements ( $ acceptHeader ) ; } catch ( InvalidMediaT...
Read the accept header and work out which format is preferred
60,011
protected function renderXml ( $ data ) { $ xml = $ this -> arrayToXml ( $ data ) ; $ dom = new \ DOMDocument ( '1.0' ) ; $ dom -> preserveWhiteSpace = false ; $ dom -> formatOutput = $ this -> pretty ; $ dom -> loadXML ( $ xml -> asXML ( ) ) ; return $ dom -> saveXML ( ) ; }
Render Array as XML
60,012
public function setObject ( \ Smarty $ object = null ) { $ this -> object = $ object ? $ object : new \ Smarty ( ) ; return $ this ; }
Set Smarty object
60,013
public function setOptions ( array $ options ) { foreach ( $ options as $ key => $ value ) { $ this -> options [ $ key ] = $ value ; $ value && $ this -> object -> $ key = $ value ; } return $ this ; }
Set property value for Smarty
60,014
public function inMimeType ( $ findMe , $ mimeTypes ) { foreach ( $ mimeTypes as $ mimeType ) { if ( $ mimeType == $ findMe ) { return true ; } $ type = strstr ( $ mimeType , '/*' , true ) ; if ( $ type && $ type === strstr ( $ findMe , '/' , true ) ) { return true ; } } return false ; }
Checks if a mime type exists in a mime type array
60,015
protected function setMaxSize ( $ maxSize ) { $ this -> maxSize = $ this -> toBytes ( $ maxSize ) ; $ this -> maxSizeString = $ this -> fromBytes ( $ this -> maxSize ) ; return $ this ; }
Set maximum file size
60,016
protected function setMinSize ( $ minSize ) { $ this -> minSize = $ this -> toBytes ( $ minSize ) ; $ this -> minSizeString = $ this -> fromBytes ( $ this -> minSize ) ; return $ this ; }
Set the minimum file size
60,017
public function getMimeType ( ) { if ( ! $ this -> mimeType ) { $ finfo = finfo_open ( FILEINFO_MIME_TYPE , $ this -> magicFile ) ; if ( ! $ finfo ) { throw new \ UnexpectedValueException ( 'Failed to open fileinfo database' ) ; } $ this -> mimeType = finfo_file ( $ finfo , $ this -> file ) ; } return $ this -> mimeTyp...
Returns the file mime type on success
60,018
public function getExt ( ) { if ( is_null ( $ this -> ext ) && $ this -> originFile ) { $ file = basename ( $ this -> originFile ) ; if ( false !== $ pos = strrpos ( $ file , '.' ) ) { $ this -> ext = strtolower ( substr ( $ file , $ pos + 1 ) ) ; } else { $ this -> ext = '' ; } } return $ this -> ext ; }
Returns the file extension if file is not exists return null instead
60,019
public function getFile ( $ key ) { $ key = str_replace ( $ this -> illegalChars , '_' , $ this -> namespace . $ key ) ; return $ this -> dir . '/' . $ key . '.' . $ this -> ext ; }
Get cache file by key
60,020
public function setDir ( $ dir ) { if ( ! is_dir ( $ dir ) && ! @ mkdir ( $ dir , 0755 , true ) ) { $ message = sprintf ( 'Failed to create directory "%s"' , $ dir ) ; ( $ e = error_get_last ( ) ) && $ message .= ': ' . $ e [ 'message' ] ; throw new \ RuntimeException ( $ message ) ; } $ this -> dir = realpath ( $ dir ...
Set the cache directory
60,021
protected function readAndVerify ( $ handle , $ file ) { $ content = fread ( $ handle , filesize ( $ file ) ) ; $ content = @ unserialize ( $ content ) ; if ( $ content && is_array ( $ content ) && time ( ) < $ content [ 0 ] ) { return $ content ; } else { return false ; } }
Read file by handle and verify if content is expired
60,022
protected function writeAndRelease ( $ handle , $ content , $ rewrite = false ) { $ rewrite && rewind ( $ handle ) && ftruncate ( $ handle , 0 ) ; $ result = fwrite ( $ handle , $ content ) ; flock ( $ handle , LOCK_UN ) ; fclose ( $ handle ) ; return ( bool ) $ result ; }
Write content release lock and close file
60,023
public function setValueRange ( $ minValue , $ maxValue ) { if ( preg_match ( '/^([1-9][0-9]*)|([0]{1})$/' , $ minValue ) !== 1 ) { throw new InvalidArgumentException ( 'Min value must contain only digits.' ) ; } if ( preg_match ( '/^[1-9][0-9]*$/' , $ maxValue ) !== 1 ) { throw new InvalidArgumentException ( 'Max valu...
Set value range and pad sizes .
60,024
public function encrypt ( $ input , $ base = 10 , $ pad = false , $ password = null , $ iv = null ) { return $ this -> _encryptInternal ( $ input , $ base , $ pad , $ password , $ iv , true ) ; }
Encrypts input data . Acts as a public alias for _encryptInternal method .
60,025
private function _encryptInternal ( $ input , $ base , $ pad , $ password , $ iv , $ checkVal = false ) { $ this -> _validateInput ( $ input , $ base , $ checkVal ) ; $ this -> _validateIv ( $ iv ) ; $ hashPassword = $ this -> _hashPassword ( $ password ) ; $ roundKeys = $ this -> _roundKeys ( $ hashPassword , $ iv ) ;...
Encrypts input data .
60,026
private function _encrypt ( $ input , $ password , $ iv = null ) { return ( self :: $ allowedCiphers [ $ this -> cipher ] [ 'iv' ] ) ? openssl_encrypt ( $ input , $ this -> cipher , $ password , true , $ iv ) : openssl_encrypt ( $ input , $ this -> cipher , $ password , true ) ; }
Encrypt helper .
60,027
private function _round ( $ input , $ key , $ hashPassword , $ iv = null ) { $ bin = DataConverter :: rawToBin ( $ this -> _encrypt ( $ input . $ key , $ hashPassword , $ iv ) ) ; return substr ( $ bin , - 1 * $ this -> sideSize ) ; }
Round function helper .
60,028
private function _binaryXor ( $ left , $ round ) { $ xOr = gmp_xor ( gmp_init ( $ left , 2 ) , gmp_init ( $ round , 2 ) ) ; $ bin = gmp_strval ( $ xOr , 2 ) ; return str_pad ( $ bin , $ this -> sideSize , '0' , STR_PAD_LEFT ) ; }
Binary xor helper .
60,029
private function _convertToBin ( $ input , $ base ) { switch ( $ base ) { case 2 : return DataConverter :: pad ( $ input , $ this -> binSize ) ; case 10 : return DataConverter :: decToBin ( $ input , $ this -> binSize ) ; case 16 : return DataConverter :: hexToBin ( $ input , $ this -> binSize ) ; } }
Helper method converting input data to binary string .
60,030
private function _convertFromBin ( $ binary , $ base , $ pad ) { switch ( $ base ) { case 2 : return DataConverter :: pad ( $ binary , ( $ pad ? $ this -> binSize : 0 ) ) ; case 10 : return DataConverter :: binToDec ( $ binary , ( $ pad ? $ this -> decSize : 0 ) ) ; case 16 : return DataConverter :: binToHex ( $ binary...
Helper method converting input data from binary string .
60,031
private function _validateInput ( $ input , $ base , $ checkDomain = false ) { if ( ! array_key_exists ( $ base , self :: $ allowedBases ) ) { throw new InvalidArgumentException ( sprintf ( 'Type must be one of "%s".' , implode ( ', ' , array_keys ( self :: $ allowedBases ) ) ) ) ; } if ( preg_match ( self :: $ allowed...
Validates input data .
60,032
private function _validateIv ( $ iv = null ) { if ( self :: $ allowedCiphers [ $ this -> cipher ] [ 'iv' ] ) { $ this -> blockSize = openssl_cipher_iv_length ( $ this -> cipher ) ; $ ivLength = mb_strlen ( $ iv , '8bit' ) ; if ( $ ivLength !== $ this -> blockSize ) { throw new InvalidArgumentException ( sprintf ( 'Init...
Validates initialization vector .
60,033
private function _hashPassword ( $ password = null ) { if ( null !== $ password ) { $ this -> password = md5 ( $ password ) ; } return $ this -> password ; }
Hashes the password .
60,034
private function _roundKeys ( $ hashPassword = null , $ iv = null ) { $ roundKeys = [ ] ; $ prevKey = $ this -> _encrypt ( $ this -> key , $ hashPassword , $ iv ) ; for ( $ i = 1 ; $ i <= $ this -> rounds ; $ i ++ ) { $ prevKey = $ this -> _encrypt ( $ prevKey , $ hashPassword , $ iv ) ; $ roundKeys [ $ i ] = substr ( ...
Generates hash keys .
60,035
public function _output ( $ array_js = '' ) { if ( ! is_array ( $ array_js ) ) { $ array_js = array ( $ array_js ) ; } foreach ( $ array_js as $ js ) { $ this -> jquery_code_for_compile [ ] = "\t$js\n" ; } }
Outputs script directly
60,036
public function _add_event ( $ element , $ js , $ event , $ preventDefault = false , $ stopPropagation = false , $ immediatly = true ) { if ( is_array ( $ js ) ) { $ js = implode ( "\n\t\t" , $ js ) ; } if ( $ preventDefault === true ) { $ js = "event.preventDefault();\n" . $ js ; } if ( $ stopPropagation === true ) { ...
Constructs the syntax for an event and adds to into the array for compilation
60,037
public function _compile ( & $ view = NULL , $ view_var = 'script_foot' , $ script_tags = TRUE ) { $ ui = $ this -> ui ( ) ; if ( $ this -> ui ( ) != NULL ) { if ( $ ui -> isAutoCompile ( ) ) { $ ui -> compile ( true ) ; } } $ bootstrap = $ this -> bootstrap ( ) ; if ( $ this -> bootstrap ( ) != NULL ) { if ( $ bootstr...
As events are specified they are stored in an array This function compiles them all for output on a page
60,038
public static function bootstrap ( $ coverageEnabled , $ storageDirectory , $ phpunitConfigFilePath = null ) { Assert :: boolean ( $ coverageEnabled ) ; if ( ! $ coverageEnabled ) { return function ( ) { } ; } $ coverageGroup = isset ( $ _GET [ self :: COVERAGE_GROUP_KEY ] ) ? $ _GET [ self :: COVERAGE_GROUP_KEY ] : ( ...
Enable remote code coverage .
60,039
public function _animate ( $ element = 'this' , $ params = array ( ) , $ speed = '' , $ extra = '' , $ immediatly = false ) { $ element = $ this -> _prep_element ( $ element ) ; $ speed = $ this -> _validate_speed ( $ speed ) ; $ animations = "\t\t\t" ; if ( is_array ( $ params ) ) { foreach ( $ params as $ param => $ ...
Execute a jQuery animate action
60,040
public function _fadeIn ( $ element = 'this' , $ speed = '' , $ callback = '' , $ immediatly = false ) { $ element = $ this -> _prep_element ( $ element ) ; $ speed = $ this -> _validate_speed ( $ speed ) ; if ( $ callback != '' ) { $ callback = ", function(){\n{$callback}\n}" ; } $ str = "$({$element}).fadeIn({$speed}...
Execute a jQuery hide action
60,041
public function _toggle ( $ element = 'this' , $ immediatly = false ) { $ element = $ this -> _prep_element ( $ element ) ; $ str = "$({$element}).toggle();" ; if ( $ immediatly ) $ this -> jquery_code_for_compile [ ] = $ str ; return $ str ; }
Outputs a jQuery toggle event
60,042
public function _condition ( $ condition , $ jsCodeIfTrue , $ jsCodeIfFalse = null , $ immediatly = false ) { $ str = "if(" . $ condition . "){" . $ jsCodeIfTrue . "}" ; if ( isset ( $ jsCodeIfFalse ) ) { $ str .= "else{" . $ jsCodeIfFalse . "}" ; } if ( $ immediatly ) $ this -> jquery_code_for_compile [ ] = $ str ; re...
Places a condition
60,043
public function filter ( $ filter ) { if ( is_array ( $ filter ) ) { $ filter = new GridFilter ( $ filter ) ; } if ( $ filter instanceof FilterSpecification ) { $ filter = new GridFilter ( $ filter -> asFilter ( ) ) ; } $ this -> filter = $ filter ; return $ this ; }
Set filter to the resource selecting
60,044
protected function getRelationships ( array $ item , array $ included ) { if ( ! isset ( $ item [ 'relationships' ] ) || ! is_array ( $ item [ 'relationships' ] ) ) { return [ ] ; } $ result = [ ] ; foreach ( $ item [ 'relationships' ] as $ relationKey => $ relationValue ) { foreach ( $ relationValue [ 'data' ] as $ re...
Get relationships from array
60,045
public function drop ( $ table , $ ifExists = false ) { $ sql = 'DROP TABLE ' ; if ( $ ifExists ) { $ sql .= 'IF EXISTS ' ; } $ sql .= $ table ; $ this -> db -> executeUpdate ( $ sql ) ; return $ this ; }
Execute a drop table sql
60,046
public function decimal ( $ column , $ length = 10 , $ scale = 2 ) { return $ this -> addColumn ( $ column , self :: TYPE_DECIMAL , array ( 'length' => $ length , 'scale' => $ scale ) ) ; }
Add a decimal column
60,047
public function int ( $ column , $ length = null ) { return $ this -> addColumn ( $ column , self :: TYPE_INT , array ( 'length' => $ length ) ) ; }
Add a int column
60,048
public function tinyInt ( $ column , $ length = null ) { return $ this -> addColumn ( $ column , self :: TYPE_TINY_INT , array ( 'length' => $ length ) ) ; }
Add a tiny int column
60,049
public function smallInt ( $ column , $ length = null ) { return $ this -> addColumn ( $ column , self :: TYPE_SMALL_INT , array ( 'length' => $ length ) ) ; }
Add a small int column
60,050
public function id ( $ column = 'id' ) { $ this -> int ( $ column ) -> unsigned ( ) -> autoIncrement ( ) ; return $ this -> primary ( $ column ) ; }
Add a int auto increment id to table
60,051
public function rename ( $ from , $ to ) { $ sql = sprintf ( 'RENAME TABLE %s TO %s' , $ from , $ to ) ; $ this -> db -> executeUpdate ( $ sql ) ; return $ this ; }
Execute a rename table sql
60,052
public function findDistinctHosts ( ) { $ query = $ this -> entityManager -> createQuery ( 'SELECT DISTINCT r.host FROM Neos\RedirectHandler\DatabaseStorage\Domain\Model\Redirect r' ) ; return array_map ( function ( $ record ) { return $ record [ 'host' ] ; } , $ query -> getResult ( ) ) ; }
Return a list of all hosts
60,053
protected function iterate ( IterableResult $ iterator , callable $ callback = null ) { $ iteration = 0 ; foreach ( $ iterator as $ object ) { $ object = current ( $ object ) ; yield $ object ; if ( $ callback !== null ) { call_user_func ( $ callback , $ iteration , $ object ) ; } $ iteration ++ ; } }
Iterator over an IterableResult and return a Generator
60,054
public function set ( int $ userId , array $ factors , array $ context ) { $ uriAppend = 'set' ; $ params = [ 'userId' => $ userId , 'factors' => $ factors , 'context' => $ context , ] ; $ response = $ this -> handler -> handle ( 'POST' , $ params , $ uriAppend ) ; return $ this -> make ( $ response ) ; }
Set consumer factors for history and for current entity factors
60,055
public function authorize_url ( $ client_id , $ redirect_uri , $ scope = 'AdministerAccount' , $ state = false ) { $ qs = 'type=web_server' ; $ qs .= '&client_id=' . urlencode ( $ client_id ) ; $ qs .= '&redirect_uri=' . urlencode ( $ redirect_uri ) ; $ qs .= '&scope=' . urlencode ( $ scope ) ; if ( $ state ) $ qs .= '...
Get the authorization URL for your application .
60,056
public function exchange_token ( $ client_id , $ client_secret , $ redirect_uri , $ code = '' ) { $ params = array ( 'grant_type' => 'authorization_code' , 'client_id' => $ client_id , 'client_secret' => $ client_secret , 'redirect_uri' => $ redirect_uri , 'code' => $ code ) ; return $ this -> _request ( 'oauth' , $ pa...
Exchange a provided OAuth code for an OAuth access token expires in value and refresh token .
60,057
public function refresh_token ( ) { if ( ! isset ( $ this -> auth_details [ 'refresh_token' ] ) ) trigger_error ( 'Error refreshing token. There is no refresh token set on this object.' , E_USER_ERROR ) ; $ params = array ( 'grant_type' => 'refresh_token' , 'refresh_token' => $ this -> auth_details [ 'refresh_token' ] ...
Refresh the current OAuth token using the current refresh token .
60,058
public function getInt ( $ name , $ min = null , $ max = null ) { $ value = ( int ) $ this ( $ name ) ; if ( ! is_null ( $ min ) && $ value < $ min ) { return $ min ; } elseif ( ! is_null ( $ max ) && $ value > $ max ) { return $ max ; } return $ value ; }
Returns a integer value in the specified range
60,059
public function getInArray ( $ name , array $ array ) { $ value = $ this -> get ( $ name ) ; return in_array ( $ value , $ array ) ? $ value : $ array [ key ( $ array ) ] ; }
Returns a parameter value in the specified array if not in returns the first element instead
60,060
public function set ( $ name , $ value = null ) { if ( ! is_array ( $ name ) ) { $ this -> data [ $ name ] = $ value ; } else { foreach ( $ name as $ key => $ value ) { $ this -> data [ $ key ] = $ value ; } } return $ this ; }
Set parameter value
60,061
public function has ( $ name ) { return isset ( $ this -> data [ $ name ] ) && ! in_array ( $ this -> data [ $ name ] , [ '' , null , false , array ( ) ] , true ) ; }
Check if the parameter has value
60,062
public function & offsetGet ( $ offset ) { if ( ! isset ( $ this -> data [ $ offset ] ) ) { $ this -> extraKeys [ $ offset ] = true ; } return $ this -> data [ $ offset ] ; }
Get the offset value
60,063
public function getHost ( ) { $ host = $ this -> getServer ( 'HTTP_HOST' ) ? : $ this -> getServer ( 'SERVER_NAME' ) ? : $ this -> getServer ( 'REMOTE_ADDR' ) ; return preg_replace ( '/:\d+$/' , '' , $ host ) ; }
Returns the request host
60,064
public function getBaseUrl ( ) { if ( $ this -> baseUrl === null ) { $ this -> setBaseUrl ( $ this -> detectBaseUrl ( ) ) ; } return $ this -> baseUrl ; }
Get the base URL .
60,065
public function getPathInfo ( ) { if ( $ this -> pathInfo === null ) { $ this -> pathInfo = $ this -> detectPathInfo ( ) ; } return $ this -> pathInfo ; }
Return request path info
60,066
public function getMethod ( ) { if ( null === $ this -> method ) { $ this -> method = $ this -> getServer ( 'REQUEST_METHOD' , 'GET' ) ; } return $ this -> method ; }
Returns the HTTP request method
60,067
public function getContent ( ) { if ( null === $ this -> content && $ this -> fromGlobal ) { $ this -> content = file_get_contents ( 'php://input' ) ; } return $ this -> content ; }
Returns the request message body
60,068
public function getHeaders ( ) { $ headers = array ( ) ; foreach ( $ this -> servers as $ name => $ value ) { if ( 0 === strpos ( $ name , 'HTTP_' ) ) { $ headers [ substr ( $ name , 5 ) ] = $ value ; } } return $ headers ; }
Returns the HTTP request headers
60,069
protected function detectPathInfo ( ) { $ uri = $ this -> getRequestUri ( ) ; $ pathInfo = '/' . trim ( substr ( $ uri , strlen ( $ this -> getBaseUrl ( ) ) ) , '/' ) ; if ( false !== $ pos = strpos ( $ pathInfo , '?' ) ) { $ pathInfo = substr ( $ pathInfo , 0 , $ pos ) ; } return $ pathInfo ; }
Detect the path info for the request
60,070
protected function removeExtraKeys ( ) { foreach ( $ this -> extraKeys as $ offset => $ value ) { if ( $ this -> data [ $ offset ] === null ) { unset ( $ this -> data [ $ offset ] ) ; } } $ this -> extraKeys = [ ] ; }
Removes extra keys in data
60,071
public function _click ( $ element = 'this' , $ js = array ( ) , $ ret_false = TRUE ) { if ( ! is_array ( $ js ) ) { $ js = array ( $ js ) ; } if ( $ ret_false ) { $ js [ ] = "return false;" ; } return $ this -> _add_event ( $ element , $ js , 'click' ) ; }
Outputs a jQuery click event
60,072
public function _hover ( $ element = 'this' , $ over , $ out ) { $ event = "\n\t$(" . $ this -> _prep_element ( $ element ) . ").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n" ; $ this -> jquery_code_for_compile [ ] = $ event ; return $ event ; }
Outputs a jQuery hover event
60,073
public function toOptions ( $ name ) { $ html = '' ; foreach ( $ this -> wei -> getConfig ( $ name ) as $ value => $ text ) { if ( is_array ( $ text ) ) { $ html .= '<optgroup label="' . $ value . '">' ; foreach ( $ text as $ v => $ t ) { $ html .= '<option value="' . $ v . '">' . $ t . '</option>' ; } $ html .= '</opt...
Convert configuration data to HTML select options
60,074
public function nextState ( $ currentState , $ inputChar ) { $ initialState = $ currentState ; while ( true ) { $ transitions = & $ this -> yesTransitions [ $ currentState ] ; if ( isset ( $ transitions [ $ inputChar ] ) ) { $ nextState = $ transitions [ $ inputChar ] ; if ( $ currentState !== $ initialState ) { $ this...
Map the current state and input character to the next state .
60,075
public function searchIn ( $ text ) { if ( ! $ this -> searchKeywords || $ text === '' ) { return [ ] ; } $ state = 0 ; $ results = [ ] ; $ length = strlen ( $ text ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ ch = $ text [ $ i ] ; $ state = $ this -> nextState ( $ state , $ ch ) ; foreach ( $ this -> outputs [ $ ...
Locate the search keywords in some text .
60,076
protected function computeYesTransitions ( ) { $ this -> yesTransitions = [ [ ] ] ; $ this -> outputs = [ [ ] ] ; foreach ( $ this -> searchKeywords as $ keyword => $ length ) { $ state = 0 ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ ch = $ keyword [ $ i ] ; if ( ! empty ( $ this -> yesTransitions [ $ state ] [ $ c...
Get the state transitions which the string - matching automaton shall make as it advances through input text .
60,077
protected function computeNoTransitions ( ) { $ queue = [ ] ; $ this -> noTransitions = [ ] ; foreach ( $ this -> yesTransitions [ 0 ] as $ ch => $ toState ) { $ queue [ ] = $ toState ; $ this -> noTransitions [ $ toState ] = 0 ; } while ( true ) { $ fromState = array_shift ( $ queue ) ; if ( $ fromState === null ) { b...
Get the state transitions which the string - matching automaton shall make when a partial match proves false .
60,078
public function stopAndSave ( ) { $ this -> codeCoverage -> stop ( ) ; Storage :: storeCodeCoverage ( $ this -> codeCoverage , $ this -> storageDirectory , uniqid ( date ( 'YmdHis' ) , true ) ) ; }
Stop collecting code coverage data and save it .
60,079
public function get ( int $ id , $ params = [ ] ) { if ( $ this -> fields ) { $ params [ 'fields' ] = implode ( ',' , $ this -> fields ) ; } $ uriAppend = 'byId/' . $ id ; $ response = $ this -> handler -> handle ( 'GET' , false , $ uriAppend , $ params ) ; return $ this -> make ( $ response , false ) ; }
Get entity by id
60,080
public function detail ( int $ id ) { $ response = $ this -> handler -> handle ( 'GET' , false , 'detail/' . $ id ) ; return $ this -> make ( $ response , false ) ; }
Detail dealer information
60,081
public function detailWithAddresses ( $ id ) { $ dealer = $ this -> detail ( $ id ) ; if ( $ dealer -> dealersToAddresses ) { $ addressesId = array_map ( function ( $ value ) { return $ value [ 'addressId' ] ; } , $ dealer -> dealersToAddresses ) ; $ addresses = $ this -> client -> addresses ( ) -> ids ( array_values (...
Detail dealer information with additional request to addresses
60,082
public function send ( $ content = null , $ status = null ) { if ( is_array ( $ content ) ) { return $ this -> json ( $ content ) -> send ( ) ; } elseif ( null !== $ content ) { $ this -> setContent ( $ content ) ; } if ( null !== $ status ) { $ this -> setStatusCode ( $ status ) ; } $ this -> beforeSend && call_user_f...
Send response header and content
60,083
public function setStatusCode ( $ code , $ text = null ) { $ this -> statusCode = ( int ) $ code ; if ( $ text ) { $ this -> statusText = $ text ; } elseif ( isset ( $ this -> statusTexts [ $ code ] ) ) { $ this -> statusText = $ this -> statusTexts [ $ code ] ; } return $ this ; }
Set the header status code
60,084
public function setHeader ( $ name , $ values = null , $ replace = true ) { if ( is_array ( $ name ) ) { foreach ( $ name as $ key => $ value ) { $ this -> setHeader ( $ key , $ value ) ; } return $ this ; } $ values = ( array ) $ values ; if ( true === $ replace || ! isset ( $ this -> headers [ $ name ] ) ) { $ this -...
Set the header string
60,085
public function getHeader ( $ name , $ default = null , $ first = true ) { if ( ! isset ( $ this -> headers [ $ name ] ) ) { return $ default ; } if ( is_array ( $ this -> headers [ $ name ] ) && $ first ) { return current ( $ this -> headers [ $ name ] ) ; } return $ this -> headers [ $ name ] ; }
Get the header string
60,086
public function sendHeader ( ) { $ file = $ line = null ; if ( $ this -> isHeaderSent ( $ file , $ line ) ) { if ( $ this -> wei -> has ( 'logger' ) ) { $ this -> logger -> debug ( sprintf ( 'Header has been at %s:%s' , $ file , $ line ) ) ; } return false ; } $ this -> sendRawHeader ( sprintf ( 'HTTP/%s %d %s' , $ thi...
Send HTTP headers including HTTP status raw headers and cookies
60,087
public function isHeaderSent ( & $ file = null , & $ line = null ) { return $ this -> unitTest ? ( bool ) $ this -> sentHeaders : headers_sent ( $ file , $ line ) ; }
Checks if or where headers have been sent
60,088
public function getCookie ( $ key , $ default = null ) { return isset ( $ this -> cookies [ $ key ] ) ? $ this -> cookies [ $ key ] [ 'value' ] : $ default ; }
Get response cookie
60,089
public function getHeaderString ( ) { $ string = '' ; foreach ( $ this -> headers as $ name => $ values ) { foreach ( $ values as $ value ) { $ string .= $ name . ': ' . $ value . "\r\n" ; } } return $ string ; }
Returns response header as string
60,090
public function setRedirectView ( $ redirectView ) { if ( ! is_file ( $ redirectView ) ) { throw new \ RuntimeException ( sprintf ( 'Redirect view file "%s" not found' , $ redirectView ) ) ; } $ this -> redirectView = $ redirectView ; return $ this ; }
Set redirect view file
60,091
public function redirect ( $ url = null , $ statusCode = 302 , $ options = array ( ) ) { $ this -> setStatusCode ( $ statusCode ) ; $ this -> setOption ( $ options ) ; $ escapedUrl = htmlspecialchars ( $ url , ENT_QUOTES , 'UTF-8' ) ; $ wait = ( int ) $ this -> redirectWait ; if ( 0 === $ wait ) { $ this -> setHeader (...
Send a redirect response
60,092
public function json ( $ data , $ jsonp = false ) { $ options = 0 ; defined ( 'JSON_UNESCAPED_UNICODE' ) && $ options = JSON_UNESCAPED_UNICODE ; $ content = json_encode ( $ data , $ options ) ; if ( $ jsonp && preg_match ( '/^[$A-Z_][0-9A-Z_$.]*$/i' , $ this -> request [ 'callback' ] ) === 1 ) { $ this -> setHeader ( '...
Response JSON or JSONP format string
60,093
public function flush ( $ content = null ) { if ( function_exists ( 'apache_setenv' ) ) { apache_setenv ( 'no-gzip' , '1' ) ; } if ( ! headers_sent ( ) && extension_loaded ( 'zlib' ) ) { ini_set ( 'zlib.output_compression' , '0' ) ; } ob_implicit_flush ( ) ; $ this -> send ( $ content ) ; if ( $ length = ini_get ( 'out...
Flushes content to browser immediately
60,094
public function download ( $ file = null , array $ downloadOptions = array ( ) ) { $ o = $ downloadOptions + $ this -> downloadOption ; if ( ! is_file ( $ file ) ) { throw new \ RuntimeException ( 'File not found' , 404 ) ; } $ name = $ o [ 'filename' ] ? : basename ( $ file ) ; $ name = rawurlencode ( $ name ) ; $ use...
Send file download response
60,095
public function release ( $ key ) { if ( $ this -> cache -> remove ( $ key ) ) { if ( ( $ index = array_search ( $ key , $ this -> keys ) ) !== false ) { unset ( $ this -> keys [ $ index ] ) ; } return true ; } else { return false ; } }
Release a lock key
60,096
public function before ( $ to , $ element , $ immediatly = false ) { return $ this -> js -> _genericCallElement ( 'before' , $ to , $ element , $ immediatly ) ; }
Insert content specified by the parameter before each element in the set of matched elements
60,097
public function val ( $ element = 'this' , $ value = '' , $ immediatly = false ) { return $ this -> js -> _genericCallValue ( 'val' , $ element , $ value , $ immediatly ) ; }
Get or set the value of the first element in the set of matched elements or set one or more attributes for every matched element .
60,098
public function html ( $ element = 'this' , $ value = '' , $ immediatly = false ) { return $ this -> js -> _genericCallValue ( 'html' , $ element , $ value , $ immediatly ) ; }
Get or set the html of an attribute for the first element in the set of matched elements .
60,099
public function condition ( $ condition , $ jsCodeIfTrue , $ jsCodeIfFalse = null , $ immediatly = false ) { return $ this -> js -> _condition ( $ condition , $ jsCodeIfTrue , $ jsCodeIfFalse , $ immediatly ) ; }
Allows to attach a condition