idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
52,400 | protected function mergeMvcConfig ( ServiceLocatorInterface $ serviceLocator , string $ requestedName = null ) { $ config = $ serviceLocator -> has ( 'config' ) ? $ serviceLocator -> get ( 'config' ) : [ ] ; if ( ! isset ( $ config [ 'bsb_flysystem' ] [ 'adapters' ] [ $ requestedName ] [ 'options' ] ) || ! is_array ( (... | Merges the options given from the ServiceLocator Config object with the create options of the class . |
52,401 | protected function hasRole ( array $ roles ) { if ( $ this -> has ( 'security.authorization_checker' ) && $ this -> get ( 'security.token_storage' ) -> getToken ( ) ) { $ checker = $ this -> get ( 'security.authorization_checker' ) ; foreach ( $ roles as $ role ) { if ( $ checker -> isGranted ( $ role ) ) { return true... | Checks if the used is authenticated and has the admin role |
52,402 | protected function initTwig ( \ Aimeos \ MW \ View \ Iface $ view , \ Twig_Environment $ twig ) { $ fcn = function ( $ key , $ default = null ) use ( $ view ) { return $ view -> config ( $ key , $ default ) ; } ; $ twig -> addFunction ( new \ Twig_SimpleFunction ( 'aiconfig' , $ fcn ) ) ; $ fcn = function ( $ singular ... | Adds the Aimeos template functions for Twig |
52,403 | public function get ( $ type = 'frontend' ) { $ configPaths = $ this -> container -> get ( 'aimeos' ) -> get ( ) -> getConfigPaths ( ) ; $ conf = new \ Aimeos \ MW \ Config \ PHPArray ( array ( ) , $ configPaths ) ; $ apc = ( bool ) $ this -> container -> getParameter ( 'aimeos_shop.apc_enable' ) ; $ prefix = $ this ->... | Returns the config object |
52,404 | public function getSalutation ( ) { return ( isset ( $ this -> salutation ) ? ( string ) $ this -> salutation : \ Aimeos \ MShop \ Common \ Item \ Address \ Base :: SALUTATION_UNKNOWN ) ; } | Returns the salutation constant for the person described by the address . |
52,405 | public function miniComponentAction ( ) { $ client = $ this -> container -> get ( 'shop' ) -> get ( 'basket/mini' ) ; $ this -> container -> get ( 'twig' ) -> addGlobal ( 'aiheader' , ( string ) $ client -> getHeader ( ) ) ; $ response = new Response ( ( string ) $ client -> getBody ( ) ) ; $ response -> headers -> set... | Returns the output of the basket mini component |
52,406 | public static function setupDatabase ( Event $ event ) { $ options = $ env = array ( ) ; if ( $ event -> isDevMode ( ) ) { $ options [ ] = '--option=setup/default/demo:1' ; } else { $ env [ ] = '--env=prod' ; } self :: executeCommand ( $ event , 'aimeos:setup' , $ options + $ env ) ; self :: executeCommand ( $ event , ... | Sets up the shop database . |
52,407 | public static function updateConfig ( Event $ event ) { $ event -> getIO ( ) -> write ( 'Ensure existing config and routing for the shop bundle' ) ; $ options = self :: getOptions ( $ event ) ; if ( isset ( $ options [ 'symfony-app-dir' ] ) ) { self :: updateConfigFile ( $ options [ 'symfony-app-dir' ] . '/config/confi... | Ensure existing config and routing for the shop bundle . |
52,408 | public static function installBundle ( Event $ event ) { $ event -> getIO ( ) -> write ( 'Installing the Aimeos shop bundle' ) ; $ options = self :: getOptions ( $ event ) ; $ securedir = 'var' ; if ( isset ( $ options [ 'symfony-app-dir' ] ) && is_dir ( $ options [ 'symfony-app-dir' ] ) ) { $ securedir = $ options [ '... | Installs the shop bundle . |
52,409 | protected static function createDirectory ( $ dir ) { $ perm = 0755 ; if ( ! is_dir ( $ dir ) && ! mkdir ( $ dir , $ perm , true ) ) { $ msg = 'Unable to create directory "%1$s" with permission "%2$s"' ; throw new \ RuntimeException ( sprintf ( $ msg , $ dir , $ perm ) ) ; } } | Creates a new directory if it doesn t exist yet |
52,410 | protected static function executeCommand ( Event $ event , $ cmd , array $ options = array ( ) ) { $ php = escapeshellarg ( self :: getPhp ( ) ) ; $ console = escapeshellarg ( self :: getConsoleDir ( $ event ) . '/console' ) ; $ cmd = escapeshellarg ( $ cmd ) ; foreach ( $ options as $ key => $ option ) { $ options [ $... | Executes a Symphony command . |
52,411 | protected static function updateConfigFile ( $ filename ) { if ( ( $ content = file_get_contents ( $ filename ) ) === false ) { throw new \ RuntimeException ( sprintf ( 'File "%1$s" not found' , $ filename ) ) ; } if ( self :: addAsseticBundle ( $ content ) === true ) { $ fs = new Filesystem ( ) ; $ fs -> dumpFile ( $ ... | Adds the Aimeos shop bundle to the config file of the application . |
52,412 | protected static function updateRoutingFile ( $ filename ) { $ content = '' ; if ( file_exists ( $ filename ) && ( $ content = file_get_contents ( $ filename ) ) === false ) { throw new \ RuntimeException ( sprintf ( 'File "%1$s" not readable' , $ filename ) ) ; } if ( strpos ( $ content , 'fos_user:' ) === false ) { $... | Adds the Aimeos shop bundle to the routing file of the application . |
52,413 | protected static function addAsseticBundle ( & $ content ) { if ( preg_match ( "/ bundles:[ ]*\[.*'AimeosShopBundle'.*\]/" , $ content ) !== 1 ) { $ search = array ( "/ bundles:[ ]*\[([^\]]+)\]/" , "/ bundles:[ ]*\[([ ]*)\]/" ) ; $ replace = array ( " bundles: [$1,'AimeosShopBundle']" , " bundles: ['Aime... | Adds the AimeosShopBundle to the assetic section of the config file |
52,414 | protected function getBareContext ( ) { $ ctx = new \ Aimeos \ MShop \ Context \ Item \ Standard ( ) ; $ conf = new \ Aimeos \ MW \ Config \ PHPArray ( array ( ) , array ( ) ) ; $ ctx -> setConfig ( $ conf ) ; $ locale = \ Aimeos \ MShop :: create ( $ ctx , 'locale' ) -> createItem ( ) ; $ locale -> setLanguageId ( 'en... | Returns a bare context object |
52,415 | public function selectComponentAction ( ) { $ shop = $ this -> container -> get ( 'shop' ) ; $ client = $ shop -> get ( 'locale/select' ) ; $ this -> container -> get ( 'twig' ) -> addGlobal ( 'aiheader' , ( string ) $ client -> getHeader ( ) ) ; return new Response ( ( string ) $ client -> getBody ( ) ) ; } | Returns the output of the locale select component |
52,416 | public function favoriteComponentAction ( ) { $ client = $ this -> container -> get ( 'shop' ) -> get ( 'account/favorite' ) ; $ this -> container -> get ( 'twig' ) -> addGlobal ( 'aiheader' , ( string ) $ client -> getHeader ( ) ) ; return new Response ( ( string ) $ client -> getBody ( ) ) ; } | Returns the output of the account favorite component |
52,417 | public function confirmAction ( ) { $ params = [ ] ; $ shop = $ this -> container -> get ( 'shop' ) ; foreach ( $ this -> container -> getParameter ( 'aimeos_shop.page' ) [ 'checkout-confirm' ] as $ name ) { $ params [ 'aiheader' ] [ $ name ] = $ shop -> get ( $ name ) -> getHeader ( ) ; $ params [ 'aibody' ] [ $ name ... | Returns the html for the checkout confirmation page . |
52,418 | public function exportAction ( Request $ request , $ resource , $ site = 'default' ) { $ cntl = $ this -> createAdmin ( $ request , $ site , $ resource ) ; if ( ( $ html = $ cntl -> export ( ) ) == '' ) { return $ cntl -> getView ( ) -> response ( ) ; } return $ this -> getHtml ( $ html ) ; } | Exports the requested resource object |
52,419 | public function getTasks ( ) { $ tasks = [ ] ; foreach ( $ this -> getKernelEvents ( ) as $ event ) { $ tasks [ ] = [ 'task' => $ this -> formatTask ( $ event ) , 'expression' => $ event -> expression , 'nextRunDate' => $ event -> nextRunDate ( ) -> format ( 'Y-m-d H:i:s' ) , 'description' => $ event -> description , '... | Get all formatted tasks . |
52,420 | protected function formatTask ( $ event ) { if ( $ event instanceof CallbackEvent ) { return [ 'type' => 'closure' , 'name' => 'Closure' , ] ; } if ( Str :: contains ( $ event -> command , '\'artisan\'' ) ) { $ exploded = explode ( ' ' , $ event -> command ) ; return [ 'type' => 'artisan' , 'name' => 'artisan ' . implo... | Format a giving task . |
52,421 | public function runTask ( $ id ) { set_time_limit ( 0 ) ; $ event = $ this -> getKernelEvents ( ) [ $ id - 1 ] ; $ event -> sendOutputTo ( $ this -> getOutputTo ( ) ) ; $ event -> run ( app ( ) ) ; return $ this -> readOutput ( ) ; } | Run specific task . |
52,422 | public function sendResponse ( $ pHttpCode = '200' , $ pMessage ) { $ suppressStatusCode = isset ( $ _GET [ '_suppress_status_code' ] ) ? $ _GET [ '_suppress_status_code' ] : false ; if ( $ this -> controller -> getHttpStatusCodes ( ) && ! $ suppressStatusCode && php_sapi_name ( ) !== 'cli' ) { $ status = self :: $ sta... | Sends the actual response . |
52,423 | public function getMethod ( ) { if ( $ this -> method ) { return $ this -> method ; } $ method = @ $ _SERVER [ 'REQUEST_METHOD' ] ; if ( isset ( $ _SERVER [ 'HTTP_X_HTTP_METHOD_OVERRIDE' ] ) ) $ method = $ _SERVER [ 'HTTP_X_HTTP_METHOD_OVERRIDE' ] ; if ( isset ( $ _GET [ '_method' ] ) ) $ method = $ _GET [ '_method' ] ... | Detect the method . |
52,424 | public function setupFormats ( ) { if ( isset ( $ _SERVER [ 'HTTP_ACCEPT' ] ) && strpos ( $ _SERVER [ 'HTTP_ACCEPT' ] , '*/*' ) === false ) { foreach ( $ this -> outputFormats as $ formatCode => $ formatMethod ) { if ( strpos ( $ _SERVER [ 'HTTP_ACCEPT' ] , $ formatCode ) !== false ) { $ this -> outputFormat = $ format... | Setup formats . |
52,425 | public function setClient ( $ pClient ) { if ( is_string ( $ pClient ) ) { $ pClient = new $ pClient ( $ this ) ; } $ this -> client = $ pClient ; $ this -> client -> setupFormats ( ) ; return $ this ; } | Sets the client . |
52,426 | public function sendBadRequest ( $ pCode , $ pMessage ) { if ( is_object ( $ pMessage ) && $ pMessage -> xdebug_message ) $ pMessage = $ pMessage -> xdebug_message ; $ msg = array ( 'error' => $ pCode , 'message' => $ pMessage ) ; if ( ! $ this -> getClient ( ) ) throw new \ Exception ( 'client_not_found_in_ServerContr... | Sends a Bad Request response to the client . |
52,427 | public function sendException ( $ pException ) { if ( $ this -> sendExceptionFn ) { call_user_func_array ( $ this -> sendExceptionFn , array ( $ pException ) ) ; } $ message = $ pException -> getMessage ( ) ; if ( is_object ( $ message ) && $ message -> xdebug_message ) $ message = $ message -> xdebug_message ; $ msg =... | Sends a exception response to the client . |
52,428 | public function setClass ( $ pClass ) { if ( is_string ( $ pClass ) ) { $ this -> createControllerClass ( $ pClass ) ; } elseif ( is_object ( $ pClass ) ) { $ this -> controller = $ pClass ; } else { $ this -> controller = $ this ; } } | Sets the controller class . |
52,429 | protected function createControllerClass ( $ pClassName ) { if ( $ pClassName != '' ) { try { if ( $ this -> controllerFactory ) { $ this -> controller = call_user_func_array ( $ this -> controllerFactory , array ( $ pClassName , $ this ) ) ; } else { $ this -> controller = new $ pClassName ( $ this ) ; } if ( get_pare... | Setup the controller class . |
52,430 | public function addSubController ( $ pTriggerUrl , $ pControllerClass = '' ) { $ this -> normalizeUrl ( $ pTriggerUrl ) ; $ base = $ this -> triggerUrl ; if ( $ base == '/' ) $ base = '' ; $ controller = new Server ( $ base . $ pTriggerUrl , $ pControllerClass , $ this ) ; $ this -> controllers [ ] = $ controller ; ret... | Attach a sub controller . |
52,431 | public function collectRoutes ( ) { if ( $ this -> collectRoutesExclude == '*' ) return $ this ; $ methods = get_class_methods ( $ this -> controller ) ; foreach ( $ methods as $ method ) { if ( in_array ( $ method , $ this -> collectRoutesExclude ) ) continue ; $ info = explode ( '/' , preg_replace ( '/([a-z]*)(([A-Z]... | Setup automatic routes . |
52,432 | public function simulateCall ( $ pUri , $ pMethod = 'get' ) { if ( ( $ idx = strpos ( $ pUri , '?' ) ) !== false ) { parse_str ( substr ( $ pUri , $ idx + 1 ) , $ _GET ) ; $ pUri = substr ( $ pUri , 0 , $ idx ) ; } $ this -> getClient ( ) -> setUrl ( $ pUri ) ; $ this -> getClient ( ) -> setMethod ( $ pMethod ) ; retur... | Simulates a HTTP Call . |
52,433 | public function describe ( $ pUri = null , $ pOnlyRoutes = false ) { $ definition = array ( ) ; if ( ! $ pOnlyRoutes ) { $ definition [ 'parameters' ] = array ( '_method' => array ( 'description' => 'Can be used as HTTP METHOD if the client does not support HTTP methods.' , 'type' => 'string' , 'values' => 'GET, POST, ... | Describe a route or the whole controller with all routes . |
52,434 | public function parsePhpDoc ( $ pString ) { preg_match ( '#^/\*\*(.*)\*/#s' , trim ( $ pString ) , $ comment ) ; if ( 0 === count ( $ comment ) ) return array ( ) ; $ comment = trim ( $ comment [ 1 ] ) ; preg_match_all ( '/^\s*\*(.*)/m' , $ comment , $ lines ) ; $ lines = $ lines [ 1 ] ; $ tags = array ( ) ; $ currentT... | Parse phpDoc string and returns an array . |
52,435 | public function argumentName ( $ pName ) { if ( ctype_lower ( substr ( $ pName , 0 , 1 ) ) && ctype_upper ( substr ( $ pName , 1 , 1 ) ) ) { return strtolower ( substr ( $ pName , 1 , 1 ) ) . substr ( $ pName , 2 ) ; } return $ pName ; } | If the name is a camelcased one whereas the first char is lowercased then we remove the first char and set first char to lower case . |
52,436 | protected function addScalar ( $ value ) { for ( $ row = 0 ; $ row < $ this -> rows ; ++ $ row ) { for ( $ column = 0 ; $ column < $ this -> columns ; ++ $ column ) { $ this -> matrix [ $ row ] [ $ column ] += $ value ; } } return $ this ; } | Execute the addition for a scalar |
52,437 | public function execute ( $ value ) { if ( is_array ( $ value ) ) { $ value = new Matrix ( $ value ) ; } if ( is_object ( $ value ) && ( $ value instanceof Matrix ) ) { try { $ value = Functions :: inverse ( $ value ) ; } catch ( Exception $ e ) { throw new Exception ( 'Division can only be calculated using a matrix wi... | Execute the division |
52,438 | protected function directSumMatrix ( Matrix $ value ) { $ originalColumnCount = count ( $ this -> matrix [ 0 ] ) ; $ originalRowCount = count ( $ this -> matrix ) ; $ additionalColumnCount = $ value -> columns ; $ additionalRowCount = $ value -> rows ; $ value = $ value -> toArray ( ) ; for ( $ row = 0 ; $ row < $ this... | Execute the direct sum for a matrix |
52,439 | protected function validateRowInRange ( $ row ) { $ row = static :: validateRow ( $ row ) ; if ( $ row > $ this -> rows ) { throw new Exception ( 'Requested Row exceeds matrix size' ) ; } return $ row ; } | Validate that a row number falls within the set of rows for this matrix |
52,440 | protected function validateColumnInRange ( $ column ) { $ column = static :: validateColumn ( $ column ) ; if ( $ column > $ this -> columns ) { throw new Exception ( 'Requested Column exceeds matrix size' ) ; } return $ column ; } | Validate that a column number falls within the set of columns for this matrix |
52,441 | public function getValue ( $ row , $ column ) { $ row = $ this -> validateRowInRange ( $ row ) ; $ column = $ this -> validateColumnInRange ( $ column ) ; return $ this -> grid [ $ row - 1 ] [ $ column - 1 ] ; } | Return a value from this matrix from the cell identified by the row and column numbers Note that row and column numbers start from 1 not from 0 |
52,442 | public function rows ( ) { foreach ( $ this -> grid as $ i => $ row ) { yield $ i + 1 => ( $ this -> columns == 1 ) ? $ row [ 0 ] : new static ( [ $ row ] ) ; } } | Returns a Generator that will yield each row of the matrix in turn as a vector matrix or the value of each cell if the matrix is a vector |
52,443 | public function columns ( ) { for ( $ i = 0 ; $ i < $ this -> columns ; ++ $ i ) { yield $ i + 1 => ( $ this -> rows == 1 ) ? $ this -> grid [ 0 ] [ $ i ] : new static ( array_column ( $ this -> grid , $ i ) ) ; } } | Returns a Generator that will yield each column of the matrix in turn as a vector matrix or the value of each cell if the matrix is a vector |
52,444 | private static function getCofactors ( Matrix $ matrix ) { $ cofactors = self :: getMinors ( $ matrix ) ; $ dimensions = $ matrix -> rows ; $ cof = 1 ; for ( $ i = 0 ; $ i < $ dimensions ; ++ $ i ) { $ cofs = $ cof ; for ( $ j = 0 ; $ j < $ dimensions ; ++ $ j ) { $ cofactors [ $ i ] [ $ j ] *= $ cofs ; $ cofs = - $ co... | Calculate the cofactors of the matrix |
52,445 | private static function getDeterminant ( Matrix $ matrix ) { $ dimensions = $ matrix -> rows ; if ( $ dimensions == 1 ) { return $ matrix -> getValue ( 1 , 1 ) ; } elseif ( $ dimensions == 2 ) { return $ matrix -> getValue ( 1 , 1 ) * $ matrix -> getValue ( 2 , 2 ) - $ matrix -> getValue ( 1 , 2 ) * $ matrix -> getValu... | Calculate the determinant of the matrix |
52,446 | public static function antidiagonal ( Matrix $ matrix ) { if ( ! $ matrix -> isSquare ( ) ) { throw new Exception ( 'Anti-Diagonal can only be extracted from a square matrix' ) ; } $ dimensions = $ matrix -> rows ; $ grid = Builder :: createFilledMatrix ( 0 , $ dimensions , $ dimensions ) -> toArray ( ) ; for ( $ i = 0... | Return the antidiagonal of this matrix |
52,447 | public static function inverse ( Matrix $ matrix ) { if ( ! $ matrix -> isSquare ( ) ) { throw new Exception ( 'Inverse can only be calculated for a square matrix' ) ; } $ determinant = self :: getDeterminant ( $ matrix ) ; if ( $ determinant == 0.0 ) { throw new Exception ( 'Inverse can only be calculated for a matrix... | Return the inverse of this matrix |
52,448 | protected static function getMinors ( Matrix $ matrix ) { $ minors = $ matrix -> toArray ( ) ; $ dimensions = $ matrix -> rows ; if ( $ dimensions == 1 ) { return $ minors ; } for ( $ i = 0 ; $ i < $ dimensions ; ++ $ i ) { for ( $ j = 0 ; $ j < $ dimensions ; ++ $ j ) { $ minors [ $ i ] [ $ j ] = self :: getDeterminan... | Calculate the minors of the matrix |
52,449 | public static function transpose ( Matrix $ matrix ) { $ grid = call_user_func_array ( 'array_map' , array_merge ( [ null ] , $ matrix -> toArray ( ) ) ) ; return new Matrix ( $ grid ) ; } | Return the transpose of this matrix |
52,450 | public function execute ( $ value ) { if ( is_array ( $ value ) ) { $ value = new Matrix ( $ value ) ; } if ( is_object ( $ value ) && ( $ value instanceof Matrix ) ) { return $ this -> subtractMatrix ( $ value ) ; } elseif ( is_numeric ( $ value ) ) { return $ this -> subtractScalar ( $ value ) ; } throw new Exception... | Execute the subtraction |
52,451 | protected function subtractScalar ( $ value ) { for ( $ row = 0 ; $ row < $ this -> rows ; ++ $ row ) { for ( $ column = 0 ; $ column < $ this -> columns ; ++ $ column ) { $ this -> matrix [ $ row ] [ $ column ] -= $ value ; } } return $ this ; } | Execute the subtraction for a scalar |
52,452 | protected function subtractMatrix ( Matrix $ value ) { $ this -> validateMatchingDimensions ( $ value ) ; for ( $ row = 0 ; $ row < $ this -> rows ; ++ $ row ) { for ( $ column = 0 ; $ column < $ this -> columns ; ++ $ column ) { $ this -> matrix [ $ row ] [ $ column ] -= $ value -> getValue ( $ row + 1 , $ column + 1 ... | Execute the subtraction for a matrix |
52,453 | public function execute ( $ value ) { if ( is_array ( $ value ) ) { $ value = new Matrix ( $ value ) ; } if ( is_object ( $ value ) && ( $ value instanceof Matrix ) ) { return $ this -> multiplyMatrix ( $ value ) ; } elseif ( is_numeric ( $ value ) ) { return $ this -> multiplyScalar ( $ value ) ; } throw new Exception... | Execute the multiplication |
52,454 | protected function multiplyScalar ( $ value ) { for ( $ row = 0 ; $ row < $ this -> rows ; ++ $ row ) { for ( $ column = 0 ; $ column < $ this -> columns ; ++ $ column ) { $ this -> matrix [ $ row ] [ $ column ] *= $ value ; } } return $ this ; } | Execute the multiplication for a scalar |
52,455 | protected function multiplyMatrix ( Matrix $ value ) { $ this -> validateReflectingDimensions ( $ value ) ; $ newRows = $ this -> rows ; $ newColumns = $ value -> columns ; $ matrix = Builder :: createFilledMatrix ( 0 , $ newRows , $ newColumns ) -> toArray ( ) ; for ( $ row = 0 ; $ row < $ newRows ; ++ $ row ) { for (... | Execute the multiplication for a matrix |
52,456 | public static function createFilledMatrix ( $ value , $ rows , $ columns = null ) { if ( $ columns === null ) { $ columns = $ rows ; } $ rows = Matrix :: validateRow ( $ rows ) ; $ columns = Matrix :: validateColumn ( $ columns ) ; return new Matrix ( array_fill ( 0 , $ rows , array_fill ( 0 , $ columns , $ value ) ) )... | Create a new matrix of specified dimensions and filled with a specified value If the column argument isn t provided then a square matrix will be created |
52,457 | public static function createIdentityMatrix ( $ dimensions ) { $ grid = static :: createFilledMatrix ( null , $ dimensions ) -> toArray ( ) ; for ( $ x = 0 ; $ x < $ dimensions ; ++ $ x ) { $ grid [ $ x ] [ $ x ] = 1 ; } return new Matrix ( $ grid ) ; } | Create a new identity matrix of specified dimensions This will always be a square matrix with the number of rows and columns matching the provided dimension |
52,458 | public function getHydratorClass ( ) : string { $ inflector = $ this -> configuration -> getClassNameInflector ( ) ; $ realClassName = $ inflector -> getUserClassName ( $ this -> configuration -> getHydratedClassName ( ) ) ; $ hydratorClassName = $ inflector -> getGeneratedClassName ( $ realClassName , [ 'factory' => s... | Retrieves the generated hydrator FQCN |
52,459 | private function createData ( ) : void { $ this -> data = [ 'foo' => 'some foo string' , 'bar' => 42 , 'baz' => new DateTime ( ) , 'someFooProperty' => [ 12 , 13 , 14 ] , 'someBarProperty' => 12354.4578 , 'someBazProperty' => new stdClass ( ) , 'foo1' => 'some foo string' , 'bar1' => 42 , 'baz1' => new DateTime ( ) , '... | Populate test data array |
52,460 | protected function createHydrator ( string $ class ) : void { $ config = new Configuration ( $ class ) ; $ hydratorClass = $ config -> createFactory ( ) -> getHydratorClass ( ) ; $ this -> hydrator = new $ hydratorClass ( ) ; } | Create and set the hydrator |
52,461 | public function extract ( array $ scopes , array $ claims ) { $ claimData = [ ] ; $ keys = array_keys ( $ claims ) ; foreach ( $ scopes as $ scope ) { $ scopeName = ( $ scope instanceof ScopeEntityInterface ) ? $ scope -> getIdentifier ( ) : $ scope ; $ claimSet = $ this -> getClaimSet ( $ scopeName ) ; if ( null === $... | For given scopes and aggregated claims get all claims that have been configured on the extractor . |
52,462 | protected function getBestMaskPattern ( ) : int { $ penalties = [ ] ; for ( $ pattern = 0 ; $ pattern < 8 ; $ pattern ++ ) { $ tester = new MaskPatternTester ( $ this -> dataInterface -> initMatrix ( $ pattern , true ) ) ; $ penalties [ $ pattern ] = $ tester -> testPattern ( ) ; } return \ array_search ( \ min ( $ pen... | shoves a QRMatrix through the MaskPatternTester to find the lowest penalty mask pattern |
52,463 | public function isKanji ( string $ string ) : bool { $ i = 0 ; $ len = \ strlen ( $ string ) ; while ( $ i + 1 < $ len ) { $ c = ( ( 0xff & \ ord ( $ string [ $ i ] ) ) << 8 ) | ( 0xff & \ ord ( $ string [ $ i + 1 ] ) ) ; if ( ! ( $ c >= 0x8140 && $ c <= 0x9FFC ) && ! ( $ c >= 0xE040 && $ c <= 0xEBBF ) ) { return false... | checks if a string qualifies as Kanji |
52,464 | private function isConditionalComment ( $ comment ) : bool { if ( \ preg_match ( '/^\[if [^\]]+\]/' , $ comment ) ) { return true ; } if ( \ preg_match ( '/\[endif\]$/' , $ comment ) ) { return true ; } return false ; } | Check if the current string is an conditional comment . |
52,465 | private function protectTags ( HtmlDomParser $ dom ) : HtmlDomParser { $ counter = 0 ; foreach ( $ dom -> find ( 'script, style' ) as $ element ) { if ( $ element -> tag === 'script' || $ element -> tag === 'style' ) { $ attributes = $ element -> getAllAttributes ( ) ; if ( isset ( $ attributes [ 'src' ] ) ) { continue... | Prevent changes of inline styles and scripts . |
52,466 | private function removeComments ( HtmlDomParser $ dom ) : HtmlDomParser { foreach ( $ dom -> find ( '//comment()' ) as $ commentWrapper ) { $ comment = $ commentWrapper -> getNode ( ) ; $ val = $ comment -> nodeValue ; if ( \ strpos ( $ val , '[' ) === false ) { $ comment -> parentNode -> removeChild ( $ comment ) ; } ... | Remove comments in the dom . |
52,467 | private function removeWhitespaceAroundTags ( SimpleHtmlDom $ element ) { if ( isset ( self :: $ trimWhitespaceFromTags [ $ element -> tag ] ) ) { $ node = $ element -> getNode ( ) ; $ candidates = [ ] ; if ( $ node -> childNodes -> length > 0 ) { $ candidates [ ] = $ node -> firstChild ; $ candidates [ ] = $ node -> l... | Trim tags in the dom . |
52,468 | private function sumUpWhitespace ( HtmlDomParser $ dom ) : HtmlDomParser { $ text_nodes = $ dom -> find ( '//text()' ) ; foreach ( $ text_nodes as $ text_node_wrapper ) { $ text_node = $ text_node_wrapper -> getNode ( ) ; $ xp = $ text_node -> getNodePath ( ) ; $ doSkip = false ; foreach ( self :: $ skipTagsForRemoveWh... | Sum - up extra whitespace from dom - nodes . |
52,469 | public function domElementAfterMinification ( SimpleHtmlDom $ element , HtmlMin $ htmlMin ) { $ attributes = $ element -> getAllAttributes ( ) ; if ( $ attributes === null ) { return ; } $ attrs = [ ] ; foreach ( ( array ) $ attributes as $ attrName => $ attrValue ) { if ( $ htmlMin -> isDoRemoveHttpPrefixFromAttribute... | Receive dom elements after the minification . |
52,470 | private function removeAttributeHelper ( $ tag , $ attrName , $ attrValue , $ allAttr , HtmlMin $ htmlMin ) : bool { if ( $ htmlMin -> isDoRemoveDefaultAttributes ( ) ) { if ( $ tag === 'script' && $ attrName === 'language' && $ attrValue === 'javascript' ) { return true ; } if ( $ tag === 'form' && $ attrName === 'met... | Check if the attribute can be removed . |
52,471 | public function setCryptoAlgorithm ( $ algo ) { if ( ! array_key_exists ( $ algo , $ this -> digestSignatureAlgoMapping ) ) { trigger_error ( 'The chosen crypto algorithm does not appear to be predefined' , E_USER_WARNING ) ; } else if ( ! array_key_exists ( $ this -> digestMethod , $ this -> digestSignatureAlgoMapping... | Sets the cryptography algorithm used to generate the private key . |
52,472 | public function setCanonicalMethod ( $ method ) { if ( array_key_exists ( $ method , $ this -> c14nOptionMapping ) ) { $ this -> canonicalMethod = $ method ; } else { trigger_error ( sprintf ( 'The chosen canonical method (%s) is not supported' , $ method ) , E_USER_WARNING ) ; } return $ this ; } | Sets the canonical method used to canonicalize the document |
52,473 | public function loadPrivateKey ( $ key , $ passphrase = null , $ isFile = true ) { return $ this -> loadKey ( $ key , $ isFile , true , $ passphrase ) ; } | Loads a PEM formatted private key . |
52,474 | protected function loadFile ( $ filePath ) { if ( ! file_exists ( $ filePath ) || ! is_readable ( $ filePath ) ) { throw new \ UnexpectedValueException ( sprintf ( 'Unable to open the "%s" file' , $ filePath ) ) ; } $ key = @ file_get_contents ( $ filePath ) ; if ( ! is_string ( $ key ) || 0 === strlen ( $ key ) ) { th... | Loads a key from a specified file location . |
52,475 | public function loadPublicXmlKey ( $ publicKey , $ isFile = true , $ objectId = null ) { if ( true === $ isFile ) { try { $ publicKey = $ this -> loadFile ( $ publicKey ) ; } catch ( \ UnexpectedValueException $ e ) { throw $ e ; } } $ keyNode = null ; if ( is_string ( $ publicKey ) && strlen ( $ publicKey ) ) { $ keyN... | Loads a public key in an XML format . |
52,476 | protected function appendXmlPublicKey ( \ DOMDocument $ keyDoc , $ objectId ) { if ( is_null ( $ this -> doc ) ) { $ this -> createXmlStructure ( ) ; } $ keyValue = $ this -> doc -> getElementsByTagName ( $ this -> nodeNsPrefix . 'KeyValue' ) -> item ( 0 ) ; if ( is_null ( $ keyValue ) ) { throw new \ UnexpectedValueEx... | Appends the public XML key to the DOM document . |
52,477 | public function sign ( ) { if ( is_null ( $ this -> doc ) ) { return new \ UnexpectedValueException ( 'No document structure to sign' ) ; } $ signedInfo = $ this -> doc -> getElementsByTagName ( $ this -> nodeNsPrefix . 'SignedInfo' ) -> item ( 0 ) ; if ( is_null ( $ signedInfo ) ) { throw new \ UnexpectedValueExceptio... | Signs the XML document with an XML digital signature |
52,478 | public function verify ( ) { if ( is_null ( $ this -> publicKey ) ) { trigger_error ( 'Cannot verify XML digital signature without public key' , E_USER_WARNING ) ; return false ; } $ signedInfo = $ this -> doc -> getElementsByTagName ( $ this -> nodeNsPrefix . 'SignedInfo' ) -> item ( 0 ) ; if ( is_null ( $ signedInfo ... | Verifies the XML digital signature |
52,479 | protected function createXmlStructure ( ) { $ this -> doc = new \ DOMDocument ( '1.0' , 'UTF-8' ) ; $ this -> doc -> xmlStandalone = $ this -> standalone ; $ signature = $ this -> doc -> createElementNS ( self :: XML_DSIG_NS , $ this -> nodeNsPrefix . 'Signature' ) ; $ this -> doc -> appendChild ( $ signature ) ; $ sig... | Prepares the XML skeleton structure for the signature |
52,480 | protected function canonicalize ( \ DOMNode $ object ) { $ options = $ this -> c14nOptionMapping [ $ this -> canonicalMethod ] ; $ c14nData = $ object -> C14N ( $ options [ 'exclusive' ] , $ options [ 'withComments' ] ) ; if ( is_string ( $ c14nData ) && strlen ( $ c14nData ) ) { return $ c14nData ; } throw new \ Unexp... | Canonicalizes a DOM document or a single DOM node |
52,481 | public function addObject ( $ data , $ objectId = null , $ digestObject = false ) { if ( is_null ( $ this -> doc ) ) { $ this -> createXmlStructure ( ) ; } if ( is_string ( $ data ) && strlen ( $ data ) ) { $ data = $ this -> doc -> createTextNode ( $ data ) ; } else if ( ! is_object ( $ data ) || ! $ data instanceof \... | Appends an object to the signed XML documents |
52,482 | protected function checkDigestSupport ( ) { if ( ! in_array ( $ this -> digestMethod , hash_algos ( ) ) ) { trigger_error ( sprintf ( 'This installation of PHP does not support the %s hashing algorithm' , $ this -> digestMethod ) , E_USER_ERROR ) ; } } | Ensures that the current installation of PHP supports the selected digest method . If it does not a fatal error is triggered . |
52,483 | private function getConfigVariable ( $ var , $ default = null ) { if ( preg_match ( "/^SW_/" , $ var ) ) { $ var = strtolower ( preg_replace ( "/SW_/" , "" , $ var ) ) ; } if ( isset ( $ this -> variables [ "config" ] [ $ var ] ) ) { return $ this -> variables [ "config" ] [ $ var ] ; } else { if ( defined ( "SW_" . st... | Return the value of a config variable |
52,484 | private function isSetConfigVariable ( $ var ) { if ( preg_match ( "/^SW_/" , $ var ) ) { $ var = strtolower ( preg_replace ( "/SW_/" , "" , $ var ) ) ; } if ( defined ( "SW_" . strtoupper ( $ var ) ) ) { return true ; } if ( isset ( $ this -> variables [ "config" ] [ $ var ] ) ) { return true ; } else { return false ;... | Check if a config variable is defined |
52,485 | static function handleDebug ( $ dbgstr , $ in_level ) { if ( ReporticoApp :: get ( "debug_mode" ) >= $ in_level ) { $ debug = & self :: getSystemDebug ( ) ; $ debug [ ] = array ( "dbgstr" => $ dbgstr , "dbgarea" => ReporticoApp :: get ( "code_area" ) ) ; } } | Debug Message Handler |
52,486 | static function handleError ( $ errstr , $ type = E_USER_ERROR ) { self :: set ( "errors" , true ) ; trigger_error ( $ errstr , $ type ) ; } | User Error Handler |
52,487 | public function helpPath ( $ section , $ field = false ) { $ fieldtag = $ field ; if ( isset ( $ this -> field_display [ "$field" ] ) && isset ( $ this -> field_display [ "$field" ] [ "DocId" ] ) ) { $ fieldtag = $ this -> field_display [ "$field" ] [ "DocId" ] ; } $ path = $ this -> query -> url_doc_site . "/" . $ thi... | Generate link to help for specific field |
52,488 | public function drawSelectFileList ( $ path , $ filematch , $ showtag , $ preselectedvalue , $ addblank , $ translateoptions , $ fieldtype = "set" ) { $ keys = array ( ) ; $ keys [ ] = "" ; if ( $ showtag ) { $ showtag = "_" . $ showtag ; } if ( is_dir ( $ this -> query -> reports_path ) ) { $ testpath = $ this -> quer... | Creates select list box from a directory file list |
52,489 | public function isShowing ( $ in_tag ) { $ container = $ this -> show_area ; $ containee = $ in_tag ; $ ret = false ; $ match = "/^" . $ containee . "/" ; if ( preg_match ( $ match , $ container ) ) { $ ret = true ; } $ match = "/qcol....form$/" ; if ( ! $ ret && preg_match ( $ match , $ containee ) ) { $ ret = true ; ... | id ends in qcolXXXXXform then its true as well |
52,490 | static function findFileToInclude ( $ file_path , & $ new_file_path , & $ rel_to_include = "" ) { static $ _path_array = null ; if ( __DIR__ ) { $ selfdir = dirname ( __DIR__ ) ; $ new_file_path = $ selfdir . "/" . $ file_path ; $ old_error_handler = set_error_handler ( "Reportico\Engine\ReporticoApp::ErrorHandler" , 0... | Look for a file in the include path or the path of the current source file |
52,491 | static function PathExecutable ( $ in_path ) { $ perms = fileperms ( $ in_path ) ; if ( ! is_dir ( $ in_path ) ) { return false ; } if ( ! strtoupper ( substr ( PHP_OS , 0 , 3 ) ) === 'WIN' && is_executable ( $ in_path ) ) { return false ; } if ( ! is_writeable ( $ in_path ) ) { return false ; } return true ; } | Is path executable and writeable? |
52,492 | static function findBestUrlInIncludePath ( $ path ) { $ newpath = $ path ; $ reltoinclude ; $ found = self :: findFileToInclude ( $ newpath , $ newpath , $ reltoinclude ) ; $ newpath = self :: getRelativePath ( str_replace ( "/" , "\\" , realpath ( $ newpath ) ) , dirname ( __DIR__ ) ) ; if ( ! $ found ) { return false... | of a file path |
52,493 | static function buildForwardUrlGetParams ( $ path , $ forward_url_get_params , $ remainder ) { $ urlpath = findBestLocationInIncludePath ( $ path ) ; if ( $ forward_url_get_params || $ remainder ) { $ urlpath .= "?" ; } if ( $ forward_url_get_params ) { $ urlpath .= $ forward_url_get_params ; } if ( $ remainder ) { $ u... | 2 - extra GET parameters |
52,494 | static function getReporticoUrlPath ( ) { $ sessionClass = ReporticoSession ( ) ; $ newpath = __DIR__ ; $ newpath = ReporticoUtility :: getRelativePath ( str_replace ( "/" , "\\" , realpath ( $ newpath ) ) , dirname ( realpath ( $ _SERVER [ "SCRIPT_FILENAME" ] ) ) ) ; $ above = dirname ( $ _SERVER [ "SCRIPT_NAME" ] ) ;... | This can be used to then find reportico images links runners etc |
52,495 | static function getRelativePath ( $ path , $ compareTo ) { if ( preg_match ( "/\\\/" , $ compareTo ) || preg_match ( "/^[A-Za-z]:/" , $ compareTo ) ) { $ compareTo = strtolower ( $ compareTo ) ; $ path = strtolower ( $ path ) ; } $ path = preg_replace ( "+\\\+" , "/" , $ path ) ; $ compareTo = preg_replace ( "+\\\+" , ... | of the calling script so we can get the relative location |
52,496 | static function columnNameToLabel ( $ columnname ) { $ retstring = str_replace ( "_" , " " , $ columnname ) ; if ( ! function_exists ( "mb_strtolower" ) ) { $ retstring = ucwords ( strtolower ( $ retstring ) ) ; } else { $ retstring = ucwords ( mb_strtolower ( $ retstring , ReporticoLocale :: outputCharsetToPhpCharset ... | initial letter of each word |
52,497 | public function pdoDriverExists ( $ in_driver ) { $ drivers = PDO :: getAvailableDrivers ( ) ; $ found = false ; foreach ( $ drivers as $ v ) { if ( $ v == $ in_driver ) { $ found = true ; break ; } } return $ found ; } | Checks if request pdo driver exists |
52,498 | public function applyRowBorderToCell ( ) { if ( isset ( $ this -> row_styles [ "border-width" ] ) && $ this -> row_styles [ "border-width" ] ) { $ cellstyle = $ this -> cell_styles [ "border-width" ] ; if ( ! $ cellstyle ) { $ cellstyle = $ this -> allcell_styles [ "border-width" ] ; } $ rowstyle = $ this -> row_styles... | first column of a row has parent row with border |
52,499 | public function disableStyleTag ( $ styleset , $ tag ) { foreach ( $ styleset as $ k => $ v ) { if ( isset ( $ this -> stylestack [ $ k ] ) && $ k == $ tag ) { unset ( $ this -> stylestack [ $ k ] ) ; } } } | Removes a tag element from the style stack |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.