idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
12,500 | private function get ( string $ tag , string $ memberof = '' , bool $ grouped = true ) { if ( empty ( $ this -> parsed ) ) { $ this -> parse ( ) ; } if ( ! empty ( $ this -> parsed ) ) { $ res = [ ] ; foreach ( $ this -> parsed as $ p ) { if ( ! empty ( $ p [ 'tags' ] ) && ( ( $ i = \ bbn \ x :: find ( $ p [ 'tags' ] ,... | Parses the parsed array to get an array of the given tag |
12,501 | private function get_components ( string $ memberof = '' ) { $ res = [ ] ; if ( $ components = $ this -> get ( 'component' , $ memberof ) ) { foreach ( $ components as $ comp ) { if ( ! empty ( $ comp [ 'name' ] ) ) { $ res [ ] = array_merge ( $ comp , $ this -> get_vue ( $ comp [ 'name' ] ) ) ; } } } return $ res ; } | Gets an array of component tags |
12,502 | public function set_source ( string $ src ) { $ this -> source = is_file ( $ src ) ? file_get_contents ( $ src ) : $ src ; $ this -> parsed = [ ] ; return $ this ; } | Sets the source to parse |
12,503 | public function set_mode ( string $ mode ) { if ( ! empty ( $ mode ) && in_array ( $ mode , $ this -> modes ) ) { $ this -> mode = $ mode ; return $ this ; } die ( _ ( 'Error: mode not allowed.' ) ) ; } | Sets the mode |
12,504 | public function parse ( ) { preg_match_all ( $ this -> pattern [ 'start' ] , $ this -> source , $ matches , PREG_OFFSET_CAPTURE ) ; if ( isset ( $ matches [ 0 ] ) ) { foreach ( $ matches [ 0 ] as $ match ) { preg_match ( $ this -> pattern [ 'end' ] , $ this -> source , $ mat , PREG_OFFSET_CAPTURE , $ match [ 1 ] ) ; $ ... | Parses the current source |
12,505 | public function parse_docblock ( string $ block ) { $ b = [ 'description' => '' , 'tags' => [ ] ] ; $ block = trim ( substr ( $ block , 0 , strlen ( $ block ) - 2 ) ) ; $ tags = $ this -> get_tags ( $ block ) ; foreach ( $ tags as $ i => $ tag ) { if ( ( isset ( $ tags [ $ i + 1 ] ) && ( $ t = $ this -> parse_tag ( sub... | Parses a given docblock |
12,506 | public function get_vue ( string $ memberof = '' ) { return [ 'description' => $ this -> get_file ( $ memberof ) , 'methods' => $ this -> get_methods ( $ memberof ) , 'events' => $ this -> get_events ( $ memberof ) , 'mixins' => $ this -> get_mixins ( $ memberof ) , 'props' => $ this -> get_props ( $ memberof ) , 'data... | Gets Vue . js structure |
12,507 | public function formatBillingAddress ( ClientBillingAddress $ address , $ lineSeparator = self :: LINES_SEPARATOR ) { $ lines = [ ] ; $ lines [ ] = sprintf ( '%s %s' , $ address -> getFirstName ( ) , $ address -> getLastName ( ) ) ; if ( '' !== $ address -> getCompanyName ( ) ) { $ lines [ ] = $ address -> getCompanyNa... | Formats the billing address |
12,508 | public function getStringToSign ( RequestInterface $ request , $ timestamp , $ nonce ) { $ params = $ this -> getParamsToSign ( $ request , $ timestamp , $ nonce ) ; $ params = $ this -> prepareParameters ( $ params ) ; $ parameterString = new QueryString ( $ params ) ; $ url = Url :: factory ( $ request -> getUrl ( ) ... | Calculate string to sign |
12,509 | public function getParamsToSign ( RequestInterface $ request , $ timestamp , $ nonce ) { $ params = new Collection ( array ( 'oauth_consumer_key' => $ this -> config [ 'consumer_key' ] , 'oauth_nonce' => $ nonce , 'oauth_signature_method' => $ this -> config [ 'signature_method' ] , 'oauth_timestamp' => $ timestamp , '... | Parameters sorted and filtered in order to properly sign a request |
12,510 | public function cache_driver ( ) { if ( ! $ this -> _cache ) { $ adapter = new DCache_Adapter \ File ( realpath ( __DIR__ . '../../../' . static :: CACHE_DIR ) ) ; $ adapter -> setOption ( 'ttl' , static :: CACHE_LIFETIME ) ; $ this -> _cache = new DCache \ Cache ( $ adapter ) ; } return $ this -> _cache ; } | Get an instance of the cache helper |
12,511 | public function signalToEvent ( $ signal ) { if ( $ this -> pid == ProcessTools :: getPid ( ) ) { $ signame = $ this -> signals -> signame ( $ signal ) ; $ this -> logger -> debug ( "Received $signame ($signal) signal, firing associated event(s)" ) ; $ this -> events -> emit ( new PosixEvent ( $ signal , $ this ) ) ; $... | The generic signal handler . |
12,512 | private function getMinInConfiguration ( $ val1 , $ val2 ) { if ( $ val1 && $ val2 ) { return min ( array ( $ val1 , $ val2 ) ) ; } if ( $ val1 ) { return $ val1 ; } if ( $ val2 ) { return $ val2 ; } return null ; } | Get the min in 2 values if there exist . |
12,513 | private static function iniGetBytes ( $ val ) { $ val = trim ( ini_get ( $ val ) ) ; if ( $ val != '' ) { $ last = strtolower ( $ val { strlen ( $ val ) - 1 } ) ; } else { $ last = '' ; } $ val = ( int ) $ val ; switch ( $ last ) { case 'g' : $ val *= 1024 ; case 'm' : $ val *= 1024 ; case 'k' : $ val *= 1024 ; } retur... | Returns the number of bytes from php . ini parameter . |
12,514 | public function requestAsync ( $ url , $ method = 'GET' , $ data = [ ] ) { $ stack = HandlerStack :: create ( ) ; $ stack -> push ( ApiMiddleware :: auth ( ) ) ; $ client = new Client ( [ 'handler' => $ stack ] ) ; $ promise = $ client -> requestAsync ( $ method , $ url , [ 'headers' => [ 'Authorization' => 'Bearer ' .... | Guzzle async request |
12,515 | public function requestCurl ( $ url , $ method = 'GET' , $ data = [ ] ) { $ data_string = json_encode ( $ data ) ; $ ch = curl_init ( $ url ) ; curl_setopt ( $ ch , CURLOPT_CUSTOMREQUEST , $ method ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , $ data_string ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; cur... | Curl request - instead of Guzzle |
12,516 | public function parseBody ( $ line ) { $ this -> parseHeader ( $ line , $ this -> headers ) ; $ this -> size += strlen ( $ line ) ; } | Parses each line of the mail part . |
12,517 | public function finish ( ) { unset ( $ this -> part -> recipients [ $ this -> section - 1 ] ) ; $ this -> part -> size = $ this -> size ; return $ this -> part ; } | Returns the ezcMailDeliveryStatus part corresponding to the parsed message . |
12,518 | public function addEntityDirectory ( $ namespace , $ directory ) { if ( ! is_dir ( $ directory ) ) { return ; } $ files = new \ DirectoryIterator ( $ directory ) ; foreach ( $ files as $ file ) { if ( $ file -> isDir ( ) && ! $ file -> isDot ( ) ) { $ this -> addEntityDirectory ( $ namespace . '\\' . basename ( $ file ... | Add all entity classes in a directory . |
12,519 | public static function __createOutput ( $ printerId ) { $ Printer = ClassRegistry :: init ( "Printers.Printer" ) ; $ Printer -> recursive = - 1 ; $ printer = $ Printer -> read ( null , $ printerId ) ; if ( empty ( $ printer [ 'Printer' ] [ 'output' ] ) ) { return false ; } $ outputName = $ printer [ 'Printer' ] [ 'outp... | Gets the name of the printer engine |
12,520 | public static function _loadPrinterOutput ( $ outputType ) { $ outputType = ucfirst ( strtolower ( $ outputType ) ) ; $ printerOutputName = $ outputType . "PrinterOutput" ; App :: uses ( $ printerOutputName , "Printers.PrinterOutput" ) ; self :: $ PrinterOutput = new $ printerOutputName ( ) ; } | Instanciates an Engine for change Output Printing |
12,521 | public static function getView ( PrintaitorViewObj $ printViewObj ) { $ data = $ printViewObj -> dataToView ; $ printer_id = $ printViewObj -> printerId ; $ templateName = $ printViewObj -> viewName ; if ( empty ( $ printer_id ) ) { return - 1 ; } $ pluginPath = App :: path ( 'Lib' , 'Printers' ) ; $ driverName = $ pri... | Logic for creating the view rendered . |
12,522 | public function search ( $ place , $ limit = 40 , $ clientIp = null ) { $ parameters = array ( 'sort' => 'closeness' , 'name' => $ place , 'limit' => $ limit , ) ; if ( $ clientIp ) { $ parameters [ 'client-ip' ] = $ clientIp ; } $ result = $ this -> get ( 'city' , $ parameters ) ; return array_map ( function ( $ geona... | Search for a place by its name . |
12,523 | private function get ( $ endPoint , array $ queryParameters = array ( ) ) { $ request = $ this -> client -> get ( $ this -> serverUri . $ endPoint , array ( 'accept' => 'application/json' ) ) ; foreach ( $ queryParameters as $ key => $ value ) { $ request -> getQuery ( ) -> add ( $ key , $ value ) ; } try { $ result = ... | Executes a GET HTTP query . |
12,524 | protected function getFilenames ( Collection $ files ) { $ paths = $ files -> getFilenames ( ) ; if ( count ( $ paths ) < 1 ) { throw new FilesNotFoundException ( ) ; } $ this -> log ( 'Starting to process ' . count ( $ paths ) . ' files' ) ; return $ paths ; } | Extract all filenames from the given collection and output the amount of files . |
12,525 | protected function parseFileIntoDescriptor ( ProjectDescriptorBuilder $ builder , $ filename ) { $ parser = new File ( $ this ) ; $ parser -> parse ( $ filename , $ builder ) ; } | Parses a file and creates a Descriptor for it in the project . |
12,526 | protected function logAfterParsingAFile ( $ memory ) { if ( ! $ this -> stopwatch ) { return $ memory ; } $ lap = $ this -> stopwatch -> lap ( 'parser.parse' ) ; $ oldMemory = $ memory ; $ periods = $ lap -> getPeriods ( ) ; $ memory = end ( $ periods ) -> getMemory ( ) ; $ this -> log ( '>> Memory after processing of ... | Collects the time and duration of processing a file logs it and returns the new amount of memory in use . |
12,527 | public function serverGetByName ( $ name ) { foreach ( $ this -> serverList ( ) as $ server ) { if ( $ server [ "virtualserver_name" ] == $ name ) return $ server ; } throw new Exception ( "invalid serverID" , 0x400 ) ; } | Returns the first Server object matching the given name . |
12,528 | public function serverGetByUid ( $ uid ) { foreach ( $ this -> serverList ( ) as $ server ) { if ( $ server [ "virtualserver_unique_identifier" ] == $ uid ) return $ server ; } throw new Exception ( "invalid serverID" , 0x400 ) ; } | Returns the first Server object matching the given unique identifier . |
12,529 | public function permissionList ( ) { if ( $ this -> permissionList === null ) { $ this -> fetchPermissionList ( ) ; } foreach ( $ this -> permissionList as $ permname => $ permdata ) { if ( isset ( $ permdata [ "permcatid" ] ) && $ permdata [ "permgrant" ] ) { continue ; } $ this -> permissionList [ $ permname ] [ "per... | Returns a list of permissions available on the server instance . |
12,530 | public function execute ( ) { $ output = [ ] ; $ code = 0 ; exec ( sprintf ( $ this -> command , $ this -> hgPath , $ this ) . " 2>&1" , $ output , $ code ) ; if ( $ code != 0 ) { throw new \ RuntimeException ( 'An error occurred while using VersionControl_HG; hg returned: ' . implode ( PHP_EOL , $ output ) , $ code ) ... | Execute mercurial command . |
12,531 | protected function assembleOptionString ( ) { $ optionString = '' ; foreach ( $ this -> options as $ name => $ option ) { if ( $ option === true ) { $ optionString .= " {$name}" ; } elseif ( is_string ( $ option ) && $ option !== '' ) { $ optionString .= " {$name} " . escapeshellarg ( $ option ) ; } elseif ( is_array (... | Concatinates string options . |
12,532 | private function getCommandName ( ) { $ className = implode ( '' , array_slice ( explode ( '\\' , get_class ( $ this ) ) , - 1 ) ) ; $ commandName = str_replace ( 'command' , '' , strtolower ( $ className ) ) ; return $ commandName ; } | Returns the concrete commands name . |
12,533 | public function install ( WorkerInterface $ worker , $ looptime = 1 , $ forever = false ) { $ name = $ worker -> getName ( ) ; if ( $ this -> isInstalled ( $ name ) ) { throw new Exception ( "Worker already installed" ) ; } $ w = Worker :: create ( ) -> setInstance ( $ worker ) -> setLooptime ( $ looptime ) -> setForev... | Install a worker into the stack |
12,534 | public function generateSlug ( $ title ) { $ title = strtolower ( $ title ) ; $ title = preg_replace ( '/[^%a-z0-9 _-]/' , '' , $ title ) ; $ title = preg_replace ( '/\s+/' , '-' , $ title ) ; $ title = preg_replace ( '|-+|' , '-' , $ title ) ; $ title = trim ( $ title , '-' ) ; return $ title ; } | Generate an appropriate slug from a title This function will turn a title into a lowercase and hyphenated title that is compatible with how Sculpin expects slugs . |
12,535 | protected function entityReferenceSearch ( $ value , $ entity ) { if ( ! is_array ( $ value ) && ! ( $ value instanceof Traversable ) ) { return false ; } if ( ! isset ( $ entity ) ) { throw new Exceptions \ InvalidParametersException ( ) ; } if ( is_array ( $ entity ) ) { foreach ( $ entity as & $ curEntity ) { if ( i... | Search through a value for an entity reference . |
12,536 | protected function pullCache ( $ guid , $ className ) { if ( ! isset ( $ this -> entityCount [ $ guid ] ) ) { $ this -> entityCount [ $ guid ] = 0 ; } $ this -> entityCount [ $ guid ] ++ ; if ( isset ( $ this -> entityCache [ $ guid ] [ $ className ] ) ) { return ( clone $ this -> entityCache [ $ guid ] [ $ className ]... | Pull an entity from the cache . |
12,537 | protected function pushCache ( & $ entity , $ className ) { if ( ! isset ( $ entity -> guid ) ) { return ; } if ( ! isset ( $ this -> entityCount [ $ entity -> guid ] ) ) { $ this -> entityCount [ $ entity -> guid ] = 0 ; } $ this -> entityCount [ $ entity -> guid ] ++ ; if ( $ this -> entityCount [ $ entity -> guid ] ... | Push an entity onto the cache . |
12,538 | protected function sortProperty ( $ a , $ b ) { $ property = $ this -> sortProperty ; $ parent = $ this -> sortParent ; if ( isset ( $ parent ) && ( isset ( $ a -> $ parent -> $ property ) || isset ( $ b -> $ parent -> $ property ) ) ) { if ( ! $ this -> sortCaseSensitive && is_string ( $ a -> $ parent -> $ property ) ... | Determine the sort order between two entities . |
12,539 | public function open ( $ file , $ mode = 'r+' ) { if ( ! file_exists ( $ file ) ) { throw new FileException ( 'CSV file does not exist' ) ; } parent :: open ( $ file , $ mode ) ; return $ this ; } | Open CSV file for reading |
12,540 | public function getHeader ( ) { $ this -> withHeader = true ; if ( ftell ( $ this -> handle ) == 0 ) { $ this -> header = $ this -> read ( ) ; } return $ this -> header ; } | Get CSV header . Usually it s the first line in file . |
12,541 | public function readLine ( ) { $ out = $ this -> read ( ) ; if ( $ this -> withHeader && is_array ( $ out ) ) { $ out = array_combine ( $ this -> header , $ out ) ; } return $ out ; } | Read current line from CSV file |
12,542 | private function read ( ) { $ out = fgetcsv ( $ this -> handle , null , $ this -> delimiter , $ this -> enclosure ) ; if ( ! is_array ( $ out ) ) { return $ out ; } if ( $ this -> encodingFrom !== null && $ this -> encodingTo !== null ) { foreach ( $ out as $ k => $ v ) { $ out [ $ k ] = iconv ( $ this -> encodingFrom ... | Wrapper for fgetcsv function |
12,543 | public function run ( ) { $ model = new Measure ; return $ this -> controller -> render ( 'index' , [ 'dataProvider' => $ model -> search ( \ Yii :: $ app -> request -> get ( ) ) , 'model' => $ model , ] ) ; } | Lists all Measure models . |
12,544 | public function make ( $ data = null ) { if ( is_null ( $ data ) ) { return new NullResource ( ) ; } elseif ( is_array ( $ data ) ) { return static :: makeFromArray ( $ data ) ; } $ method = static :: getMakeMethod ( $ data ) ; return static :: $ method ( $ data ) ; } | Build a resource instance from the given data . |
12,545 | protected function makeFromPaginator ( Paginator $ paginator ) : ResourceInterface { $ resource = static :: makeFromCollection ( $ paginator -> getCollection ( ) ) ; if ( $ resource instanceof CollectionResource ) { $ queryParams = array_diff_key ( app ( 'request' ) -> all ( ) , array_flip ( [ 'page' ] ) ) ; $ paginato... | Make resource from an Eloquent paginator . |
12,546 | public function download ( $ ftkey , $ size , $ passthru = FALSE ) { $ this -> init ( $ ftkey ) ; if ( $ passthru ) { return $ this -> passthru ( $ size ) ; } $ buff = new Str ( "" ) ; $ size = intval ( $ size ) ; $ pack = 4096 ; Signal :: getInstance ( ) -> emit ( "filetransferDownloadStarted" , $ ftkey , count ( $ bu... | Returns the content of a downloaded file as a Str object . |
12,547 | private function processDirectoryEntry ( $ artifactDirectory , $ entry ) { $ entity = fphp \ Helper \ Path :: join ( $ artifactDirectory , $ entry ) ; if ( is_dir ( $ entity ) && ! fphp \ Helper \ Path :: isDot ( $ entry ) && in_array ( $ this -> get ( "artifactFile" ) , scandir ( $ entity ) ) ) { $ feature = $ this ->... | recursively search the artifact directory allowing the user to group features |
12,548 | public static function observe ( $ class ) { $ className = is_string ( $ class ) ? $ class : get_class ( $ class ) ; foreach ( static :: $ observables as $ event ) { if ( method_exists ( $ class , $ event ) ) { static :: registerModelEvent ( $ event , $ className . '@' . $ event ) ; } } } | Register an observer with the Model . |
12,549 | public function say_dir ( ) { if ( $ this -> path ) { $ p = dirname ( $ this -> path ) ; if ( $ p === '.' ) { return '' ; } if ( ( $ prepath = $ this -> get_prepath ( ) ) && ( strpos ( $ p , $ prepath ) === 0 ) ) { return substr ( $ p , \ strlen ( $ prepath ) ) ; } return $ p ; } return false ; } | Returns the current controller s file s name . |
12,550 | public function render ( $ view , $ model = '' ) { if ( empty ( $ model ) && $ this -> has_data ( ) ) { $ model = $ this -> data ; } if ( \ is_string ( $ view ) ) { return \ is_array ( $ model ) ? bbn \ tpl :: render ( $ view , $ model ) : $ view ; } die ( bbn \ x :: hdump ( "Problem with the template" , $ view , $ thi... | This directly renders content with arbitrary values using the existing Mustache engine . |
12,551 | public function incl ( $ file_name ) { if ( $ this -> exists ( ) ) { $ d = dirname ( $ this -> file ) . '/' ; if ( substr ( $ file_name , - 4 ) !== '.php' ) { $ file_name .= '.php' ; } if ( ( strpos ( $ file_name , '..' ) === false ) && file_exists ( $ d . $ file_name ) ) { $ bbn_path = $ d . $ file_name ; $ ctrl = & $... | This will include a file from within the controller s path . Chainable |
12,552 | public function add_script ( $ script ) { if ( \ is_object ( $ this -> obj ) ) { if ( ! isset ( $ this -> obj -> script ) ) { $ this -> obj -> script = '' ; } $ this -> obj -> script .= $ script ; } return $ this ; } | This will add the given string to the script property and create it if needed . Chainable |
12,553 | public function get_content ( $ file_name ) { if ( $ this -> check_path ( $ file_name ) && \ defined ( 'BBN_DATA_PATH' ) && is_file ( BBN_DATA_PATH . $ file_name ) ) { return file_get_contents ( BBN_DATA_PATH . $ file_name ) ; } return false ; } | This will get a the content of a file located within the data path |
12,554 | public function delete_cached_model ( ) { $ args = \ func_get_args ( ) ; foreach ( $ args as $ a ) { if ( \ is_string ( $ a ) && \ strlen ( $ a ) ) { $ path = $ a ; } else if ( \ is_array ( $ a ) ) { $ data = $ a ; } } if ( ! isset ( $ path ) ) { $ path = $ this -> path ; } else if ( strpos ( $ path , './' ) === 0 ) { ... | This will delete the cached model . There is no order for the arguments . |
12,555 | public function has_data ( $ data = null ) { if ( \ is_null ( $ data ) ) { $ data = $ this -> data ; } return ( \ is_array ( $ data ) && ( \ count ( $ data ) > 0 ) ) ? 1 : false ; } | Checks if data exists |
12,556 | protected function urlGetDomainUrlAndClasifyParamsAndDomainParams ( array & $ params , array & $ domainParamsDefault , & $ targetDomainRoute ) { $ domainParams = array_intersect_key ( $ params , $ domainParamsDefault ) ; $ params = array_diff_key ( $ params , $ domainParamsDefault ) ; $ defaultDomainParams = array_merg... | Complete domain URL part by given module domain route and classify params necessary to complete URL by module route reverse string and unset those params from params array reference . Params array will be changed . Return URL base part by module domain route . |
12,557 | private function httpClient ( ) { if ( ! self :: $ httpClient ) { self :: $ httpClient = HttpClient \ CurlClient :: instance ( ) ; } return self :: $ httpClient ; } | If needed create and return a http client |
12,558 | public function isVariableRequired ( $ field ) { switch ( $ field ) { case 'email' : $ user = eZUser :: currentUser ( ) ; if ( ! $ user -> isAnonymous ( ) ) { return false ; } return true ; case 'recaptcha' : $ bypassCaptcha = ezcomPermission :: hasAccessToSecurity ( 'AntiSpam' , 'bypass_captcha' ) ; if ( $ bypassCaptc... | isVariableRequire in adding comment . When adding comment for logined user the email is not required |
12,559 | protected function validateField ( $ field , $ value ) { switch ( $ field ) { case 'website' : return ezcomUtility :: validateURLString ( $ value ) ; case 'email' : $ user = eZUser :: currentUser ( ) ; if ( $ user -> isAnonymous ( ) ) { $ result = eZMail :: validate ( $ value ) ; if ( ! $ result ) { return ezpI18n :: t... | Implement the validatation in adding comment |
12,560 | protected function setFieldValue ( $ field , $ fieldPostName ) { $ user = eZUser :: currentUser ( ) ; switch ( $ field ) { case 'email' : if ( ! $ user -> isAnonymous ( ) ) { $ this -> fieldValues [ $ field ] = $ user -> attribute ( 'email' ) ; } else { parent :: setFieldValue ( $ field , $ fieldPostName ) ; } break ; ... | Implement the setFieldValue in adding comment |
12,561 | protected function getThemePaths ( $ themes ) { $ dirsFromConfig = array_filter ( [ $ this -> getConfig ( ) -> get ( 'digipolis.root.project' , false ) , $ this -> getConfig ( ) -> get ( 'digipolis.root.web' , false ) , ] ) ; $ dirs = empty ( $ this -> dirs ) ? $ dirsFromConfig : $ this -> dirs ; if ( empty ( $ dirs ) ... | Get the theme paths . |
12,562 | public function decodeFile ( $ file , $ assoc = true , $ depth = 512 , $ options = 0 ) { set_error_handler ( create_function ( '$severity, $message, $file, $line' , 'throw new ErrorException($message, $severity, $severity, $file, $line);' ) ) ; try { $ jsonData = file_get_contents ( $ file ) ; } catch ( Exception $ e )... | Decode JSON data encoded in file |
12,563 | protected function checkJsonError ( ) { if ( ! function_exists ( 'json_last_error' ) ) { throw new BadFunctionCallException ( 'json_last_error() function not exits' ) ; } $ jsonError = json_last_error ( ) ; if ( $ jsonError !== JSON_ERROR_NONE ) { $ this -> jsonErrorException ( $ jsonError ) ; } return true ; } | Check exists error for last execution json funtion |
12,564 | private function decodeCheckVersion ( $ dataValid , $ assocValid , $ depthValid , $ optionsValid ) { if ( version_compare ( PHP_VERSION , '5.4.0' ) >= 0 ) { return json_decode ( $ dataValid , $ assocValid , $ depthValid , $ optionsValid ) ; } return json_decode ( $ dataValid , $ assocValid , $ depthValid ) ; } | Options param add 5 . 4 |
12,565 | private function encodeCheckVersion ( $ dataValid , $ optionsValid , $ depthValid ) { if ( version_compare ( PHP_VERSION , '5.4.0' ) >= 0 ) { return json_encode ( $ dataValid , $ optionsValid , $ depthValid ) ; } return json_encode ( $ dataValid , $ optionsValid ) ; } | Depth param add 5 . 4 |
12,566 | protected function registerCampagneWorkerService ( ) { $ this -> app -> bind ( 'designpond\newsletter\Newsletter\Worker\CampagneInterface' , function ( ) { return new \ designpond \ newsletter \ Newsletter \ Worker \ CampagneWorker ( \ App :: make ( 'designpond\newsletter\Newsletter\Repo\NewsletterContentInterface' ) ,... | Newsletter Campagne worker |
12,567 | protected function registerImportService ( ) { $ this -> app -> singleton ( 'designpond\newsletter\Newsletter\Worker\ImportWorkerInterface' , function ( ) { return new \ designpond \ newsletter \ Newsletter \ Worker \ ImportWorker ( \ App :: make ( 'designpond\newsletter\Newsletter\Worker\MailjetServiceInterface' ) , \... | Newsletter Import worker |
12,568 | protected function registerSubscribeWorkerService ( ) { $ this -> app -> bind ( 'designpond\newsletter\Newsletter\Worker\SubscriptionWorkerInterface' , function ( ) { return new \ designpond \ newsletter \ Newsletter \ Worker \ SubscriptionWorker ( \ App :: make ( 'designpond\newsletter\Newsletter\Repo\NewsletterInterf... | Newsletter subscriber service |
12,569 | public function parentBlockWidget ( BlockView $ view , array $ variables = [ ] ) { return $ this -> renderer -> searchAndRenderBlock ( $ view , 'widget' , $ variables , true ) ; } | Renders the parent block widget defined in other resources on all levels of block prefix hierarchy |
12,570 | public function formatLog ( array $ logMessage ) { extract ( $ logMessage ) ; $ level = strtoupper ( $ level ) ; $ message = $ this -> applyContext ( $ message , $ context ) ; $ timestamp = date ( $ this -> dateTimeFormat , $ timestamp ) ; $ exception = $ this -> getExceptionTrace ( $ context ) ; $ log = str_replace ( ... | Format log message |
12,571 | protected function applyContext ( $ message , array $ context = array ( ) ) { foreach ( $ context as $ key => $ value ) { $ key = trim ( $ key , "{}" ) ; if ( $ key != 'exception' ) { $ message = $ this -> replaceContext ( $ message , $ key , $ value ) ; } } return $ message ; } | Apply context into log message . |
12,572 | protected function replaceContext ( $ message , string $ key , $ context ) { $ strContext = '' ; if ( is_object ( $ context ) ) { if ( method_exists ( $ context , '__toString' ) ) { $ strContext = call_user_func ( [ $ context , '__toString' ] ) ; } else { $ strContext = var_export ( $ context , true ) ; } } else { $ st... | Replace context pattern in the message with related context . |
12,573 | protected function getExceptionTrace ( array $ context ) { if ( array_key_exists ( 'exception' , $ context ) ) { if ( $ context [ 'exception' ] instanceof \ Exception ) { $ strException = $ context [ 'exception' ] -> getTraceAsString ( ) ; return $ strException ; } } return '' ; } | Get Exception trace if found in the context . |
12,574 | public function handleChecks ( ) { $ errors = [ ] ; foreach ( $ this -> _config [ 'checks' ] as $ name => $ check ) { if ( empty ( $ check ) ) { continue ; } $ result = $ check [ 'callback' ] ( ) ; if ( $ result !== true ) { $ errors [ ] = $ name . ': <br>' . $ check [ 'error' ] . ' - ' . $ result ; } } if ( ! empty ( ... | Handle all defined checks |
12,575 | public function search ( $ params ) { $ query = Message :: find ( ) ; $ query -> joinWith ( 'source' ) ; $ dataProvider = new ActiveDataProvider ( [ 'query' => $ query ] ) ; $ dataProvider -> getSort ( ) -> attributes [ 'sourceMessage' ] = [ 'asc' => [ 'source.message' => SORT_ASC ] , 'desc' => [ 'source.message' => SO... | Default index search method |
12,576 | public function execute ( ProjectDescriptor $ project ) { $ this -> analyzer -> analyze ( $ project ) ; $ this -> log -> debug ( ( string ) $ this -> analyzer ) ; } | Analyzes the given project and returns the results to the logger . |
12,577 | protected function findModel ( $ id ) { if ( ( $ model = ProductType :: findOne ( $ id ) ) !== null ) { return $ model ; } else { throw new NotFoundHttpException ( t ( 'app' , 'The requested page does not exist.' ) ) ; } } | Finds the ProductType model based on its primary key value . If the model is not found a 404 HTTP exception will be thrown . |
12,578 | protected function addPageParameterNode ( ) { $ builder = new TreeBuilder ( ) ; $ node = $ builder -> root ( 'page' ) ; $ node -> treatTrueLike ( array ( 'versionable' => false , 'signable' => false , 'form' => array ( 'type' => "ASF\DocumentBundle\Form\Type\PageType" , 'name' => 'page_type' ) ) ) -> treatFalseLike ( a... | Add Page Entity Configuration |
12,579 | public static function create ( $ modelAlias = null , $ criteria = null ) { if ( $ criteria instanceof \ CustomerGroup \ Model \ CustomerCustomerGroupQuery ) { return $ criteria ; } $ query = new \ CustomerGroup \ Model \ CustomerCustomerGroupQuery ( ) ; if ( null !== $ modelAlias ) { $ query -> setModelAlias ( $ model... | Returns a new ChildCustomerCustomerGroupQuery object . |
12,580 | public function filterByCustomerGroupId ( $ customerGroupId = null , $ comparison = null ) { if ( is_array ( $ customerGroupId ) ) { $ useMinMax = false ; if ( isset ( $ customerGroupId [ 'min' ] ) ) { $ this -> addUsingAlias ( CustomerCustomerGroupTableMap :: CUSTOMER_GROUP_ID , $ customerGroupId [ 'min' ] , Criteria ... | Filter the query on the customer_group_id column |
12,581 | public function filterByCustomer ( $ customer , $ comparison = null ) { if ( $ customer instanceof \ Thelia \ Model \ Customer ) { return $ this -> addUsingAlias ( CustomerCustomerGroupTableMap :: CUSTOMER_ID , $ customer -> getId ( ) , $ comparison ) ; } elseif ( $ customer instanceof ObjectCollection ) { if ( null ==... | Filter the query by a related \ Thelia \ Model \ Customer object |
12,582 | public function useCustomerQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinCustomer ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'Customer' , '\Thelia\Model\CustomerQuery' ) ; } | Use the Customer relation Customer object |
12,583 | protected function show ( $ user , string $ modelName ) { $ method = "{$modelName}s" ; $ methodTitle = ucfirst ( $ method ) ; if ( ! $ user -> $ method ) { $ this -> warn ( "User not use Has{$methodTitle}Trait!" ) ; return ; } echo "{$methodTitle}:" , PHP_EOL ; $ data = $ this -> prepareData ( $ user -> $ method -> toA... | Show roles or permissions |
12,584 | function nativeCopy ( $ path , $ newPath ) { if ( ! $ this -> createDir ( Util :: dirname ( $ newPath ) , new Config ( ) ) ) { return false ; } $ location = $ this -> applyPathPrefix ( $ this -> encodePath ( $ path ) ) ; $ newLocation = $ this -> applyPathPrefix ( $ this -> encodePath ( $ newPath ) ) ; try { $ destinat... | Copy a file through WebDav COPY method . |
12,585 | function normalizeObject ( array $ object , $ path ) { if ( ! isset ( $ object [ '{DAV:}getcontentlength' ] ) or $ object [ '{DAV:}getcontentlength' ] == "" ) { return [ 'type' => 'dir' , 'path' => trim ( $ path , '/' ) ] ; } $ result = Util :: map ( $ object , static :: $ resultMap ) ; if ( isset ( $ object [ '{DAV:}g... | Normalise a WebDAV repsonse object . |
12,586 | function removePathPrefix ( $ path ) { if ( strpos ( $ path , $ this -> getPathPrefix ( ) ) === false ) { return basename ( $ path ) ; } return parent :: removePathPrefix ( $ path ) ; } | Remove a path prefix . |
12,587 | protected function findModel ( $ id ) { if ( ( $ model = TermOfProductType :: findOne ( $ id ) ) !== null ) { return $ model ; } else { throw new NotFoundHttpException ( t ( 'app' , 'The requested page does not exist.' ) ) ; } } | Finds the TermOfProductType model based on its primary key value . If the model is not found a 404 HTTP exception will be thrown . |
12,588 | public function post ( $ url , $ data = [ ] , $ headers = [ ] , $ curl_opts = [ ] ) { return $ this -> load ( $ url , $ data , $ headers , $ curl_opts ) ; } | GETs data from the server |
12,589 | public function put ( $ url , $ data = [ ] , $ headers = [ ] , $ curl_opts = [ ] ) { $ curl_opts [ CURLOPT_CUSTOMREQUEST ] = 'PUT' ; return $ this -> load ( $ url , $ data , $ headers , $ curl_opts ) ; } | PUTs data to the server |
12,590 | public function delete ( $ url , $ data = [ ] , $ headers = [ ] , $ curl_opts = [ ] ) { $ curl_opts [ CURLOPT_CUSTOMREQUEST ] = 'DELETE' ; return $ this -> load ( $ url , $ data , $ headers , $ curl_opts ) ; } | DELETEs data from the server |
12,591 | public function split ( string $ subject , int $ limit = - 1 , int $ flags = 0 ) : array { $ result = preg_split ( $ this -> pattern -> getPattern ( ) . $ this -> modifier , $ subject , $ limit , $ flags ) ; if ( ( $ errno = preg_last_error ( ) ) !== PREG_NO_ERROR ) { $ message = array_flip ( get_defined_constants ( tr... | Retrieves subject split with Pattern |
12,592 | protected function parseArguments ( ) { $ stream = $ this -> parser -> getStream ( ) ; $ data = null ; $ only = false ; if ( $ stream -> test ( Twig_Token :: BLOCK_END_TYPE ) ) { $ stream -> expect ( Twig_Token :: BLOCK_END_TYPE ) ; return [ $ data , $ only ] ; } if ( $ stream -> test ( Twig_Token :: NAME_TYPE , 'only'... | Tokenizes the component stream . |
12,593 | public function getSubscribedEvents ( ) { $ events = [ ] ; foreach ( $ this -> providers as $ command => $ provider ) { $ events [ 'command.' . $ command ] = 'handleCommand' ; $ events [ 'command.' . $ command . '.help' ] = 'handleCommandHelp' ; } return $ events ; } | Return an array of commands and associated methods |
12,594 | public function handleCommandHelp ( Event $ event , Queue $ queue ) { $ params = $ event -> getCustomParams ( ) ; $ provider = $ this -> getProvider ( ( $ event -> getCustomCommand ( ) === "help" ) ? $ params [ 0 ] : $ event -> getCustomCommand ( ) ) ; if ( $ provider ) { $ this -> sendIrcResponse ( $ event , $ queue ,... | Main plugin handler for help requests |
12,595 | public function getProvider ( $ command ) { $ providerExists = ( isset ( $ this -> providers [ $ command ] ) && class_exists ( $ this -> providers [ $ command ] ) ) ; return ( $ providerExists ) ? new $ this -> providers [ $ command ] : false ; } | Get a single provider class by command |
12,596 | protected function getApiRequest ( Event $ event , Queue $ queue , GoogleProviderInterface $ provider ) { $ self = $ this ; return new HttpRequest ( [ 'url' => $ provider -> getApiRequestUrl ( $ event ) , 'resolveCallback' => function ( Response $ response ) use ( $ self , $ event , $ queue , $ provider ) { $ self -> s... | Set up the API request and set the callbacks |
12,597 | protected function sendIrcResponse ( Event $ event , Queue $ queue , array $ ircResponse ) { foreach ( $ ircResponse as $ ircResponseLine ) { $ this -> sendIrcResponseLine ( $ event , $ queue , $ ircResponseLine ) ; } } | Send an array of response lines back to IRC |
12,598 | protected function sendIrcResponseLine ( Event $ event , Queue $ queue , $ ircResponseLine ) { $ queue -> ircPrivmsg ( $ event -> getSource ( ) , $ ircResponseLine ) ; } | Send a single response line back to IRC |
12,599 | private function fetchInfo ( $ key ) { return array_key_exists ( $ key , $ this -> info ) ? $ this -> info [ $ key ] : null ; } | Search the information array for the specified key and return the value |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.