idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
55,000 | public function setTemplate ( $ type , $ template ) { if ( ! is_callable ( $ template ) ) { $ template = ( string ) $ template ; } $ this -> templates [ $ type ] = $ template ; } | Defines a template for the given media type . |
55,001 | protected function render ( $ type , array $ data = [ ] ) { $ templateName = empty ( $ data [ 'title' ] ) ? $ type . '_notitle' : $ type ; $ template = $ this -> templates [ $ templateName ] ; if ( is_callable ( $ template ) ) { return $ template ( $ data ) ; } else { $ replace = array ( ) ; foreach ( $ data as $ key =... | Renders the HTML for the given media type . |
55,002 | protected function parseJson ( $ data ) { $ result = json_decode ( trim ( $ data ) , false ) ; return json_last_error ( ) == JSON_ERROR_NONE ? $ result : false ; } | Parses a JSON response . |
55,003 | public function generate_class ( ) { function gen_spaces ( $ amount ) { $ spaces = '' ; for ( $ i = 0 ; $ i < $ amount ; $ i ++ ) { $ spaces .= ' ' ; } return $ spaces ; } if ( empty ( $ this -> table_model ) ) { return false ; } $ this -> init ( ) ; $ this -> generate_class_definition ( ) ; if ( strpos ( $ this -> cla... | major class generation body needs to be redone i am sure but for the beta this will work |
55,004 | public function generate_class_definition ( ) { $ this -> tpl_replacements [ 'class_definition' ] = '' ; $ this -> tpl_replacements [ 'class_definition_list' ] = '' ; if ( $ this -> is_final == true ) { $ this -> tpl_replacements [ 'class_definition' ] .= 'final ' ; } if ( $ this -> is_abstract == true ) { $ this -> tp... | generates the class definiton |
55,005 | public function get_table_short_tag ( ) { if ( empty ( $ this -> table_name ) ) return false ; $ tmp = null ; if ( strpos ( $ this -> table_name , '_' ) !== false ) { $ tmp = explode ( '_' , $ this -> table_name ) ; } if ( ! empty ( $ tmp ) ) { foreach ( $ tmp as $ val ) { $ this -> table_short_tag .= strtolower ( subs... | get table short tag parses based on the table name the first character or based on the underscores for example PX_GALLERY - > pg CUSTOMER - > c |
55,006 | protected function validateLimitsUpload ( ) { $ files = $ this -> request -> file ( 'files' ) ; if ( ! gplcart_file_multi_upload ( $ files ) ) { return false ; } if ( $ this -> user -> isSuperadmin ( ) ) { return true ; } $ role_id = $ this -> user -> getRoleId ( ) ; $ settings = $ this -> module -> getSettings ( 'file... | Validates file limits |
55,007 | protected function validateFileUpload ( ) { if ( $ this -> isError ( ) ) { return null ; } $ submitted_files = $ this -> getSubmitted ( 'files' ) ; $ file = reset ( $ submitted_files ) ; $ request_files = $ this -> request -> file ( 'files' ) ; if ( empty ( $ request_files [ 'name' ] [ 0 ] ) ) { $ this -> setErrorRequi... | Validates uploaded files |
55,008 | public static function price ( $ value ) { $ bool = preg_match ( self :: $ regularExpressions [ 'price' ] , $ value ) ; if ( ! $ bool ) { return false ; } return true ; } | check price format |
55,009 | public static function postcode ( $ value ) { $ bool = preg_match ( self :: $ regularExpressions [ 'postcode' ] , $ value ) ; if ( ! $ bool ) { return false ; } return true ; } | check post code format |
55,010 | public static function nip ( $ value ) { if ( ! empty ( $ value ) ) { $ weights = [ 6 , 5 , 7 , 2 , 3 , 4 , 5 , 6 , 7 ] ; $ nip = preg_replace ( '#[\\s-]#' , '' , $ value ) ; return self :: processNip ( $ nip , $ weights ) ; } return false ; } | check NIP number format |
55,011 | public static function stringLength ( $ value , $ min = null , $ max = null ) { $ length = mb_strlen ( $ value ) ; return self :: range ( $ length , $ min , $ max ) ; } | check string length possibility to set range |
55,012 | public static function range ( $ value , $ min = null , $ max = null ) { list ( $ value , $ min , $ max ) = self :: getProperValues ( $ value , $ min , $ max ) ; return ! ( ( $ min !== null && $ min > $ value ) || ( $ max !== null && $ max < $ value ) ) ; } | check range on numeric values allows to check decimal hex octal an binary values |
55,013 | public static function regon ( $ value ) { $ value = preg_replace ( '#[\\s-]#' , '' , $ value ) ; $ length = strlen ( $ value ) ; if ( ! ( $ length === 9 || $ length === 14 ) ) { return false ; } $ arrSteps = [ 8 , 9 , 2 , 3 , 4 , 5 , 6 , 7 ] ; $ intSum = 0 ; foreach ( $ arrSteps as $ key => $ step ) { $ intSum += $ st... | check REGON number format |
55,014 | public static function nrb ( $ value ) { $ iNRB = preg_replace ( '#[\\s- ]#' , '' , $ value ) ; if ( strlen ( $ iNRB ) !== 26 ) { return false ; } $ iNRB .= '2521' ; $ iNRB = substr ( $ iNRB , 2 ) . substr ( $ iNRB , 0 , 2 ) ; $ iNumSum = 0 ; $ aNumWeight = [ 1 , 10 , 3 , 30 , 9 , 90 , 27 , 76 , 81 , 34 , 49 , 5 , 50 ,... | check account number format in NRB standard |
55,015 | public static function iban ( $ value ) { $ values = '' ; $ mod = 0 ; $ remove = [ ' ' , '-' , '_' , '.' , ',' , '/' , '|' ] ; $ cleared = str_replace ( $ remove , '' , $ value ) ; $ temp = strtoupper ( $ cleared ) ; $ firstChar = $ temp { 0 } <= '9' ; $ secondChar = $ temp { 1 } <= '9' ; if ( $ firstChar && $ secondCh... | check account number format in IBAN standard |
55,016 | public static function url ( $ url , $ type = null ) { switch ( $ type ) { case 1 : $ type = self :: $ regularExpressions [ 'url_extend' ] ; break ; case 2 : $ type = self :: $ regularExpressions [ 'url_full' ] ; break ; default : $ type = self :: $ regularExpressions [ 'url' ] ; break ; } $ bool = preg_match ( $ type ... | check URL address |
55,017 | public static function step ( $ value , $ step , $ default = 0 ) { if ( ! self :: valid ( $ step , 'rational' ) || ! self :: valid ( $ default , 'rational' ) || ! self :: valid ( $ value , 'rational' ) ) { return false ; } $ check = ( abs ( $ value ) - abs ( $ default ) ) % $ step ; if ( $ check ) { return false ; } re... | check step of value |
55,018 | public function run ( ) { DB :: beginTransaction ( ) ; try { $ this -> down ( ) ; $ this -> addNotification ( [ 'category' => 'default' , 'severity' => 'high' , 'type' => 'email' , 'event' => 'email.sample-module-notification' , 'contents' => [ 'en' => [ 'title' => 'Sample Email Template' , 'content' => file_get_conten... | Creates module notifications |
55,019 | protected function makeIndexDDL ( $ type , $ name = null ) { return implode ( ' ' , array_filter ( [ strtoupper ( $ type ) , $ name !== null ? '`' . $ name . '`' : null , $ this -> makeIndexedColumnsDDL ( ) , $ this -> hasComment ( ) ? "COMMENT '" . addslashes ( $ this -> getComment ( ) ) . "'" : null ] ) ) ; } | Makes the DDL statement for the index . |
55,020 | protected function makeIndexedColumnsDDL ( ) { $ columnDDLs = [ ] ; foreach ( $ this -> indexedColumns as $ indexedColumn ) { $ columnDDLs [ ] = '`' . $ indexedColumn -> getColumnName ( ) . '`' . ( $ indexedColumn -> hasLength ( ) ? '(' . $ indexedColumn -> getLength ( ) . ')' : null ) . ( $ indexedColumn -> hasCollati... | Makes the column portion of the index DDL statement . |
55,021 | public function prepare ( ) { if ( empty ( $ this -> targetBundle ) && empty ( $ this -> bundleExtensionDir ) ) { throw new \ RuntimeException ( sprintf ( "Runtime Error: Any Bundle was selected for ui generation." ) ) ; } $ this -> reader = $ this -> readerFactory -> load ( $ this -> metaFile ) ; $ elementType = $ thi... | Prepare all engine dependencies |
55,022 | protected function mapElementInformation ( Element $ widget ) { $ mapping = $ this -> mapping [ 'widget_mapping' ] ; $ widgetInfo = $ widget -> getInfo ( ) ; if ( ! array_key_exists ( $ widget -> getXtype ( ) , $ mapping ) ) { return $ widgetInfo ; } $ overrides = $ mapping [ $ widget -> getXtype ( ) ] ; foreach ( $ ov... | Map the widget attributes & properties to a determined UI language |
55,023 | private function processMappedWidgetInfo ( WidgetInterface $ widget , $ info , $ value ) { if ( is_string ( $ info ) ) { $ result = $ info ; } elseif ( is_array ( $ info ) ) { $ strValue = self :: toString ( $ value ) ; if ( array_key_exists ( $ strValue , $ info ) ) { $ result = $ info [ $ strValue ] ; } else { $ resu... | Process the mapped widget information |
55,024 | public function setState ( $ state ) { $ oldState = $ this -> getState ( ) ; if ( $ oldState === $ state ) { return $ this ; } $ this -> getLogger ( ) -> debug ( 'Changing state from: ' . $ oldState . ' to: ' . $ state . '.' ) ; $ this -> state = $ state ; return $ this ; } | Set the current state of this Worker . |
55,025 | public function setActions ( $ actions ) { if ( $ this -> getState ( ) != self :: INIT ) { throw new \ RuntimeException ( 'Invalid state.' ) ; } if ( count ( $ actions ) == 0 ) { $ this -> setState ( self :: INVALID ) ; throw new \ RuntimeException ( 'No actions given.' ) ; } $ this -> actions = array_combine ( $ actio... | Set the actions that this worker can handle . |
55,026 | public function setResult ( $ requestId , $ result ) { $ this -> requestId = $ requestId ; $ this -> result = $ result ; $ this -> setState ( self :: RESULT_AVAILABLE ) ; } | Set the result for the currently handled request . |
55,027 | public function cleanup ( ) { $ this -> requestId = null ; $ this -> result = null ; $ this -> setState ( self :: READY ) ; } | Reset this worker to get ready for another Request . |
55,028 | public function onServiceDown ( ) { if ( ! $ this -> serviceRunning ) { return ; } $ this -> getLogger ( ) -> debug ( 'Service is no longer alive.' ) ; $ this -> serviceRunning = false ; $ this -> shutdown ( ) ; } | Let the worker know the service is down . |
55,029 | protected function startSession ( $ session ) { if ( is_bool ( $ session ) || is_string ( $ session ) ) { if ( $ session === false || isset ( $ _SESSION ) ) { return ; } if ( is_string ( $ session ) ) { session_name ( $ session ) ; } return session_start ( ) ; } $ prefix = 'Session variable must be of type \'boolean\' ... | Start a session or abort if set . |
55,030 | private function castValue ( $ value ) { foreach ( [ '/^-?\d+$/' => function ( $ value ) { return ( int ) $ value ; } , '/^-?\d+\.\d+$/' => function ( $ value ) { return ( float ) $ value ; } , '/^(?:true|false)$/' => function ( $ value ) { return filter_var ( $ value , \ FILTER_VALIDATE_BOOLEAN ) ; } , ] as $ format =... | Casts the passed string value to its supposed expected type . |
55,031 | public function generate ( ) : string { try { $ token = random_bytes ( 32 ) ; } catch ( \ Throwable $ e ) { throw new InsufficientStrengthException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } return $ token ; } | Generates a token |
55,032 | public static function with ( callable $ callable , int $ options = 0 ) { $ enabled = self :: hasXdebug ( ) ; $ inherited = self :: isEnabled ( ) ; if ( $ enabled && ! $ inherited ) { xdebug_start_code_coverage ( $ options ) ; } $ result = $ callable ( ) ; if ( $ enabled && ! $ inherited ) { xdebug_stop_code_coverage (... | Executes a callable with code coverage enabled . |
55,033 | public function injectViewModelLayout ( MvcEvent $ e ) { $ model = $ e -> getResult ( ) ; if ( ! Share :: isOnAdmin ( ) || ! $ model instanceof ViewModel ) { return false ; } $ response = $ e -> getResponse ( ) ; if ( $ response -> getStatusCode ( ) != 400 && $ response -> getStatusCode ( ) != 500 ) { $ template = $ mo... | Set admin prefix to viewModel Layouts |
55,034 | final public function parse ( \ Gettext \ Translations $ translations , $ concrete5version ) { $ fqClassName = $ this -> getClassNameForExtractor ( ) ; if ( is_string ( $ fqClassName ) && ( $ fqClassName !== '' ) && class_exists ( $ fqClassName , true ) && method_exists ( $ fqClassName , 'exportTranslations' ) ) { $ tr... | Extract specific items from the running concrete5 . |
55,035 | final protected function addTranslation ( \ Gettext \ Translations $ translations , $ string , $ context = '' ) { if ( is_string ( $ string ) && ( $ string !== '' ) ) { $ translations -> insert ( $ context , $ string ) ; } } | Adds a translation to the \ Gettext \ Translations object . |
55,036 | final public function getDynamicItemsParserHandler ( ) { $ chunks = explode ( '\\' , get_class ( $ this ) ) ; return \ C5TL \ Parser :: handlifyString ( end ( $ chunks ) ) ; } | Returns the handle of the DynamicItem handle . |
55,037 | public function send ( $ prv_request , $ no_add_tags = false ) { if ( $ no_add_tags ) { return $ this -> client -> sendRequest ( $ prv_request ) ; } return $ this -> client -> sendRequest ( $ this -> addProvision ( $ this -> addStore ( $ prv_request ) ) ) ; } | Send a remote provision request |
55,038 | private function normalizarUri ( $ uri ) { if ( ( $ temp = strpos ( $ uri , '?' ) ) !== false ) { $ uri = substr ( $ uri , 0 , $ temp ) ; } if ( strpos ( $ uri , '/' ) !== 0 ) { $ uri = '/' . $ uri ; } if ( $ uri !== '/' && substr ( $ uri , - 1 , 1 ) == '/' ) { $ uri = substr ( $ uri , 0 , - 1 ) ; } return $ uri ; } | Convierte el URI en un formato adecuado para trabajar . |
55,039 | public function agregarRuta ( $ metodo , $ ruta , $ accion , array $ parametros = null , $ estado_http = 200 ) { $ ruta = $ this -> normalizarUri ( $ ruta ) ; $ partes = explode ( '/' , trim ( $ ruta , '/ ' ) ) ; $ conteo_partes = count ( $ partes ) ; $ rama_actual = & $ this -> arbol_rutas ; $ es_simple = true ; if ( ... | Agrega una nueva ruta al arbol de rutas . |
55,040 | public function agregarRutaEstadoHttp ( $ estado_http , $ accion ) { $ this -> rutas_simples [ $ estado_http ] [ 'accion' ] = $ accion ; $ this -> rutas_simples [ $ estado_http ] [ 'estado_http' ] = $ estado_http ; } | Agrega una nueva ruta sobre Estado HTTP . |
55,041 | public function importarRutas ( array $ rutas ) { foreach ( $ rutas as $ ruta ) { if ( isset ( $ ruta [ 4 ] ) ) { $ this -> agregarRuta ( $ ruta [ 0 ] , $ ruta [ 1 ] , $ ruta [ 2 ] , $ ruta [ 3 ] , $ ruta [ 4 ] ) ; } elseif ( isset ( $ ruta [ 3 ] ) ) { $ this -> agregarRuta ( $ ruta [ 0 ] , $ ruta [ 1 ] , $ ruta [ 2 ] ... | Importa las rutas desde un arreglo . |
55,042 | public function getSlug ( ) { if ( $ this -> package -> getVendor ( ) == 'keeko' ) { return $ this -> package -> getName ( ) ; } return str_replace ( '/' , '.' , $ this -> package -> getFullName ( ) ) ; } | Returns the slug for this module |
55,043 | public function addAction ( ActionSchema $ action ) { $ action -> setPackage ( $ this -> package ) ; $ this -> actions -> set ( $ action -> getName ( ) , $ action ) ; return $ this ; } | Adds an action |
55,044 | public static function processPcreError ( ) { if ( preg_last_error ( ) != PREG_NO_ERROR ) { switch ( preg_last_error ( ) ) { case PREG_INTERNAL_ERROR : throw new Exception ( 'PCRE PREG internal error' ) ; case PREG_BACKTRACK_LIMIT_ERROR : throw new Exception ( 'PCRE PREG Backtrack limit error' ) ; case PREG_RECURSION_L... | Check PCRE PREG error and throw exception |
55,045 | public function push ( Notification $ notification ) { $ curl = curl_init ( ) ; curl_setopt ( $ curl , CURLOPT_URL , self :: ENDPOINT ) ; curl_setopt ( $ curl , CURLOPT_USERAGENT , self :: USER_AGENT ) ; curl_setopt ( $ curl , CURLOPT_POSTFIELDS , $ this -> createPostFields ( $ notification ) ) ; curl_setopt ( $ curl ,... | Push notification to Boxcar |
55,046 | private function createPostFields ( Notification $ notification ) { $ data = [ 'user_credentials' => $ this -> accessToken , 'notification[title]' => $ notification -> getTitle ( ) , 'notification[long_message]' => $ notification -> getContent ( ) ] ; if ( ! empty ( $ this -> getSourceName ( ) ) ) { $ data [ 'notificat... | Create post fields for API request based on provided notification object |
55,047 | public function find ( $ typeKey , $ identifier ) { if ( true === $ this -> cache -> has ( $ typeKey , $ identifier ) ) { return $ this -> cache -> get ( $ typeKey , $ identifier ) ; } $ record = $ this -> retrieveRecord ( $ typeKey , $ identifier ) ; return $ this -> loadModel ( $ typeKey , $ record ) ; } | Finds a single record from the persistence layer by type and id . Will return a Model object if found or throw an exception if not . |
55,048 | public function findQuery ( $ typeKey , array $ criteria , array $ fields = [ ] , array $ sort = [ ] , $ offset = 0 , $ limit = 0 ) { $ metadata = $ this -> getMetadataForType ( $ typeKey ) ; $ persister = $ this -> getPersisterFor ( $ typeKey ) ; $ this -> dispatcher -> dispatch ( Events :: preQuery , new PreQueryArgu... | Queries records based on a provided set of criteria . |
55,049 | public function delete ( $ typeKey , $ identifier ) { $ model = $ this -> find ( $ typeKey , $ identifier ) ; return $ model -> delete ( ) -> save ( ) ; } | Deletes a model . The moel will be immediately deleted once retrieved . |
55,050 | public function retrieveRecord ( $ typeKey , $ identifier ) { $ persister = $ this -> getPersisterFor ( $ typeKey ) ; $ record = $ persister -> retrieve ( $ this -> getMetadataForType ( $ typeKey ) , $ identifier , $ this ) -> getSingleResult ( ) ; if ( null === $ record ) { throw StoreException :: recordNotFound ( $ t... | Retrieves a RecordSet object from the persistence layer . |
55,051 | public function retrieveRecords ( $ typeKey , array $ identifiers , array $ fields = [ ] , array $ sort = [ ] , $ offset = 0 , $ limit = 0 ) { $ persister = $ this -> getPersisterFor ( $ typeKey ) ; return $ persister -> all ( $ this -> getMetadataForType ( $ typeKey ) , $ this , $ identifiers , $ fields , $ sort , $ o... | Retrieves multiple Record objects from the persistence layer . |
55,052 | public function retrieveInverseRecords ( $ ownerTypeKey , $ relTypeKey , array $ identifiers , $ inverseField ) { $ persister = $ this -> getPersisterFor ( $ relTypeKey ) ; return $ persister -> inverse ( $ this -> getMetadataForType ( $ ownerTypeKey ) , $ this -> getMetadataForType ( $ relTypeKey ) , $ this , $ identi... | Retrieves multiple Record objects from the persistence layer for an inverse relationship . |
55,053 | protected function dispatchLifecycleEvent ( $ eventName , Model $ model ) { $ args = new ModelLifecycleArguments ( $ model ) ; $ this -> dispatcher -> dispatch ( $ eventName , $ args ) ; return $ this ; } | Dispatches a model lifecycle event via the event dispatcher . |
55,054 | public function loadProxyModel ( $ relatedTypeKey , $ identifier ) { $ identifier = $ this -> convertId ( $ identifier ) ; if ( true === $ this -> cache -> has ( $ relatedTypeKey , $ identifier ) ) { return $ this -> cache -> get ( $ relatedTypeKey , $ identifier ) ; } $ metadata = $ this -> getMetadataForType ( $ rela... | Loads a has - one model proxy . |
55,055 | public function createInverseCollection ( RelationshipMetadata $ relMeta , Model $ owner ) { $ metadata = $ this -> getMetadataForType ( $ relMeta -> getEntityType ( ) ) ; return new Collections \ InverseCollection ( $ metadata , $ this , $ owner , $ relMeta -> inverseField ) ; } | Loads a has - many inverse model collection . |
55,056 | public function createEmbedCollection ( EmbeddedPropMetadata $ embededPropMeta , array $ embedDocs = null ) { if ( empty ( $ embedDocs ) ) { $ embedDocs = [ ] ; } if ( false === $ this -> isSequentialArray ( $ embedDocs ) ) { throw StoreException :: badRequest ( sprintf ( 'Improper has-many data detected for embed "%s"... | Loads a has - many embed collection . |
55,057 | public function createCollection ( RelationshipMetadata $ relMeta , array $ references = null ) { $ metadata = $ this -> getMetadataForType ( $ relMeta -> getEntityType ( ) ) ; if ( empty ( $ references ) ) { $ references = [ ] ; } if ( false === $ this -> isSequentialArray ( $ references ) ) { throw StoreException :: ... | Loads a has - many model collection . |
55,058 | public function getPersisterFor ( $ typeKey ) { $ metadata = $ this -> getMetadataForType ( $ typeKey ) ; return $ this -> storageManager -> getPersister ( $ metadata -> persistence -> getKey ( ) ) ; } | Determines the persister to use for the provided model key . |
55,059 | public function commit ( Model $ model ) { $ this -> dispatchLifecycleEvent ( Events :: preCommit , $ model ) ; if ( false === $ this -> shouldCommit ( $ model ) ) { return $ model ; } if ( true === $ model -> getState ( ) -> is ( 'new' ) ) { $ this -> doCommitCreate ( $ model ) ; } elseif ( true === $ model -> getStat... | Commits a model by persisting it to the database . |
55,060 | private function doCommitCreate ( Model $ model ) { $ this -> dispatchLifecycleEvent ( Events :: preCreate , $ model ) ; $ this -> getPersisterFor ( $ model -> getType ( ) ) -> create ( $ model ) ; $ model -> getState ( ) -> setNew ( false ) ; $ model -> reload ( ) ; $ this -> dispatchLifecycleEvent ( Events :: postCre... | Performs a Model creation commit and persists to the database . |
55,061 | private function doCommitDelete ( Model $ model ) { $ this -> dispatchLifecycleEvent ( Events :: preDelete , $ model ) ; $ this -> getPersisterFor ( $ model -> getType ( ) ) -> delete ( $ model ) ; $ model -> getState ( ) -> setDeleted ( ) ; $ this -> dispatchLifecycleEvent ( Events :: postDelete , $ model ) ; return $... | Performs a Model delete commit and persists to the database . |
55,062 | private function doCommitUpdate ( Model $ model ) { $ this -> dispatchLifecycleEvent ( Events :: preUpdate , $ model ) ; $ this -> getPersisterFor ( $ model -> getType ( ) ) -> update ( $ model ) ; $ model -> reload ( ) ; $ this -> dispatchLifecycleEvent ( Events :: postUpdate , $ model ) ; return $ model ; } | Performs a Model update commit and persists to the database . |
55,063 | public function validateRelationshipSet ( EntityMetadata $ owningMeta , $ typeToAdd ) { if ( true === $ owningMeta -> isPolymorphic ( ) ) { $ canSet = in_array ( $ typeToAdd , $ owningMeta -> ownedTypes ) ; } else { $ canSet = $ owningMeta -> type === $ typeToAdd ; } if ( false === $ canSet ) { throw StoreException :: ... | Validates that a model type can be set to an owning metadata type . |
55,064 | protected function shouldCommit ( Model $ model ) { $ state = $ model -> getState ( ) ; return $ model -> isDirty ( ) || $ state -> is ( 'new' ) || $ state -> is ( 'deleting' ) ; } | Determines if a model is eligible for commit . |
55,065 | protected function isSequentialArray ( array $ arr ) { if ( empty ( $ arr ) ) { return true ; } return ( range ( 0 , count ( $ arr ) - 1 ) === array_keys ( $ arr ) ) ; } | Determines if an array is sequential . |
55,066 | function setScope ( $ scope ) { $ scopes = array_merge ( $ this -> getScopes ( ) , array ( ( string ) $ scope ) ) ; $ this -> setScopes ( $ scopes ) ; return $ this ; } | Add Scope To Current Scopes |
55,067 | public static function getHostForLookup ( $ hostname , $ blacklist , $ isIP = true ) { if ( $ isIP && filter_var ( $ hostname , FILTER_VALIDATE_IP ) ) { return self :: buildLookUpIP ( $ hostname , $ blacklist ) ; } if ( $ isIP && ! filter_var ( $ hostname , FILTER_VALIDATE_IP ) ) { $ resolver = new \ Net_DNS_Resolver ;... | Get host to lookup . Lookup a host if neccessary and get the complete FQDN to lookup . |
55,068 | public function validateRename ( & $ submitted , $ options = array ( ) ) { $ this -> options = $ options ; $ this -> submitted = & $ submitted ; $ this -> validateNameRename ( ) ; $ this -> validateDestinationRename ( ) ; return $ this -> getResult ( ) ; } | Validates an array of submitted data while renaming a file |
55,069 | protected function _prepareCommand ( $ operation , $ args ) { $ args = ( $ args ) ? : $ this -> args ; $ command = new Command ( $ this -> service , $ operation , $ args ) ; if ( $ this -> context ) { $ command -> setContext ( $ this -> context ) ; } else { $ command -> setContext ( $ this -> broker -> getDefaultContex... | Prepare command for operation |
55,070 | public function renew ( $ key , $ ttl = self :: DEFAULT_TTL ) { if ( ! $ this -> hasApc ) { return false ; } $ val = apc_fetch ( $ key , $ fetched ) ; if ( $ fetched ) { return apc_store ( $ key , $ val , $ ttl ) ; } return false ; } | Renew a cached item by key |
55,071 | private function cloneTreeRecursion ( int $ menuId , TreeBase $ item , $ parentId = null ) { if ( $ item -> hasChildren ( ) ) { $ previous = null ; foreach ( $ item -> getChildren ( ) as $ child ) { if ( $ previous ) { $ previous = $ this -> itemStorage -> insertAfter ( $ previous , $ child -> getNodeId ( ) , $ child -... | Internal recursion for clone tree |
55,072 | public function cloneTreeIn ( int $ menuId , Tree $ tree ) : Tree { if ( $ this -> provider -> mayCloneTree ( ) ) { return $ this -> provider -> cloneTreeIn ( $ menuId , $ tree ) ; } $ this -> cloneTreeRecursion ( $ menuId , $ tree ) ; return $ this -> provider -> buildTree ( $ menuId , false ) ; } | Clone full tree in given menu |
55,073 | public function findTreeForNode ( int $ nodeId , array $ conditions = [ ] , bool $ withAccess = false , bool $ relocateOrphans = false ) { $ menuId = $ this -> provider -> findTreeForNode ( $ nodeId , $ conditions ) ; if ( $ menuId ) { return $ this -> buildTree ( $ menuId , $ withAccess , $ relocateOrphans ) ; } } | Arbitrary find a tree where the node is with the given conditions |
55,074 | public function session_write ( $ session_id , $ session_data ) { $ time = ( int ) time ( ) + ( int ) $ this -> _session_life_time ; $ session_id = mysql_real_escape_string ( $ session_id , $ this -> db -> db ) ; $ session_data = mysql_real_escape_string ( $ session_data ) ; $ date = date ( 'Y-m-d H:i:s' ) ; $ sql = ( ... | write the session data to the database |
55,075 | public function session_destroy ( $ session_id ) { if ( empty ( $ session_id ) ) return false ; $ escaped_id = ( string ) addslashes ( stripslashes ( $ session_id ) ) ; $ sql = ( string ) "DELETE FROM `{$this->_db_name}`.`user_session` WHERE `session_id` = '$escaped_id'" ; return $ this -> db -> query ( ( string ) $ sq... | destroy the session |
55,076 | public function alert ( String $ type , $ content ) { $ content = $ this -> stringOrCallback ( $ content ) ; $ this -> isBootstrapAttribute ( 'dismiss-fade' , function ( ) use ( & $ type ) { $ type .= ' alert-dismissible fade show' ; } ) ; $ this -> isBootstrapAttribute ( 'dismiss-button' , function ( $ attribute ) use... | Bootstrap alert component |
55,077 | protected function getURIsegments ( $ uri , $ segmentCount ) { if ( $ uri === NULL ) { $ uri = URI :: active ( ) ; } return explode ( '/' , rtrim ( Datatype :: divide ( $ uri , '/' , 0 , $ segmentCount ) , '/' ) ) ; } | Protected get uri segments |
55,078 | protected function breadcrumbOlList ( $ options ) { return $ this -> ol ( function ( $ option ) use ( $ options ) { $ link = NULL ; $ count = count ( $ options ) ; if ( $ count === 2 && $ options [ 1 ] === CURRENT_COPEN_PAGE ) { unset ( $ options [ 1 ] ) ; $ count -- ; } foreach ( $ options as $ key => $ val ) { $ link... | Protected breadcrumb ol list |
55,079 | public function isStripped ( $ isStripped = null ) { if ( null === $ isStripped ) { return $ this -> _stripped ; } $ this -> _stripped = ( bool ) $ isStripped ; return $ this ; } | Get or set the stripped attribute for the table |
55,080 | public function isBordered ( $ isBordered = null ) { if ( null === $ isBordered ) { return $ this -> _bordered ; } $ this -> _bordered = ( bool ) $ isBordered ; return $ this ; } | Get or set the bordered attribute for the table |
55,081 | public function isHover ( $ isHover = null ) { if ( null === $ isHover ) { return $ this -> _hover ; } $ this -> _hover = ( bool ) $ isHover ; return $ this ; } | Get or set the hover attribute for the table |
55,082 | public function createMainMenu ( Request $ request ) { $ menu = $ this -> factory -> createItem ( 'root' ) ; $ repositoriesMenu = $ this -> repositoryMenu -> getMenu ( ) ; foreach ( $ repositoriesMenu as $ repositoryActions ) { $ oneRepoMenu = $ menu -> addChild ( $ repositoryActions -> getName ( ) ) ; foreach ( $ repo... | Creates the main menu the one on top of every page |
55,083 | public function create ( Description $ description ) { return new Photo ( new Identifier ( $ description -> getMandatoryProperty ( 'id' ) ) , ( new \ DateTimeImmutable ( ) ) -> setTimestamp ( $ description -> getMandatoryProperty ( 'createdAt' ) ) , sprintf ( '%s%sx%s%s' , $ description -> getMandatoryProperty ( 'prefi... | Create a photo from a description . |
55,084 | public function dispatch ( Event $ event ) { $ message = sprintf ( self :: FMT_INF_DISPATCHING , $ event -> getId ( ) , count ( $ this -> subscriptions ) ) ; $ this -> logger -> info ( $ message ) ; $ dispatchCount = 0 ; foreach ( $ this -> subscriptions as $ subscription ) { $ result = $ this -> tryDispatch ( $ subscr... | Dispatches an event based on its category . |
55,085 | private function tryDispatch ( Subscription $ subscription , Event $ event ) { $ dispatched = false ; try { $ dispatched = $ this -> doDispatch ( $ subscription , $ event ) ; } catch ( \ Exception $ ex ) { if ( ! $ this -> silent ) { throw new \ RuntimeException ( 'Dispatch triggered an exception' , 0 , $ ex ) ; } $ me... | Attempts to dispatch an event |
55,086 | protected function createNode ( NodeInterface $ commentCollection , CommentDtoInterface $ comment ) : NodeInterface { $ commentNodeType = $ this -> nodeTypeManager -> getNodeType ( self :: COMMENT_NODE_TYPE ) ; $ commentNodeTemplate = new NodeTemplate ( ) ; $ commentNodeTemplate -> setNodeType ( $ commentNodeType ) ; $... | creates a comment node from the CommentDto |
55,087 | public function addComment ( NodeInterface $ commentableNode , CommentDtoInterface $ comment ) { if ( ! $ this -> isCommentableNode ( $ commentableNode ) ) { throw new InvalidNodeTypeException ( 'The commentable node type should implement the mixin ' . self :: COMMENTABLE_NODE_TYPE , 1536244558 ) ; } $ this -> createNo... | adds a comment node to a blog post node |
55,088 | public function sortByZoneType ( ) { return $ this -> sort ( function ( Zone $ zone1 , Zone $ zone2 ) { $ zone1Order = $ zone1 -> getZoneType ( ) -> getOrder ( ) ; $ zone2Order = $ zone2 -> getZoneType ( ) -> getOrder ( ) ; return $ zone1Order >= $ zone2Order ? 1 : - 1 ; } ) ; } | Sort zones by zone type order ascending order . |
55,089 | public function indexByZoneType ( ) { $ zoneCollection = array ( ) ; foreach ( $ this as $ zone ) { $ zoneCollection [ $ zone -> getZoneType ( ) -> getName ( ) ] = $ zone ; } return new self ( $ zoneCollection ) ; } | Index this collection by zone type name . |
55,090 | private function assertIsScalarOrArray ( $ value ) { if ( ! is_scalar ( $ value ) && ! is_array ( $ value ) ) { throw InvalidTypeException :: fromMessageAndPrototype ( "An unknown type must at least be a scalar or array value" , static :: prototype ( ) ) ; } if ( is_array ( $ value ) ) { foreach ( $ value as $ item ) $... | This method checks recursively if the value only consists of arrays and scalar types |
55,091 | private function parseDataToString ( $ data ) { $ format = $ this -> allowedFormats [ $ this -> format ] ; $ className = "\\Ginger\\Response\\Format\\" . $ format [ 'class' ] ; return $ className :: Parse ( $ data ) ; } | Passes data to one of the format interfaces and returns string value |
55,092 | public function send ( ) { $ data = $ this -> parseDataToString ( $ this -> data ) ; $ format = $ this -> allowedFormats [ $ this -> format ] ; header ( $ this -> getStatus ( ) , true , $ this -> getStatus ( ) ) ; foreach ( self :: $ headers as $ key => $ value ) { header ( $ key . ": " . $ value ) ; } header ( "Conten... | Sets status header content - type header and outputs data . Die is there for making sure nothing else is processed after this . |
55,093 | public function setFormat ( $ format = false ) { if ( ! $ format ) { $ format = \ Ginger \ System \ Parameters :: $ format ; } $ this -> format = $ format ; if ( ! isset ( $ this -> allowedFormats [ $ this -> format ] ) ) { $ this -> format = $ this -> defaultFormat ; } } | setFormat function . |
55,094 | public function setCallback ( $ callback = false ) { if ( ! $ callback ) { $ callback = \ Ginger \ System \ Parameters :: $ callback ; } $ this -> callback = $ callback ; } | setCallback function . |
55,095 | public function post ( string $ name ) : string { if ( ! isset ( $ this -> post [ $ name ] ) ) { return "" ; } return $ this -> post [ $ name ] ; } | Obtener parametro de una peticion POST |
55,096 | public function get ( string $ name ) : string { if ( ! isset ( $ this -> get [ $ name ] ) ) { return "" ; } return $ this -> get [ $ name ] ; } | Obtener parametro de una peticion GET |
55,097 | public function server ( string $ name ) : string { if ( ! isset ( $ this -> server [ $ name ] ) ) { return "" ; } return $ this -> server [ $ name ] ; } | Obtener parametro del servidor apache . |
55,098 | public function file ( string $ name ) : string { if ( ! isset ( $ this -> file [ $ name ] ) ) { return "" ; } return $ this -> file [ $ name ] ; } | Obtener los paramtros del protocolo file . |
55,099 | public function cookie ( string $ name ) : string { if ( ! isset ( $ this -> cookies [ $ name ] ) ) { return "" ; } return $ this -> cookies [ $ name ] ; } | Obtener parametros de las cookies . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.