idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
17,400 | protected function processFormData ( WebRequest $ request , Response $ response , User $ user ) { $ result = $ this -> layout -> validateFormData ( $ request , $ response , function ( $ formValues ) use ( $ user ) { return $ this -> validateData ( $ user , $ formValues [ 'required-data.username' ] , $ formValues [ 'req... | Validates the form data updates the user and saves the user into the database . |
17,401 | protected function isUsernameInUse ( $ username , User $ user ) { return ( $ this -> userManager -> hasUserForUsername ( $ username ) && $ this -> userManager -> getUserForUsername ( $ username ) -> getUuid ( ) != $ user -> getUuid ( ) ) ; } | Returns true if the username is in use and not is the edited user . |
17,402 | public function render ( $ view , $ data = [ ] ) { $ this -> writeFile ( $ view ) ; $ blade = new Blade ( $ this -> getViewPath ( ) , $ this -> getCachePath ( ) ) ; if ( is_array ( $ data ) ) { return $ blade -> view ( ) -> make ( $ view , $ data ) -> render ( ) ; } else { throw new Exception ( 'data pass into view mus... | return blade template |
17,403 | public function writeFile ( $ path ) { $ fullPath = $ this -> viewDir . DIRECTORY_SEPARATOR . $ this -> transformDotToSlash ( $ path ) . '.blade.php' ; if ( ! FacadeStorage :: has ( $ fullPath ) ) { FacadeStorage :: createDir ( dirname ( $ fullPath ) ) ; return FacadeStorage :: write ( $ fullPath , '' ) ; } return fals... | create blade file |
17,404 | public function createCacheDir ( ) { if ( ! FacadeStorage :: has ( $ this -> cacheDir ) ) { return FacadeStorage :: createDir ( $ this -> cacheDir ) ; } return false ; } | create cache folder |
17,405 | public function create ( Strategy $ strategy ) { $ this -> getEm ( ) -> persist ( $ strategy ) ; $ this -> getEm ( ) -> flush ( ) ; return $ strategy ; } | Create a new Strategy . |
17,406 | public static function getInstance ( array $ scope = [ ] , $ options = self :: ACTION_ALL ) { if ( ! is_object ( self :: $ instance ) ) { self :: $ instance = new static ( $ scope , $ options ) ; } return self :: $ instance ; } | Returns static registry instance . |
17,407 | public function override ( array $ scope ) { $ this -> checkPermissions ( null , self :: ACTION_OVERRIDE ) ; $ this -> scope = $ scope ; } | Overrides scope . |
17,408 | protected function checkPermissions ( $ key , $ action ) { if ( ! ( $ action & $ this -> options ) ) { $ originalKey = is_null ( $ this -> key ) ? $ key : $ this -> key ; $ this -> key = null ; $ text = Friendlification :: getConstNameByValue ( __CLASS__ , $ action ) ; throw new RuntimeException ( is_null ( $ key ) ? s... | Check action permissions . |
17,409 | protected function getByRef ( $ key , & $ value ) { if ( ! $ this -> checkRefs || ! is_string ( $ value ) ) { return ; } $ this -> checkRefs = false ; $ references = [ $ key ] ; $ key = $ value ; while ( $ this -> isRef ( $ key ) ) { if ( in_array ( $ key , $ references ) ) { $ this -> checkRefs = true ; $ this -> key ... | Gets value by reference if possible . |
17,410 | protected function isRef ( & $ value , $ modify = true ) { $ matches = null ; $ result = is_string ( $ value ) && preg_match ( $ this -> refPattern , $ value , $ matches ) ; if ( $ result && $ modify ) { $ value = $ matches [ 1 ] ; } return $ result ; } | Validates if passed value is reference . |
17,411 | public function render ( $ container = null ) { if ( null !== $ container ) { $ this -> setContainer ( $ container ) ; } $ container = $ this -> getContainer ( ) ; $ brand = $ container -> findOneBy ( 'class' , 'brand' ) ; if ( $ brand ) { $ container -> removePage ( $ brand ) ; } $ viewModel = new ViewModel ( ) ; $ vi... | Renders navigation bar |
17,412 | public static function anchor ( $ href , $ text = null , $ attr = array ( ) , $ secure = null ) { if ( ! preg_match ( '#^(\w+://|javascript:|\#)# i' , $ href ) ) { $ urlparts = explode ( '?' , $ href , 2 ) ; $ href = \ Uri :: create ( $ urlparts [ 0 ] , array ( ) , isset ( $ urlparts [ 1 ] ) ? $ urlparts [ 1 ] : array ... | Creates an html link |
17,413 | public static function img ( $ src , $ attr = array ( ) ) { if ( ! preg_match ( '#^(\w+://)# i' , $ src ) ) { $ src = \ Uri :: base ( false ) . $ src ; } $ attr [ 'src' ] = $ src ; $ attr [ 'alt' ] = ( isset ( $ attr [ 'alt' ] ) ) ? $ attr [ 'alt' ] : pathinfo ( $ src , PATHINFO_FILENAME ) ; return html_tag ( 'img' , $... | Creates an html image tag |
17,414 | public static function mail_to_safe ( $ email , $ text = null , $ subject = null , $ attr = array ( ) ) { $ text or $ text = str_replace ( '@' , '[at]' , $ email ) ; $ email = explode ( "@" , $ email ) ; $ subject and $ subject = '?subject=' . $ subject ; $ attr = array_to_attr ( $ attr ) ; $ attr = ( $ attr == '' ? ''... | Creates a mailto link with Javascript to prevent bots from picking up the email address . |
17,415 | public static function meta ( $ name = '' , $ content = '' , $ type = 'name' ) { if ( ! is_array ( $ name ) ) { $ result = html_tag ( 'meta' , array ( $ type => $ name , 'content' => $ content ) ) ; } elseif ( is_array ( $ name ) ) { $ result = "" ; foreach ( $ name as $ array ) { $ meta = $ array ; $ result .= "\n" . ... | Generates a html meta tag |
17,416 | public static function doctype ( $ type = 'xhtml1-trans' ) { if ( static :: $ doctypes === null ) { \ Config :: load ( 'doctypes' , true ) ; static :: $ doctypes = \ Config :: get ( 'doctypes' , array ( ) ) ; } if ( is_array ( static :: $ doctypes ) and isset ( static :: $ doctypes [ $ type ] ) ) { if ( $ type == "html... | Generates a html doctype tag |
17,417 | public static function audio ( $ src = '' , $ attr = false ) { if ( static :: $ html5 ) { if ( is_array ( $ src ) ) { $ source = '' ; foreach ( $ src as $ item ) { $ source .= html_tag ( 'source' , array ( 'src' => $ item ) ) ; } } else { $ source = html_tag ( 'source' , array ( 'src' => $ src ) ) ; } return html_tag (... | Generates a html5 audio tag It is required that you set html5 as the doctype to use this method |
17,418 | protected static function build_list ( $ type = 'ul' , array $ list = array ( ) , $ attr = false , $ indent = '' ) { if ( ! is_array ( $ list ) ) { $ result = false ; } $ out = '' ; foreach ( $ list as $ key => $ val ) { if ( ! is_array ( $ val ) ) { $ out .= $ indent . "\t" . html_tag ( 'li' , false , $ val ) . PHP_EO... | Generates the html for the list methods |
17,419 | public function build ( ) { $ this -> _checkJoinArray ( ) ; $ this -> way = ( $ this -> joinArray [ 'way' ] ) ? strtoupper ( str_replace ( ':' , ' ' , $ this -> joinArray [ 'way' ] ) ) . ' ' : null ; $ this -> _prepareJoinTable ( $ this -> joinArray [ 'tables' ] ) ; $ this -> conditionType = strtoupper ( $ this -> join... | Build the join expression string . Processing the passed join expression and return it in form of a string . |
17,420 | private function _checkJoinArray ( ) { $ defaultJoinArray = array ( 'way' => null , 'tables' => null , 'conditionType' => null , 'condition' => null ) ; if ( $ this -> joinArray === $ defaultJoinArray ) { throw new \ Exception ( 'one of the methods: inner(), natural(), left[Outer](), right[Outer] must called before!' )... | Compare the join array with the expressions default join array and throw an exception if they are the same . |
17,421 | private function _prepareJoinTable ( array $ tables ) { $ this -> tables = ' ' ; foreach ( $ tables as $ tableObj ) { $ this -> tables .= $ tableObj -> getExpression ( ) . ', ' ; } $ this -> tables = rtrim ( rtrim ( $ this -> tables ) , ',' ) . ' ' ; } | Validate the tables array to a string . |
17,422 | private function _prepareJoinCondition ( array $ condition ) { if ( count ( $ condition ) === 1 ) { return $ this -> condition = '(' . $ condition [ 0 ] -> getColumnName ( ) . ')' ; } return $ this -> condition = $ condition [ 0 ] -> getTableName ( ) . '.' . $ condition [ 0 ] -> getColumnName ( ) . ' = ' . $ condition ... | Validate the columns array to a string . |
17,423 | public function requireDefaultRecords ( ) { parent :: requireDefaultRecords ( ) ; $ ssLoginUserName = Environment :: getEnv ( 'SS_DEFAULT_ADMIN_USERNAME' ) ; if ( ! $ ssLoginUserName ) { return ; } $ member = Member :: get ( ) -> find ( Member :: config ( ) -> get ( 'unique_identifier_field' ) , $ ssLoginUserName ) ; i... | Set up default default admin record |
17,424 | public static function getILoggerFactory ( ) { static $ nop ; if ( null === self :: $ factory ) { if ( null == $ nop ) { $ nop = new NOPLoggerFactory ( ) ; } return $ nop ; } return self :: $ factory ; } | Get the currently configured ILoggerFactory . |
17,425 | public function assign ( $ array = [ ] ) { foreach ( $ array as $ key => $ value ) { if ( is_string ( $ key ) ) { $ this -> set ( $ key , $ value ) ; } } return $ this ; } | Assigns variables in bulk in the current scope |
17,426 | public function init ( ) { parent :: init ( ) ; if ( get_class ( Yii :: app ( ) ) != "CConsoleApplication" ) { $ asset = Yii :: app ( ) -> assetManager -> publish ( __DIR__ . DS . '..' . DS . 'assets' . DS . 'dist' , true , - 1 , YII_DEBUG ) ; $ cs = Yii :: app ( ) -> getClientScript ( ) ; $ cs -> registerScriptFile ( ... | Init function overloaded to inject CiiAnalytics JS Tracking |
17,427 | private function getAnalyticsProviders ( ) { $ providers = Yii :: app ( ) -> cache -> get ( 'analyticsjs_providers' ) ; if ( $ providers === false ) { $ analytics = new AnalyticsSettings ; $ rules = $ analytics -> rules ( ) ; unset ( $ analytics ) ; $ providers = array ( ) ; $ response = Yii :: app ( ) -> db -> createC... | Retrieves Analytics . js Providers |
17,428 | public function retrieve_items ( $ look_at = false ) { $ json = \ call_user_func ( $ this -> feed_callback , $ this -> url ) ; $ raw = $ this -> parse_feed ( $ json ) ; $ this -> items = $ raw ; if ( $ look_at !== false ) { $ this -> items = $ raw [ $ look_at ] ; } } | Pull the items from the web and store them in this object |
17,429 | public function valid ( ) { $ valid = $ this -> current ( ) ; if ( ( ( $ this -> position + 1 ) > $ this -> displayLimit ) ) { $ valid = false ; } return $ valid ; } | Check to see if we want to terminate this loop . |
17,430 | private function setPrefix ( $ prefix ) { if ( 0 === strlen ( $ prefix ) ) { throw new \ InvalidArgumentException ( 'Group prefix may not be empty.' ) ; } $ prefix = '/' . trim ( $ prefix , '/' ) ; $ this -> prefix = $ this -> hasParent ( ) ? $ this -> parent -> getPrefix ( ) . $ prefix : $ prefix ; } | Set the group prefix |
17,431 | private function setRequirements ( array $ requirements ) { $ requirements = $ this -> filterRequirements ( $ requirements ) ; $ this -> requirements = $ this -> hasParent ( ) ? array_merge ( $ this -> parent -> getRequirements ( ) , $ requirements ) : $ requirements ; } | Set the group requirements |
17,432 | protected function processDataSource ( OutputInterface $ output , $ service , $ dataSourceOptions ) { $ this -> typeCheckGoogleDriveProcessService ( $ service ) ; $ output -> writeln ( $ service -> processGoogleUrl ( $ this -> doCreateGoogleDriveProcessor ( ) , $ dataSourceOptions [ 'url' ] , $ dataSourceOptions [ 'rec... | Invoke the GoogleDriveProcessService to process the data source . |
17,433 | public static function retrieveSocialRecord ( $ globalID , $ skipCache = false ) { if ( Sonic :: socialRecordCachingEnabled ( ) === true && $ skipCache === false ) { $ sr = Sonic :: getSocialRecordCaching ( ) -> getSocialRecordFromCache ( $ globalID ) ; if ( $ sr !== false ) { $ sr -> verify ( ) ; return $ sr ; } } ret... | Retrieves a SocialRecord for a given GID from the GSLS or local cache throws Exception |
17,434 | public static function socialRecordExists ( $ globalID ) { if ( ! GID :: isValid ( $ globalID ) ) { throw new \ Exception ( 'Illegal GID format' ) ; } try { $ result = GSLS :: getSocialRecord ( $ globalID ) ; } catch ( SocialRecordNotFoundException $ e ) { return false ; } return true ; } | Checks if a SocialRecord is available in the GSLS for a given GID throws Exception |
17,435 | public static function exportSocialRecord ( SocialRecord $ socialRecord , KeyPair $ accountKeyPair = NULL , KeyPair $ personalKeyPair = NULL ) { $ json = new JSONObject ( ) ; $ json -> put ( 'socialRecord' , $ socialRecord -> getJSONObject ( ) ) ; if ( $ accountKeyPair != NULL ) $ json -> put ( 'accountPrivateKey' , Pr... | Exports a SocialRecord object to a serialized JSONObject |
17,436 | public static function importSocialRecord ( $ source ) { $ json = new JSONObject ( $ source ) ; $ socialRecord = SocialRecordBuilder :: buildFromJSON ( $ json -> get ( 'socialRecord' ) ) ; $ result = array ( 'socialRecord' => $ socialRecord ) ; if ( $ json -> has ( 'accountPrivateKey' ) ) $ result [ 'accountKeyPair' ] ... | Imports a SocialRecord from a string resource |
17,437 | protected function calculatePagination ( ) { if ( empty ( $ this -> pagination [ 'array' ] ) && empty ( $ this -> pagination [ 'call' ] ) ) { return ; } if ( isset ( $ this -> pagination [ 'call' ] ) ) { $ this -> pagination [ 'array' ] = $ this -> callFunction ( $ this -> pagination [ 'call' ] ) ; } $ keys = [ 'toPlac... | Adding pagination . |
17,438 | public function getData ( string $ plugin = null ) { if ( ! is_null ( $ plugin ) ) { return $ this -> getPlugin ( $ plugin ) -> getContainer ( ) -> getData ( ) ; } $ data = [ ] ; foreach ( $ this -> plugins as $ plugin ) { $ data [ $ plugin -> getName ( ) ] = $ plugin -> getContainer ( ) -> getData ( ) ; } return $ dat... | Get data in the container . |
17,439 | public function actionCreate ( ) { $ user = new User ( ) ; $ this -> readValue ( $ user , 'username' ) ; $ this -> readValue ( $ user , 'email' ) ; $ user -> setPassword ( $ this -> prompt ( 'Password:' , [ 'required' => true , 'pattern' => '#^.{6,255}$#i' , 'error' => 'More than 6 symbols' , ] ) ) ; $ user -> generate... | Creates new user . |
17,440 | public function actionRemove ( ) { $ username = $ this -> prompt ( 'Username:' , [ 'required' => true ] ) ; $ user = $ this -> findModel ( $ username ) ; $ this -> log ( $ this -> repository -> remove ( $ user ) ) ; } | Removes user by username . |
17,441 | public function actionActivate ( ) { $ username = $ this -> prompt ( 'Username:' , [ 'required' => true ] ) ; $ user = $ this -> findModel ( $ username ) ; $ user -> status = User :: STATUS_ACTIVE ; $ this -> log ( $ this -> repository -> save ( $ user ) ) ; } | Activates user . |
17,442 | public function actionBlocked ( ) { $ username = $ this -> prompt ( 'Username:' , [ 'required' => true ] ) ; $ user = $ this -> findModel ( $ username ) ; $ user -> status = User :: STATUS_BLOCKED ; $ this -> log ( $ this -> repository -> save ( $ user ) ) ; } | Blocked user . |
17,443 | public function actionChangePassword ( ) { $ username = $ this -> prompt ( 'Username:' , [ 'required' => true ] ) ; $ user = $ this -> findModel ( $ username ) ; $ user -> setPassword ( $ this -> prompt ( 'New password:' , [ 'required' => true , 'pattern' => '#^.{6,255}$#i' , 'error' => 'More than 6 symbols' , ] ) ) ; ... | Changes user password . |
17,444 | public function isRequired ( ) : bool { foreach ( $ this -> validationRules as $ rule ) { if ( $ rule instanceof Required ) { return true ; } } return false ; } | Checks whether the field is required |
17,445 | public function getValue ( ) : string { if ( ! $ this -> validated && $ this -> defaultValue !== null ) { return $ this -> defaultValue ; } if ( $ this -> value === null ) { return '' ; } return $ this -> value ; } | Gets the field s value |
17,446 | public function validate ( ) { foreach ( $ this -> validationRules as $ rule ) { $ rule -> validate ( $ this -> getValue ( ) ) ; if ( ! $ rule -> isValid ( ) ) { $ this -> errors += $ rule -> getError ( ) ; } } $ this -> validated = true ; } | Validates the field |
17,447 | public function findAllByAutenticacaoId ( $ autenticacaoId ) { $ sql = new Sql ( $ this -> dbAdapter ) ; $ select = $ sql -> select ( $ this -> tableName ) -> where ( array ( 'autenticacao_id' => $ autenticacaoId ) ) ; $ stmt = $ sql -> prepareStatementForSqlObject ( $ select ) ; $ result = $ stmt -> execute ( ) ; if (... | Encontra um iterador com todos as compras relacionadas a uma autenticacao no BD |
17,448 | protected function getInternalFieldConstraints ( $ fieldName ) { return parent :: getInternalFieldConstraints ( $ fieldName ) -> append ( ArrayList :: of ( [ $ this -> getFieldType ( $ fieldName ) ] ) ) ; } | Get all the constraints for a field . |
17,449 | public function getFieldType ( $ fieldName ) { return Maybe :: fromMaybe ( Boa :: any ( ) , $ this -> getFieldAnnotation ( $ fieldName , static :: ANNOTATION_TYPE ) ) ; } | Get the type annotation for a field . |
17,450 | public function getResource ( $ identifier ) { $ user = $ this -> userManager -> findUserByUsername ( $ identifier ) ; if ( ! $ user ) { throw new NotFoundHttpException ( $ this -> translator -> trans ( 'error.user_not_found' , array ( '%id%' => $ identifier ) ) ) ; } return $ this -> createResourceFromUser ( $ user ) ... | Returns a resource representation of the user with the given username . |
17,451 | public function getCollection ( array $ options = array ( ) ) { $ collection = $ this -> userManager -> findUsers ( ) ; $ resource = new Resource ( $ this -> generateBrowseUrl ( ) , array ( 'count' => count ( $ collection ) ) ) ; foreach ( $ collection as $ element ) { $ resource -> setEmbedded ( 'user' , $ this -> cre... | Returns all users in a single collection resource . |
17,452 | public function populateResourceWithForm ( Resource $ resource , FormInterface $ form ) { $ formData = $ form -> getData ( ) ; $ resource -> setData ( array ( 'username' => $ formData [ 'username' ] , 'email' => $ formData [ 'email' ] ) ) ; } | Populates the given resource with the values in the form ; overwriting any existing items . |
17,453 | public function delete ( Resource $ resource ) { $ data = $ resource -> toArray ( ) ; $ user = $ this -> userManager -> findUserByUsername ( $ data [ 'username' ] ) ; if ( ! $ user ) { $ errorMessage = $ this -> translator -> trans ( 'error.user_not_found' , array ( '%username%' => $ data [ 'username' ] ) ) ; throw new... | Removes the User from the database . |
17,454 | public function generateReadUrl ( $ resourceOrIdentifier ) { if ( $ resourceOrIdentifier instanceof Resource ) { $ data = $ resourceOrIdentifier -> toArray ( ) ; $ id = $ data [ 'username' ] ; } else { $ id = $ resourceOrIdentifier ; } $ route = $ this -> router -> generate ( 'ingewikkeld_rest_user_user_read' , array (... | Generate the URL for the read page for the given resource . |
17,455 | protected function createResourceFromUser ( UserEntity $ user ) { $ resource = new Resource ( $ this -> generateReadUrl ( $ user -> getUsernameCanonical ( ) ) , array ( 'username' => $ user -> getUsernameCanonical ( ) , 'email' => $ user -> getEmail ( ) , 'last_login' => $ user -> getLastLogin ( ) ? $ user -> getLastLo... | Creates a resource object from the User entity . |
17,456 | private function defineStyles ( array $ options = array ( ) ) { $ this -> _style = new ZfPdf \ Style ( ) ; $ this -> _style -> setFillColor ( new ZfPdf \ Color \ Html ( $ options [ 'colors' ] [ 'lines' ] ) ) ; $ this -> _topo = new ZfPdf \ Style ( ) ; $ this -> _topo -> setFillColor ( new ZfPdf \ Color \ Html ( $ optio... | Define os estilos do documento |
17,457 | private function drawFieldName ( ) { $ iTitulos = 0 ; $ this -> _page -> setFont ( $ this -> _font , $ this -> _cellFontSize + 1 ) ; foreach ( $ this -> _arrayForm [ 'gridfieldsconfig' ] as $ field => $ value ) { if ( ( int ) $ this -> _la == 0 ) { $ this -> _largura1 = 40 ; } else { $ this -> _largura1 = $ this -> _ce... | Desenha os campos em formato tabela |
17,458 | public function updateRelations ( $ entity ) { $ mapper = MapperBuilder :: buildFromMapping ( $ this -> mapping , get_class ( $ entity ) ) ; foreach ( $ mapper -> getRelations ( ) as $ relation ) { if ( $ relation -> getCardinality ( ) == Relation :: $ manyToMany ) { $ queryDeletePrevious = $ this -> buildDeleteRelatio... | Update the entity relations . |
17,459 | public function buildDeleteQuery ( $ entity ) { $ mapper = MapperBuilder :: buildFromMapping ( $ this -> mapping , get_class ( $ entity ) ) ; $ query = "" ; foreach ( $ mapper -> getRelations ( ) as $ relation ) { $ query .= $ this -> buildDeleteRelationQuery ( $ relation , $ entity ) ; } $ query .= "DELETE FROM " . $ ... | Build a delete query for an entity . |
17,460 | public function buildDeleteRelationQuery ( $ relation , $ entity ) { $ query = "DELETE FROM " . $ relation -> getTable ( ) . " " ; $ query .= "WHERE " . $ relation -> getForeignColumn ( ) . " = '" . $ entity -> getId ( ) . "';" ; return $ query ; } | Build a delete query for an entity an its relation . |
17,461 | protected function runFilters ( $ when , $ action ) { $ when = "_{$when}" ; $ filters = static :: $ { $ when } ; if ( array_key_exists ( $ action , $ filters ) ) { foreach ( $ filters [ $ action ] as $ method ) { $ this -> { $ method } ( ) ; } } } | Runs the filters for the specified action . |
17,462 | public static function callEvents ( MocaBonita $ mocaBonita , $ dispatch , $ complement = null ) { foreach ( $ mocaBonita -> getMbEvents ( $ dispatch ) as $ event ) { call_user_func_array ( [ $ event , $ dispatch ] , [ $ mocaBonita -> getMbRequest ( ) , $ mocaBonita -> getMbResponse ( ) , $ complement ] ) ; } } | Call page events |
17,463 | public function startWpDispatcher ( MbRequest $ mbRequest , MbResponse $ mbResponse , MocaBonita $ mocaBonita ) { $ className = static :: class ; $ methodName = __METHOD__ ; throw new MbException ( "{$methodName} not allowed in! {$className}." ) ; } | Event that will start after wordpress initialize |
17,464 | public function beforePageDispatcher ( MbRequest $ mbRequest , MbResponse $ mbResponse , MbPage $ mbPage ) { $ className = static :: class ; $ methodName = __METHOD__ ; throw new MbException ( "{$methodName} not allowed in! {$className}." ) ; } | Event that will start before running the page |
17,465 | public function afterShortcodeDispatcher ( MbRequest $ mbRequest , MbResponse $ mbResponse , MbShortCode $ mbShortCode ) { $ className = static :: class ; $ methodName = __METHOD__ ; throw new MbException ( "{$methodName} not allowed in! {$className}." ) ; } | Event that will start after running the shortcode |
17,466 | public function beforeActionDispatcher ( MbRequest $ mbRequest , MbResponse $ mbResponse , MbAction $ mbAction ) { $ className = static :: class ; $ methodName = __METHOD__ ; throw new MbException ( "{$methodName} not allowed in! {$className}." ) ; } | Event that will start before running the action |
17,467 | public function afterActionDispatcher ( MbRequest $ mbRequest , MbResponse $ mbResponse , MbAction $ acaombAction ) { $ className = static :: class ; $ methodName = __METHOD__ ; throw new MbException ( "{$methodName} not allowed in! {$className}." ) ; } | Event that will start after running the action |
17,468 | public function exceptionActionDispatcher ( MbRequest $ mbRequest , MbResponse $ mbResponse , \ Exception $ exception ) { $ className = static :: class ; $ methodName = __METHOD__ ; throw new MbException ( "{$methodName} not allowed in! {$className}." ) ; } | Event that will start after the action launches an exception |
17,469 | public function createUsingLastXmlError ( ) { $ errors = array ( ) ; $ count = 0 ; foreach ( libxml_get_errors ( ) as $ error ) { $ errors [ ] = sprintf ( '#%d.) "%s" in %s line %d column %d.' , ++ $ count , trim ( $ error -> message ) , $ error -> file , $ error -> line , $ error -> column ) ; } $ this -> finish ( ) ;... | Creates a new exception using the most recent libxml errors . |
17,470 | public function getValue ( ) { $ values = [ ] ; $ this -> getChildren ( ) -> forAll ( function ( ElementInterface $ child ) use ( & $ values ) { foreach ( $ this -> locales as $ locale ) { $ values [ $ locale [ 'code' ] ] [ $ child -> getName ( ) ] = $ this -> getChildValue ( $ child , $ locale [ 'code' ] ) ; } } ) ; r... | Returns fieldset values |
17,471 | protected function prepareLanguages ( ) { $ options = [ ] ; foreach ( $ this -> options [ 'languages' ] as $ language ) { $ options [ ] = $ this -> prepareLanguage ( $ language ) ; } return $ options ; } | Prepares the languages |
17,472 | protected function prepareLanguage ( $ language ) { $ value = addslashes ( $ language [ 'code' ] ) ; $ label = addslashes ( $ language [ 'code' ] ) ; $ flag = addslashes ( sprintf ( '%s.png' , substr ( $ label , 0 , 2 ) ) ) ; return [ 'sValue' => $ value , 'sLabel' => $ label , 'sFlag' => $ flag , ] ; } | Prepares language to use it as element attribute |
17,473 | protected function convertRepetitionsData ( $ data ) { $ values = [ ] ; foreach ( $ data as $ locale => $ translation ) { foreach ( $ translation as $ fieldName => $ fieldValue ) { $ values [ $ fieldName ] [ $ locale ] = $ fieldValue ; } } return $ values ; } | Flips language repetitions |
17,474 | protected function getChildValue ( ElementInterface $ child , $ locale ) { $ accessor = $ this -> getPropertyAccessor ( ) ; $ value = $ child -> getValue ( ) ; if ( is_array ( $ value ) ) { return $ accessor -> getValue ( $ value , "[{$locale}]" ) ; } return null ; } | Returns child values |
17,475 | public static function getHeaderValue ( $ key = 'Content-Type' , $ headers = array ( ) ) { $ value = null ; if ( empty ( $ headers ) ) { if ( function_exists ( 'headers_list' ) ) { $ headers = headers_list ( ) ; } elseif ( function_exists ( 'apache_response_headers' ) ) { $ headers = apache_response_headers ( ) ; if ( ... | Get header value |
17,476 | public static function isIpIn ( $ ipAddr , $ net , $ mask ) { $ ipAddr = ip2long ( $ ipAddr ) ; $ rede = ip2long ( $ net ) ; $ mask = ip2long ( $ mask ) ; $ res = $ ipAddr & $ mask ; return ( $ res == $ rede ) ; } | is IP address in given subnet? |
17,477 | public static function isIpLocal ( $ ipAddr ) { $ return = false ; if ( $ ipAddr == '::1' ) { $ ipAddr = '127.0.0.1' ; } $ net_n_masks = array ( array ( '127.0.0.0' , '255.0.0.0' ) , array ( '10.0.0.0' , '255.0.0.0' ) , array ( '192.168.0.0' , '255.255.0.0' ) , array ( '172.16.0.0' , '255.240.0.0' ) , array ( '169.254.... | Returns whether or not IP address is on a local network |
17,478 | public static function parseHeaders ( $ headerString ) { $ headers = explode ( "\n" , $ headerString ) ; $ keys = array_keys ( $ headers ) ; $ regexReturnCode = '/^\S+\s+(\d+)\s?(.*)/' ; $ regexHeader = '/^(.*?):\s*(.*)$/' ; $ headers [ 'Return-Code' ] = preg_match ( $ regexReturnCode , $ headerString , $ matches ) ? $... | Parse header string |
17,479 | public function createCursorRecordSet ( EntityMetadata $ metadata , Cursor $ cursor , Store $ store ) { return new CursorRecordSet ( $ metadata , $ cursor , $ store , $ this ) ; } | Creates a cursor record set object from a MongoDB cursor . |
17,480 | public function extractType ( EntityMetadata $ metadata , array $ record ) { if ( false === $ metadata -> isPolymorphic ( ) ) { return $ metadata -> type ; } return $ this -> extractField ( Persister :: POLYMORPHIC_KEY , $ record ) ; } | Extracts the model type from a raw MongoDB record . |
17,481 | private function convertRelationships ( EntityMetadata $ metadata , array $ data ) { foreach ( $ metadata -> getRelationships ( ) as $ key => $ relMeta ) { if ( ! isset ( $ data [ $ key ] ) ) { continue ; } if ( true === $ relMeta -> isMany ( ) && ! is_array ( $ data [ $ key ] ) ) { throw PersisterException :: badReque... | Converts the relationships on a raw result to the proper format . |
17,482 | private function extractField ( $ key , array $ data ) { if ( ! isset ( $ data [ $ key ] ) ) { throw PersisterException :: badRequest ( sprintf ( 'Unable to extract a field value. The "%s" key was not found.' , $ key ) ) ; } return $ data [ $ key ] ; } | Extracts a root field from a raw MongoDB result . |
17,483 | private function extractIdAndType ( EntityMetadata $ metadata , array & $ data ) { $ identifier = $ this -> extractField ( Persister :: IDENTIFIER_KEY , $ data ) ; unset ( $ data [ Persister :: IDENTIFIER_KEY ] ) ; $ key = Persister :: POLYMORPHIC_KEY ; $ type = $ this -> extractType ( $ metadata , $ data ) ; if ( isse... | Extracts the identifier and model type from a raw result and removes them from the source data . Returns as a tuple . |
17,484 | private function extractRelationship ( RelationshipMetadata $ relMeta , $ reference ) { $ simple = false === $ relMeta -> isPolymorphic ( ) ; $ idKey = Persister :: IDENTIFIER_KEY ; $ typeKey = Persister :: POLYMORPHIC_KEY ; if ( true === $ simple && is_array ( $ reference ) && isset ( $ reference [ $ idKey ] ) ) { ret... | Extracts a standard relationship array that the store expects from a raw MongoDB reference value . |
17,485 | protected function setUpdatedAt ( ) { if ( isset ( $ this -> created_at ) ) { $ this -> created_at = Time :: localToGmt ( $ this -> created_at ) ; } if ( ! isset ( $ this -> updated_at ) or $ this -> updated_at === null ) { $ this -> updated_at = 'NOW()' ; } } | Set the updated_at value . |
17,486 | public function getItem ( string $ name ) { if ( isset ( $ this -> __delayItems [ $ name ] ) ) { return $ this -> __delayItems [ $ name ] ; } if ( ! is_callable ( $ this -> __delayCtors [ $ name ] ?? false ) ) { throw new Exception ( "Item {$name} not found." , Exception :: ITEM_NOT_FOUND ) ; } return $ this -> __delay... | Get a delay - initialized item by name . |
17,487 | private function injectDependencies ( RegistryInterface $ registry , $ entityName = null , EntityManager $ entityManager = null ) { if ( ! ( $ entityManager instanceof EntityManager ) ) { $ entityManager = $ this -> container -> get ( 'doctrine.orm.entity_manager' ) ; } if ( $ registry instanceof EntityManagerAwareInte... | Inject dependencies using implemented interfaces to registry |
17,488 | public function getRegistry ( string $ registryName , $ entityClass = null , EntityManager $ entityManager = null ) { if ( ! array_key_exists ( $ registryName , self :: $ registries ) ) { throw new InvalidRegistryName ( $ registryName ) ; } $ reflectionClass = new \ ReflectionClass ( self :: $ registries [ $ registryNa... | Gets a registry from its name |
17,489 | public function persist ( $ object , $ flush = true ) { if ( $ object -> getId ( ) ) { $ this -> update ( $ object , $ flush ) ; } else { $ this -> create ( $ object , $ flush ) ; } } | Persist an object into database . |
17,490 | public function create ( $ object , $ flush = true ) { try { $ entityManager = $ this -> getEntityManager ( $ object ) ; $ this -> preCreate ( $ object ) ; $ entityManager -> persist ( $ object ) ; if ( $ flush ) { $ entityManager -> flush ( ) ; } $ this -> postCreate ( $ object ) ; } catch ( \ PDOException $ e ) { thr... | create new entity in database . |
17,491 | public function update ( $ object , $ flush = true ) { try { $ entityManager = $ this -> getEntityManager ( $ object ) ; $ this -> preUpdate ( $ object ) ; $ entityManager -> persist ( $ object ) ; if ( $ flush ) { $ entityManager -> flush ( ) ; } $ this -> postUpdate ( $ object ) ; } catch ( \ PDOException $ e ) { thr... | update an object into database . |
17,492 | public function delete ( $ object , $ flush = true ) { try { $ entityManager = $ this -> getEntityManager ( $ object ) ; $ this -> preDelete ( $ object ) ; $ entityManager -> remove ( $ object ) ; if ( $ flush ) { $ entityManager -> flush ( ) ; } $ this -> postDelete ( $ object ) ; } catch ( \ PDOException $ e ) { thro... | delete an object from database . |
17,493 | public function getBatchObjects ( $ class , ProxyQueryInterface $ queryProxy ) { $ queryProxy -> select ( 'DISTINCT ' . $ queryProxy -> getRootAlias ( ) ) ; return $ queryProxy -> getQuery ( ) -> execute ( ) ; } | Retrieve objects from a batch request . |
17,494 | public function WriteByJs ( $ string ) { $ resultStringArr = [ ] ; for ( $ i = 0 , $ l = strlen ( $ string ) ; $ i < $ l ; $ i ++ ) { $ char = mb_substr ( $ string , $ i , 1 , 'UTF-8' ) ; if ( mb_check_encoding ( $ char , 'UTF-8' ) ) { $ ret = mb_convert_encoding ( $ char , 'UTF-32BE' , 'UTF-8' ) ; $ resultStringArr [ ... | Any plaint text or any html content . |
17,495 | public static function cloneArray ( array $ array ) : array { $ newArray = [ ] ; foreach ( $ array as $ key => $ value ) { if ( \ is_object ( $ value ) ) { $ newArray [ $ key ] = clone $ value ; } elseif ( \ is_array ( $ value ) ) { $ newArray [ $ key ] = self :: cloneArray ( $ value ) ; } else { $ newArray [ $ key ] =... | This method clones an array recursively . So all objects contained in this array will be cloned correctly . |
17,496 | private function extractObjectProperties ( $ object ) { $ propertyToValue = [ ] ; if ( method_exists ( $ object , '__sleep' ) ) { $ properties = $ object -> __sleep ( ) ; foreach ( $ properties as $ property ) { $ propertyToValue [ $ property ] = $ object -> $ property ; } return $ propertyToValue ; } $ reflectedProper... | Returns an array containing the object s properties to values |
17,497 | protected function getDefaultAssociationsFilter ( ) { $ filter = new AssociationsFilter ( ) ; $ filter -> setInsideAssociationID ( $ this -> arguments [ self :: ARGUMENT_INSIDEASSOCIATIONID ] ) ; return $ filter ; } | Get the default associations filter . |
17,498 | protected function getDefaultAssociationFilter ( ) { $ filter = new AssociationFilter ( ) ; $ filter -> setInsideAssociationID ( $ this -> arguments [ self :: ARGUMENT_INSIDEASSOCIATIONID ] ) ; return $ filter ; } | Get the default association filter . |
17,499 | protected function getDefaultEventFilter ( ) { $ filter = new EventFilter ( ) ; $ filter -> setInsideAssociationID ( $ this -> arguments [ self :: ARGUMENT_INSIDEASSOCIATIONID ] ) ; return $ filter ; } | Get the default event filter . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.