idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
56,300 | public function create ( $ aData , $ bReturnObject = false ) { $ aCategoryData = array ( ) ; if ( empty ( $ aData [ 'label' ] ) ) { $ this -> setError ( '"label" is a required field.' ) ; return false ; } else { $ aCategoryData [ 'label' ] = trim ( $ aData [ 'label' ] ) ; } if ( empty ( $ aData [ 'blog_id' ] ) ) { $ th... | Creates a new category |
56,301 | public function update ( $ iId , $ aData ) { $ aCategoryData = array ( ) ; if ( empty ( $ aData [ 'label' ] ) ) { $ this -> setError ( '"label" is a required field.' ) ; return false ; } else { $ aCategoryData [ 'label' ] = trim ( $ aData [ 'label' ] ) ; } $ aCategoryData [ 'slug' ] = $ this -> generateSlug ( $ aData [... | Updates an existing category |
56,302 | public function replaceTokens ( $ text ) { $ tokens = $ this -> macro -> search ( $ text ) ; if ( empty ( $ tokens ) ) { return $ text ; } static $ last = [ ] ; $ replacements = [ ] ; foreach ( $ tokens as $ type => $ typeTokens ) { foreach ( $ typeTokens as $ name => $ token ) { if ( $ type == "any" ) { $ value = $ th... | Replace fake data tokens . |
56,303 | public function replaceTableTokens ( TableNode $ input ) { $ table = $ input -> getTable ( ) ; foreach ( $ table as $ row => $ values ) { foreach ( $ values as $ idx => $ value ) { $ table [ $ row ] [ $ idx ] = $ this -> replaceTokens ( $ value ) ; } } return new TableNode ( $ table ) ; } | Replace fake data tokens in tables . |
56,304 | public function gatherContexts ( BeforeScenarioScope $ scope ) { $ environment = $ scope -> getEnvironment ( ) ; $ this -> mink = $ environment -> getContext ( 'Starbug\Behat\Context\MinkContext' ) ; } | Access other contexts . |
56,305 | public function send ( $ destination , $ text ) { $ response = $ this -> browser -> post ( 'http://distext.wavy.be/api/sms' , array ( 'X-Auth-Token' => $ this -> apiKey , ) , json_encode ( [ 'destination' => $ destination , 'text' => $ text , ] ) ) ; if ( ! $ response -> isSuccessful ( ) ) { $ message = $ response -> g... | Send a text message |
56,306 | public function remove ( $ key ) { if ( ! array_key_exists ( $ key , $ this -> data ) ) { return NULL ; } $ oldValue = $ this -> data [ $ key ] ; unset ( $ this -> data [ $ key ] ) ; return $ oldValue ; } | unset key value ; returns previously held data |
56,307 | public function replace ( array $ data ) { $ this -> data = array ( ) ; foreach ( $ data as $ k => $ v ) { $ this -> data [ $ k ] = $ v ; } } | replace current data array |
56,308 | private function cleanData ( array $ data ) : array { foreach ( $ data as $ key => $ value ) { $ data [ $ key ] = $ this -> replace ( $ key , $ value ) ; } return $ data ; } | Loop through the values and pass them to the replace method |
56,309 | private function replace ( $ key , $ value ) { if ( is_array ( $ value ) ) return $ this -> cleanData ( $ value ) ; return $ this -> transform ( $ key , $ value ) ; } | Pass arrays back to the cleanData method and pass everything else to transform |
56,310 | public function washCreateForm ( ) { $ data = [ ] ; $ data [ 'to_email_address' ] = trim ( $ this -> request -> input ( 'to_email_address' ) ) ; $ data [ 'to_name' ] = $ this -> genericWashText ( $ this -> request -> input ( 'to_name' ) ) ; $ data [ 'subject' ] = $ this -> genericWashText ( $ this -> request -> input (... | Wash the create form s input fields |
56,311 | public function prepEmailData ( $ id ) { $ email = $ this -> email_message -> find ( $ id ) ; $ data = [ ] ; $ data [ 'from_name' ] = $ email -> from_name ; $ data [ 'from_email_address' ] = $ email -> from_email_address ; $ data [ 'to_name' ] = $ email -> to_name ; $ data [ 'to_email_address' ] = $ email -> to_email_a... | Prepare the email |
56,312 | public static function isFile ( $ object , $ value ) : bool { if ( $ object === null ) { return true ; } $ all = false ; if ( ! Any :: isArray ( $ value ) ) { if ( $ value === '*' ) { $ all = true ; } else { $ value = [ $ value ] ; } } if ( $ object === null || ! Any :: isObj ( $ object ) ) { return false ; } $ type = ... | Check if field is file or null |
56,313 | public static function sizeFile ( $ object , $ value ) : bool { if ( $ object === null ) { return true ; } if ( ! Any :: isArray ( $ value ) ) { $ value = [ 0 , $ value ] ; } if ( $ object === null || ! Any :: isObj ( $ object ) ) { return false ; } $ realSize = $ object -> getClientSize ( ) ; if ( $ realSize === null ... | Check file size . If is null - will return true |
56,314 | private function extended ( callable $ factory , callable ... $ extensions ) : callable { return array_reduce ( $ extensions , function ( $ factory , $ extension ) { return new Extension ( $ factory , $ extension ) ; } , $ factory ) ; } | Return an extension from the given callables . |
56,315 | public function replaceDatabase ( Connection $ connection , string $ databaseName , string $ searchTerm , string $ replaceTerm , int $ batchSize = 100 ) : \ Generator { $ databaseMetadata = ( new MetadataFactory ( ) ) -> getDatabaseMetadata ( $ connection , $ databaseName ) ; foreach ( $ databaseMetadata -> getAllTable... | Performs a search on all tables in the the provided database batching queries to the specified batch size . |
56,316 | public function replaceTable ( Connection $ connection , string $ databaseName , string $ tableName , string $ searchTerm , string $ replaceTerm , int $ batchSize = 100 ) : \ Generator { $ connection -> query ( 'START TRANSACTION' ) ; $ rowCount = 0 ; $ rowSearchResultList = ( new Search ( ) ) -> searchTable ( $ connec... | Performs a search on the provided table batching queries to the specified batch size . |
56,317 | private function replace ( ColumnMetadata $ columnMetadata , string $ searchTerm , string $ replaceTerm , string $ subject ) : FieldReplaceResult { $ fieldReplaced = null ; foreach ( $ this -> replacementStrategyList as $ replacementStrategy ) { if ( $ replacementStrategy -> canReplace ( $ searchTerm , $ subject ) ) { ... | Perform the string replacement on the field . |
56,318 | public function register ( ServiceProviderInterface $ provider , array $ values = array ( ) ) { $ this -> registeredProviders [ get_class ( $ provider ) ] = true ; parent :: register ( $ provider , $ values ) ; } | Keep track of registered providers . |
56,319 | public function handleError ( $ errno , $ errstr , $ errfile , $ errline ) { if ( ! $ this [ 'debug' ] ) { return ; } throw new \ ErrorException ( $ errstr , 0 , $ errno , $ errfile , $ errline ) ; } | A generic error handler will convert errors into exceptions in debug mode . |
56,320 | public function listReport ( ) { $ this -> setTitleListReport ( ) ; $ this -> setBreadcrumbListReport ( ) ; $ this -> clearCacheReport ( ) ; $ this -> setData ( 'stores' , $ this -> store -> getList ( ) ) ; $ this -> setData ( 'panels' , $ this -> getPanelsReport ( ) ) ; $ default = $ this -> module -> getSettings ( 'g... | Route callback Displays the report page |
56,321 | protected function getPanelsReport ( ) { $ settings = $ this -> module -> getSettings ( 'ga_report' ) ; $ store_id = $ this -> getQuery ( 'ga.update.store_id' ) ; if ( ! empty ( $ store_id ) ) { $ settings [ 'store_id' ] = $ store_id ; } $ panels = array ( ) ; foreach ( $ this -> report_model -> getHandlers ( ) as $ ha... | Returns an array of report panels |
56,322 | public function handleViolation ( Route $ route ) { if ( in_array ( $ route , $ this -> violatingRoutes ) ) { throw new ApplicationException ( 'Circular redirects detected; aborting.' ) ; } $ this -> violatingRoutes [ ] = $ route ; Session :: getSessionDataBag ( ) -> set ( 'authViolatingRequest' , Request :: createFrom... | handle authentication violation by trying to find a redirecting route |
56,323 | function ToArray ( ) { $ result = array ( ) ; $ item = $ this -> TopMost ( ) ; while ( $ item ) { $ result [ ] = $ item ; $ item = $ this -> NextOf ( $ item ) ; } return $ result ; } | Gets the sorted item list |
56,324 | function Last ( ) { $ items = $ this -> ToArray ( ) ; $ cnt = count ( $ items ) ; return $ cnt > 0 ? $ items [ $ cnt - 1 ] : null ; } | Gets the last item |
56,325 | public function complexity ( ) { $ dynamicPartsCount = substr_count ( $ this -> pattern , ':' ) + substr_count ( $ this -> pattern , '?' ) ; return ( substr_count ( $ this -> pattern , '/' ) - $ dynamicPartsCount ) * 100 + $ dynamicPartsCount ; } | Count the number of pattern segments for this rule . |
56,326 | public function prune ( array $ results ) { $ mean = array_sum ( $ results ) / count ( $ results ) ; $ deviation = $ this -> deviations * $ this -> standardDeviation ( $ results ) ; $ lower = $ mean - $ deviation ; $ upper = $ mean + $ deviation ; return array_values ( array_filter ( $ results , function ( $ val ) use ... | Prune the results |
56,327 | private function standardDeviation ( array $ results ) { $ mean = array_sum ( $ results ) / count ( $ results ) ; $ initial = 0 ; $ f = function ( $ carry , $ val ) use ( $ mean ) { return $ carry + pow ( $ val - $ mean , 2 ) ; } ; $ sum = array_reduce ( $ results , $ f , $ initial ) ; $ n = count ( $ results ) - 1 ; r... | Returns one standard deviation for the given results |
56,328 | public function index ( ) { $ this -> data [ 'page' ] -> title = 'Blog › Tags' ; $ data = array ( ) ; $ data [ 'include_count' ] = true ; $ data [ 'where' ] = array ( ) ; $ data [ 'where' ] [ ] = array ( 'column' => 'blog_id' , 'value' => $ this -> blog -> id ) ; $ this -> data [ 'tags' ] = $ this -> blog_tag_mo... | Browse blog tags |
56,329 | public function create ( ) { if ( ! userHasPermission ( 'admin:blog:tag:' . $ this -> blog -> id . ':create' ) ) { unauthorised ( ) ; } if ( $ this -> input -> post ( ) ) { $ oFormValidation = Factory :: service ( 'FormValidation' ) ; $ oFormValidation -> set_rules ( 'label' , '' , 'required' ) ; $ oFormValidation -> s... | Create a new blog tag |
56,330 | public function edit ( ) { if ( ! userHasPermission ( 'admin:blog:tag:' . $ this -> blog -> id . ':edit' ) ) { unauthorised ( ) ; } $ this -> data [ 'tag' ] = $ this -> blog_tag_model -> getById ( $ this -> uri -> segment ( 6 ) ) ; if ( empty ( $ this -> data [ 'tag' ] ) ) { show404 ( ) ; } if ( $ this -> input -> post... | Edit a blog tag |
56,331 | public function addConfiguration ( ConfigurationInterface $ configuration ) { $ this -> parentMap = null ; $ id = $ configuration -> getResourceId ( ) ; if ( array_key_exists ( $ id , $ this -> configurations ) ) { throw new \ RuntimeException ( sprintf ( "Configuration for resource '%s' is already registered." , $ id ... | Adds the resource configuration . |
56,332 | public function get ( $ id ) { if ( ! $ this -> has ( $ id ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Configuration "%s" not found.' , $ id ) ) ; } return $ this -> configurations [ $ id ] ; } | Returns the configuration for the given identifier . |
56,333 | public function getAncestors ( ConfigurationInterface $ configuration , $ included = false ) { $ ancestors = [ ] ; if ( $ included ) { $ ancestors [ $ configuration -> getResourceName ( ) ] = $ configuration ; } while ( null !== $ configuration -> getParentId ( ) ) { $ configuration = $ this -> findConfiguration ( $ co... | Returns all the ancestors configuration . |
56,334 | public function getChildren ( ConfigurationInterface $ configuration ) { $ children = [ ] ; foreach ( $ this -> configurations as $ child ) { if ( $ child -> getParentId ( ) === $ configuration -> getResourceId ( ) ) { $ children [ $ child -> getResourceName ( ) ] = $ child ; } } return $ children ; } | Returns all the children configuration . |
56,335 | public function getObjectIdentity ( $ object ) { foreach ( $ this -> configurations as $ config ) { if ( $ config -> isRelevant ( $ object ) ) { return $ config -> getObjectIdentity ( ) ; } } return null ; } | Returns the object identity . |
56,336 | public function getParentMap ( ) { if ( null !== $ this -> parentMap ) { return $ this -> parentMap ; } return $ this -> parentMap = $ this -> buildParentMap ( ) ; } | Returns the hierarchy map . |
56,337 | public function getEventPriorityMap ( ) { if ( null !== $ this -> eventPriorityMap ) { return $ this -> eventPriorityMap ; } return $ this -> eventPriorityMap = $ this -> buildEventPriorityMap ( ) ; } | Returns the event priority map . |
56,338 | private function buildParentMap ( ) { $ map = [ ] ; foreach ( $ this -> configurations as $ configuration ) { if ( null !== $ parentId = $ configuration -> getParentId ( ) ) { $ map [ $ configuration -> getResourceId ( ) ] = $ parentId ; } } ksort ( $ map ) ; return $ map ; } | Builds the parent map . |
56,339 | private function buildEventPriorityMap ( ) { $ map = [ ] ; foreach ( $ this -> configurations as $ configuration ) { if ( 0 != $ priority = $ configuration -> getEventPriority ( ) ) { $ map [ $ configuration -> getResourceId ( ) ] = $ priority ; } } ksort ( $ map ) ; return $ map ; } | Builds the event priority map . |
56,340 | protected function getValue ( ) { if ( ( $ this -> data == '0' || ! empty ( $ this -> data ) ) && ! is_object ( $ this -> data ) ) { $ value = ( $ this -> parent && is_array ( $ this -> data ) ) ? $ this -> data [ 0 ] : $ this -> data ; } else if ( $ this -> options -> default == '0' || ! empty ( $ this -> options -> d... | Fetches the current value of the element |
56,341 | public function render ( ) { if ( $ this -> parent ) { if ( ! static :: $ count [ $ this -> parent ] ) static :: $ count [ $ this -> parent ] = 0 ; static :: $ count [ $ this -> parent ] ++ ; $ this -> attributes -> id += static :: $ count [ $ this -> parent ] ; } ob_start ( ) ; ?> <div class="element-group <?= $ this... | Render the element for output |
56,342 | public function getPaymentStateLabel ( $ stateOrPayment ) { $ state = $ stateOrPayment instanceof PaymentInterface ? $ stateOrPayment -> getState ( ) : $ stateOrPayment ; return $ this -> translator -> trans ( PaymentStates :: getLabel ( $ state ) ) ; } | Returns the payment state label . |
56,343 | public function getPaymentStateBadge ( $ stateOrPayment ) { $ state = $ stateOrPayment instanceof PaymentInterface ? $ stateOrPayment -> getState ( ) : $ stateOrPayment ; return sprintf ( '<span class="label label-%s">%s</span>' , PaymentStates :: getTheme ( $ state ) , $ this -> getPaymentStateLabel ( $ state ) ) ; } | Returns the payment state badge . |
56,344 | public function renderMethodConfig ( MethodInterface $ method ) { $ output = '<dl class="dl-horizontal">' ; foreach ( $ method -> getConfig ( ) as $ key => $ value ) { if ( is_array ( $ value ) ) { continue ; } $ output .= sprintf ( '<dt>%s</dt><dd>%s</dd>' , $ key , $ value ) ; } $ output .= '</dl>' ; return $ output ... | Renders the method config . |
56,345 | public function addDocumentFolder ( $ postValues ) { $ documentFolderObject = DocumentFolderFactory :: createDocumentFolderFromPostValues ( $ postValues ) ; if ( $ postValues [ 'path' ] === '/' ) { $ documentFolderObject -> path = $ postValues [ 'path' ] . $ documentFolderObject -> slug ; } else { $ documentFolderObjec... | Add new document in given path |
56,346 | public function deleteDocumentFolderBySlug ( $ slug ) { $ path = '/' . $ slug ; $ this -> repository -> getContentRepository ( ) -> deleteDocumentByPath ( $ this -> repository , $ path ) ; $ this -> repository -> getContentRepository ( ) -> cleanPublishedDeletedDocuments ( ) ; } | Delete a folder by its compound slug |
56,347 | public function getDocumentFolderBySlug ( $ slug ) { if ( $ slug === '/' ) { $ path = $ slug ; } else { $ path = '/' . $ slug ; } return $ this -> repository -> getContentRepository ( ) -> getDocumentByPath ( $ this -> repository , $ path , 'unpublished' ) ; } | Retrieve a folder by its compound slug |
56,348 | public function canRead ( string $ uri ) : bool { if ( in_array ( Acl :: RULE_ALL , ( array ) $ this -> getPermissionsOf ( $ this -> getUriRoot ( $ uri ) ) ) ) { return true ; } $ permission = array_filter ( ( array ) $ this -> getPermissionsOf ( $ uri ) , function ( $ rule ) { return ( $ rule == Acl :: RULE_ALL || $ r... | Can read . |
56,349 | public function canWrite ( string $ uri ) : bool { if ( in_array ( Acl :: RULE_ALL , ( array ) $ this -> getPermissionsOf ( $ this -> getUriRoot ( $ uri ) ) ) ) { return true ; } $ permission = array_filter ( ( array ) $ this -> getPermissionsOf ( $ uri ) , function ( $ rule ) { return ( $ rule == Acl :: RULE_ALL || $ ... | Can write . |
56,350 | public function redirectIf ( string $ dir , string $ to = '/' , bool $ exit = true ) : void { if ( $ this -> acl != null ) { $ app = $ this -> acl -> getService ( ) -> getApp ( ) ; if ( $ dir == 'in' && $ this -> isLoggedIn ( ) ) { $ app -> response ( ) -> redirect ( $ to ) ; } elseif ( $ dir == 'out' && ! $ this -> is... | Redirect if . |
56,351 | protected function getCleanAdditionalConfiguration ( $ extensionKey ) { $ newLines = [ ] ; if ( ( $ content = GeneralUtility :: getUrl ( $ this -> getConfigurationManager ( ) -> getAdditionalConfigurationFileLocation ( ) ) ) !== false ) { $ currentLines = explode ( LF , $ content ) ; array_shift ( $ currentLines ) ; $ ... | Returns the lines from AdditionalConfiguration . php file without own additions |
56,352 | public function values ( array $ values ) { $ this -> fieldValues = array ( ) ; $ this -> fieldsSql = '?i' ; $ this -> fieldValues [ ] = array_keys ( $ values ) ; $ this -> valuesSql = array ( ) ; foreach ( $ values as $ v ) { if ( is_object ( $ v ) and $ v instanceof SqlValueInterface ) { $ this -> valuesSql [ ] = $ v... | Prepares values for inserting into db |
56,353 | protected function getConnection ( $ uri ) { if ( $ this -> pdo ) { return ; } $ this -> splitURI ( $ uri ) ; try { $ this -> pdo = new PDO ( $ this -> dsn , $ this -> user , $ this -> passwd ) ; $ this -> pdo -> setAttribute ( PDO :: ATTR_ERRMODE , PDO :: ERRMODE_EXCEPTION ) ; } catch ( PDOException $ e ) { throw new ... | Connects to the DB . |
56,354 | public function create ( ) { try { $ this -> pdo -> exec ( "CREATE DATABASE `{$this->dbName}`" ) ; } catch ( PDOException $ e ) { } $ sql = <<<SQL CREATE TABLE IF NOT EXISTS `{$this->dbName}`.`{$this->dbTable}` ( `eid` int(10) NOT NULL, `id` int(10) NOT NULL, `ty... | Attempt to create the database and tables needed to store pclasses . |
56,355 | protected function loadPClasses ( ) { try { $ sth = $ this -> pdo -> prepare ( "SELECT * FROM `{$this->dbName}`.`{$this->dbTable}`" , array ( PDO :: ATTR_CURSOR => PDO :: CURSOR_FWDONLY ) ) ; $ sth -> execute ( ) ; while ( $ row = $ sth -> fetch ( PDO :: FETCH_ASSOC , PDO :: FETCH_ORI_NEXT ) ) { $ this -> addPClass ( n... | Loads the PClasses . |
56,356 | public function clear ( $ uri ) { try { $ this -> connect ( $ uri ) ; unset ( $ this -> pclasses ) ; $ this -> clearTable ( ) ; } catch ( Exception $ e ) { throw new Klarna_DatabaseException ( $ e -> getMessage ( ) , $ e -> getCode ( ) ) ; } } | Drops the database table to clear the PClasses . |
56,357 | public function closeRow ( $ last = false ) { $ this -> _strategy -> output ( $ this -> endRow ( ) . ( $ last ? '' : $ this -> rowSeparator ( ) ) ) ; } | End the row |
56,358 | public function column ( $ v , $ last = false ) { $ this -> _strategy -> output ( $ this -> beginColumn ( ) . $ v . $ this -> endColumn ( ) . ( $ last ? '' : $ this -> columnSeparator ( ) ) ) ; } | Write a column value for the current row |
56,359 | public function row ( $ r , $ last = false ) { $ this -> _strategy -> output ( $ this -> beginRow ( ) ) ; $ values = array_values ( $ r ) ; $ valuesl = count ( $ values ) ; for ( $ i = 0 ; $ i < $ valuesl ; $ i ++ ) $ this -> column ( $ values [ $ i ] , $ i + 1 == $ valuesl ) ; $ this -> _strategy -> output ( $ this ->... | Write a row |
56,360 | public function __getSerialisablePropertyValue ( $ propertyName ) { try { return parent :: __getSerialisablePropertyValue ( $ propertyName ) ; } catch ( PropertyNotReadableException $ e ) { if ( $ this -> __strictMode ) { throw $ e ; } else { return null ; } } } | Override the parent get property value method to be a little more tolerant than the parent |
56,361 | public function __getSerialisablePropertyMap ( ) { $ serialisableProperties = parent :: __getSerialisablePropertyMap ( ) ; $ dynamicProperties = $ this -> __dynamicPropertyMap ; $ map = array ( ) ; foreach ( $ dynamicProperties as $ key => $ value ) { $ map [ $ key ] = $ value ; } foreach ( $ serialisableProperties as ... | Get the array of serialisable properties |
56,362 | public function __setSerialisablePropertyMap ( $ propertyMap , $ ignoreNoneWritableProperties = false ) { $ dynamicProperties = parent :: __setSerialisablePropertyMap ( $ propertyMap , true ) ; if ( ! $ this -> __strictMode ) { $ this -> __dynamicPropertyMap = array_merge ( $ this -> __dynamicPropertyMap , $ dynamicPro... | Set an array of serialisable properties |
56,363 | public function process ( ServerRequestInterface $ request , RequestHandlerInterface $ handler ) : ResponseInterface { $ errorPageConfig = Config :: getInstance ( ) -> get ( 'errorPage' ) ; $ controllerClass = '\\app\\Controllers\\' . $ errorPageConfig [ 0 ] ; $ route = new Route ( '404' , $ errorPageConfig [ 0 ] , $ e... | Process method for NotFoundMiddleware |
56,364 | public static function getFromFile ( $ path ) { if ( ! ( $ path instanceof File ) ) $ path = new File ( $ path ) ; $ ext = $ path -> getExtension ( ) ; $ path = $ path -> getFullPath ( ) ; $ type = new FileType ( $ ext ?? "" , "" ) ; if ( empty ( $ type -> getMimeType ( ) ) && file_exists ( $ path ) ) $ type -> setMime... | Return the mime type based on a file name |
56,365 | public function isPlainText ( ) { $ sc_pos = strpos ( $ this -> mime_type , ';' ) ; if ( $ sc_pos !== false ) $ mime_type = substr ( $ this -> mime_type , 0 , $ sc_pos ) ; else $ mime_type = $ this -> mime_type ; switch ( $ mime_type ) { case "application/javascript" : case "application/json" : case "application/xml" :... | Check if a mime type is plain text |
56,366 | protected function parse ( ) { $ lines = explode ( "\n" , $ this -> comment ) ; $ current_annotation = null ; $ value = null ; foreach ( $ lines as $ line ) { $ line = trim ( ltrim ( $ line , "/* \t" ) ) ; if ( preg_match ( "/^@(\w+)( (.*))?$/" , $ line , $ matches ) === 1 ) { if ( ! empty ( $ value ) ) $ this -> annot... | Helper method that parses the doc comment |
56,367 | public function getAnnotation ( string $ name , bool $ single = true ) { $ val = $ this -> annotations [ $ name ] ?? [ ] ; return $ single ? ( count ( $ val ) ? reset ( $ val ) : null ) : $ val ; } | Get an annotated value for the DocComment |
56,368 | public function getAnnotationTokens ( string $ name ) { $ val = $ this -> getAnnotation ( $ name , true ) ; $ val = trim ( preg_replace ( "/\s{1,}/" , " " , $ val ) ) ; return ! empty ( $ val ) ? explode ( " " , $ val ) : [ ] ; } | Get the tokenized annotation - split by whitespace |
56,369 | protected function cacheTerm ( $ term_id ) { $ term = TermContainer :: with ( 'translations' ) -> find ( $ term_id ) ; if ( ! $ term || ! count ( $ term -> translations ) ) { return false ; } $ translations = [ ] ; foreach ( $ term -> translations as $ t ) { $ translations [ $ t -> language_id ] = $ t ; } $ first = $ t... | Puts the term in the cache and returns it for usage |
56,370 | public function compile ( ExpressCompiler $ compiler , $ flags = 0 ) { try { if ( $ flags & self :: FLAG_RAW ) { $ compiler -> write ( var_export ( $ this -> text , true ) ) ; } else { $ compiler -> out ( htmlspecialchars ( $ this -> text , ENT_COMPAT | ENT_XML1 | ENT_SUBSTITUTE , 'UTF-8' ) ) ; } } catch ( ExpressViewE... | Compiles the text node into it s PHP code . |
56,371 | public static function isBoolean ( $ value , $ message = null ) { if ( ! is_bool ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected boolean, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is boolean . |
56,372 | public static function isInteger ( $ value , $ message = null ) { if ( ! is_int ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected integer, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is integer . |
56,373 | public static function isNumeric ( $ value , $ message = null ) { if ( ! is_numeric ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected numeric, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is numeric . |
56,374 | public static function isFloat ( $ value , $ message = null ) { if ( ! is_float ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected float, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is float . |
56,375 | public static function isString ( $ value , $ message = null ) { if ( ! is_string ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected string, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is string . |
56,376 | public static function isScalar ( $ value , $ message = null ) { if ( ! is_scalar ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected scalar, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is scalar . |
56,377 | public static function isArray ( $ value , $ message = null ) { if ( ! is_array ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected array, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is array . |
56,378 | public static function isInstanceOf ( $ value , $ class , $ message = null ) { if ( ! $ value instanceof $ class ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected instance of %2$s, but got %s' , Helper :: typeToString ( $ value ) , $ class ) ) ; } } | Assert that the value is instance of class . |
56,379 | public static function isResource ( $ value , $ message = null ) { if ( ! is_resource ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected resource, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is resource . |
56,380 | public static function isDirectory ( $ value , $ message = null ) { if ( ! is_string ( $ value ) || ! is_dir ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected directory, but got %s' , Helper :: valueToString ( $ value ) ) ) ; } } | Assert that the value is directory . |
56,381 | public static function isFile ( $ value , $ message = null ) { if ( ! is_string ( $ value ) || ! is_file ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected file, but got %s' , Helper :: valueToString ( $ value ) ) ) ; } } | Assert that the value is file . |
56,382 | public static function isNullOrBoolean ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_bool ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or boolean, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or boolean . |
56,383 | public static function isNullOrInteger ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_int ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or integer, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or integer . |
56,384 | public static function isNullOrNumeric ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_numeric ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or numeric, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or numeric . |
56,385 | public static function isNullOrFloat ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_float ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or float, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or float . |
56,386 | public static function isNullOrString ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_string ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or string, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or string . |
56,387 | public static function isNullOrScalar ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_scalar ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or scalar, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or scalar . |
56,388 | public static function isNullOrArray ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_array ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or array, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or array . |
56,389 | public static function isNullOrCallable ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_callable ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or callable, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or callable . |
56,390 | public static function isNullOrInstanceOf ( $ value , $ class , $ message = null ) { if ( ! is_null ( $ value ) && ! $ value instanceof $ class ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or instance of %2$s, but got %s' , Helper :: typeToString ( $ value ) , $ class ) ) ; } } | Assert that the value is null or instance of class . |
56,391 | public static function isNullOrTraversable ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_array ( $ value ) && ! $ value instanceof Traversable ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or traversable, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or traversable . |
56,392 | public static function isNullOrResource ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! is_resource ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or resource, but got %s' , Helper :: typeToString ( $ value ) ) ) ; } } | Assert that the value is null or resource . |
56,393 | public static function isNullOrDirectory ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! ( is_string ( $ value ) && is_dir ( $ value ) ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or directory, but got %s' , Helper :: valueToString ( $ value ) ) ) ; } } | Assert that the value is null or directory . |
56,394 | public static function isNullOrFile ( $ value , $ message = null ) { if ( ! is_null ( $ value ) && ! ( is_string ( $ value ) && is_file ( $ value ) ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected null or file, but got %s' , Helper :: valueToString ( $ value ) ) ) ; } } | Assert that the value is null or file . |
56,395 | public static function keyExists ( $ value , $ key , $ message = null ) { if ( ! array_key_exists ( $ key , $ value ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Expected array key %2$s to exist' , Helper :: typeToString ( $ value ) , Helper :: valueToString ( $ key ) ) ) ; } } | Assert that key exists in value . |
56,396 | public static function inArray ( $ value , array $ array , $ message = null ) { if ( ! in_array ( $ value , $ array ) ) { throw new InvalidArgumentException ( sprintf ( $ message ? : 'Value %s is not in array' , Helper :: valueToString ( $ value ) ) ) ; } } | Assert that value is in array . |
56,397 | protected function doExecute ( ActionInterface $ action , $ reprocess = false ) { $ definition = $ this -> findActionDefinitionByName ( $ action -> getName ( ) ) ; if ( null == $ definition ) { throw new \ RuntimeException ( sprintf ( 'Could not load action definition for action %a' , $ action -> getName ( ) ) ) ; } $ ... | Start the execution of an action or schedule the action for processing later on |
56,398 | public static function getStatusMessage ( $ code ) { if ( ! $ code ) { return '' ; } return isset ( self :: $ statusMessages [ $ code ] ) ? self :: $ statusMessages [ $ code ] : '' ; } | Returns a messages for a given code |
56,399 | protected function addOrEditObject ( $ data = [ ] , $ redirect = TRUE ) { try { if ( $ this -> detailObject ) { $ this -> canUser ( 'edit' ) ; $ this -> mainManager -> edit ( $ this -> detailObject -> id , $ data ) ; $ this -> flashMessage ( 'Object saved' ) ; } else { $ this -> canUser ( 'add' ) ; $ this -> mainManage... | Simple implementation add or edit object |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.