idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
234,200 | protected function setJavascriptData ( $ key , $ value = null ) { if ( is_array ( $ key ) ) { JavaScriptFacade :: put ( $ key ) ; } else { JavaScriptFacade :: put ( [ $ key => $ value ] ) ; } } | Pass data directly to Javascript . |
234,201 | protected function actionAdd ( $ params = array ( ) ) { $ response = array ( 'errors' => array ( ) , 'data' => array ( ) , ) ; $ values = $ this -> company -> prepareParams ( $ params ) ; if ( empty ( $ values [ 'name' ] ) ) { $ response [ 'errors' ] [ ] = 'cmp01' ; } if ( empty ( $ values [ 'build' ] ) ) { $ response ... | Add company . |
234,202 | public function put ( $ url , $ params , $ options = [ ] , $ headers = [ ] ) { return $ this -> update ( 'put' , $ url , $ params , $ options , $ headers ) ; } | Do a PUT request |
234,203 | protected function update ( $ type , $ url , $ params , $ options = [ ] , $ headers = [ ] ) { return $ this -> makeCall ( $ type , $ url , $ params , $ options , $ headers ) ; } | Proxy function for both edit requests types |
234,204 | protected function makeCall ( $ type , $ url , $ params , $ options , $ headers ) { if ( ! isset ( $ this -> adapter ) ) { throw new NoAdapterException ( 'No adapter set' ) ; } if ( substr ( $ url , 0 , 1 ) === '/' ) { $ url = substr ( $ url , 1 ) ; } $ result = $ this -> adapter -> doRequest ( $ type , $ this -> baseU... | Calls the adapter which will perform the request |
234,205 | protected function runResponseHandler ( Result $ result , $ type , $ url , $ params ) { if ( isset ( $ this -> responseHandlers [ $ result -> getStatus ( ) ] ) ) { $ handler = $ this -> responseHandlers [ $ result -> getStatus ( ) ] ; } else { $ handler = $ this -> responseHandlers [ 'default' ] ; } if ( is_callable ( ... | Run the correct response handler function |
234,206 | public function set ( $ index , AssetInterface $ asset ) { $ this -> data [ $ index ] = $ asset ; $ this -> provides [ ] = $ asset -> is ( ) ; return $ this ; } | Store an Asset container by named index . |
234,207 | public function get ( $ index , array $ params = [ ] , $ asAsset = false ) { if ( ! $ asAsset ) { return isset ( $ this -> data [ $ index ] ) ? $ this -> data [ $ index ] -> fetch ( $ params , $ this ) : null ; } return isset ( $ this -> data [ $ index ] ) ? $ this -> data [ $ index ] : null ; } | Retrieve an asset . |
234,208 | public function parse ( $ mail ) { $ mailPart = $ this -> workAroundMissingBoundary ( $ this -> partFactory -> getPart ( $ mail ) , $ mail ) ; $ partTreeFactory = new PartTreeFactory ( $ this -> partFactory ) ; $ partTree = $ partTreeFactory -> make ( $ mailPart ) ; $ parts = $ partTree -> flattenParts ( ) ; $ envelope... | Accepts the raw email as a string including headers and body . Has to be called before the other functions are available . |
234,209 | private function workAroundMissingBoundary ( Part $ part , $ rawMailBody ) { try { $ part -> countParts ( ) ; } catch ( RuntimeException $ e ) { if ( count ( $ part -> getHeaders ( ) ) > 0 && $ part -> getHeaders ( ) -> has ( 'Content-Type' ) && array_key_exists ( 'boundary' , $ this -> getContentType ( $ part ) -> get... | Some emails are missing a MIME closing boundary . This violations the standard but most software still handles it well - except the Zend Framework who rather don t want to accommodate broken emails . |
234,210 | private function getLoggingEmails ( $ mail , $ parts ) { $ emailAddresses = $ this -> flattenEmailAddresses ( $ this -> getAllEmailAddresses ( $ parts ) ) ; $ messageIds = [ ] ; $ headers = $ mail -> getHeaders ( ) ; if ( ! empty ( $ headers ) && $ headers -> has ( 'message-id' ) ) { $ messageId = $ headers -> get ( 'm... | Returns a list of all emails in the parser including the message id . This is mostly useful for logging . |
234,211 | private function flattenEmailAddresses ( $ emailAddressesByField ) { $ flattened = [ ] ; foreach ( $ emailAddressesByField as $ field => $ emailAddresses ) { foreach ( $ emailAddresses as $ emailAddress ) { $ flattened [ ] = $ emailAddress ; } } return array_unique ( $ flattened ) ; } | Takes the hash of email address and the field they were found in and returns a flattened array of those email addresses . |
234,212 | private function getAddressesFromFieldInPart ( $ field , Part $ part ) { $ addresses = [ ] ; $ headers = $ part -> getHeaders ( ) ; if ( empty ( $ headers ) ) { return $ addresses ; } if ( ! $ headers -> has ( $ field ) ) { return $ addresses ; } $ addressList = null ; try { $ addressList = $ part -> getHeader ( $ fiel... | Retrieves the addresses from a specific field in a part |
234,213 | public function init ( ) { $ this -> renameTableQueries = array ( ) ; $ this -> dropCheckQueries = array ( ) ; $ this -> dropForeignKeyQueries = array ( ) ; $ this -> dropIndexQueries = array ( ) ; $ this -> dropPrimaryKeyQueries = array ( ) ; $ this -> dropColumnQueries = array ( ) ; $ this -> alterColumnQueries = arr... | Reinitilizes SQL collector . |
234,214 | public function collect ( TableDiff $ tableDiff ) { if ( $ tableDiff -> getOldAsset ( ) -> getName ( ) !== $ tableDiff -> getNewAsset ( ) -> getName ( ) ) { $ this -> renameTableQueries = array_merge ( $ this -> renameTableQueries , $ this -> platform -> getRenameTableSQLQueries ( $ tableDiff ) ) ; } $ this -> collectC... | Collects queries to alter tables . |
234,215 | public function getQueries ( ) { return array_merge ( $ this -> getRenameTableQueries ( ) , $ this -> getDropCheckQueries ( ) , $ this -> getDropForeignKeyQueries ( ) , $ this -> getDropIndexQueries ( ) , $ this -> getDropPrimaryKeyQueries ( ) , $ this -> getDropColumnQueries ( ) , $ this -> getAlterColumnQueries ( ) ,... | Gets the queries collected to alter the table . |
234,216 | private function collectColumns ( TableDiff $ tableDiff ) { foreach ( $ tableDiff -> getCreatedColumns ( ) as $ column ) { $ this -> createColumnQueries = array_merge ( $ this -> createColumnQueries , $ this -> platform -> getCreateColumnSQLQueries ( $ column , $ tableDiff -> getNewAsset ( ) -> getName ( ) ) ) ; } fore... | Collects queries about column to alter a table . |
234,217 | private function collectPrimaryKeys ( TableDiff $ tableDiff ) { if ( $ tableDiff -> getCreatedPrimaryKey ( ) !== null ) { $ this -> createPrimaryKeyQueries = array_merge ( $ this -> createPrimaryKeyQueries , $ this -> platform -> getCreatePrimaryKeySQLQueries ( $ tableDiff -> getCreatedPrimaryKey ( ) , $ tableDiff -> g... | Collect queries about primary keys to alter a table . |
234,218 | private function collectForeignKeys ( TableDiff $ tableDiff ) { foreach ( $ tableDiff -> getCreatedForeignKeys ( ) as $ foreignKey ) { $ this -> createForeignKeyQueries = array_merge ( $ this -> createForeignKeyQueries , $ this -> platform -> getCreateForeignKeySQLQueries ( $ foreignKey , $ tableDiff -> getNewAsset ( )... | Collects queries about foreign keys to alter a table . |
234,219 | private function collectIndexes ( TableDiff $ tableDiff ) { foreach ( $ tableDiff -> getCreatedIndexes ( ) as $ index ) { $ this -> createIndexQueries = array_merge ( $ this -> createIndexQueries , $ this -> platform -> getCreateIndexSQLQueries ( $ index , $ tableDiff -> getNewAsset ( ) -> getName ( ) ) ) ; } foreach (... | Collects queries about indexes to alter a table . |
234,220 | private function collectChecks ( TableDiff $ tableDiff ) { foreach ( $ tableDiff -> getCreatedChecks ( ) as $ check ) { $ this -> createCheckQueries = array_merge ( $ this -> createCheckQueries , $ this -> platform -> getCreateCheckSQLQueries ( $ check , $ tableDiff -> getNewAsset ( ) -> getName ( ) ) ) ; } foreach ( $... | Collects queries about checks to alter a table . |
234,221 | public static function init ( Config $ config ) : Container { $ logger = Logger :: init ( $ config ) ; return new Container ( $ logger ) ; } | Initiate Hooks Container |
234,222 | public static function emitBefore ( TransactionInterface $ transaction ) { $ request = $ transaction -> getRequest ( ) ; try { $ request -> getEmitter ( ) -> emit ( 'before' , new BeforeEvent ( $ transaction ) ) ; } catch ( RequestException $ e ) { if ( $ e -> emittedError ( ) ) { throw $ e ; } self :: emitError ( $ tr... | Emits the before send event for a request and emits an error event if an error is encountered during the before send . |
234,223 | public static function emitComplete ( TransactionInterface $ transaction , array $ stats = [ ] ) { $ request = $ transaction -> getRequest ( ) ; $ transaction -> getResponse ( ) -> setEffectiveUrl ( $ request -> getUrl ( ) ) ; try { $ request -> getEmitter ( ) -> emit ( 'complete' , new CompleteEvent ( $ transaction , ... | Emits the complete event for a request and emits an error event if an error is encountered during the after send . |
234,224 | public static function emitError ( TransactionInterface $ transaction , \ Exception $ e , array $ stats = [ ] ) { $ request = $ transaction -> getRequest ( ) ; if ( ! ( $ e instanceof RequestException ) ) { $ e = new RequestException ( $ e -> getMessage ( ) , $ request , null , $ e ) ; } $ e -> emittedError ( true ) ; ... | Emits an error event for a request and accounts for the propagation of an error event being stopped to prevent the exception from being thrown . |
234,225 | public static function convertEventArray ( array $ options , array $ events , $ handler ) { foreach ( $ events as $ name ) { if ( ! isset ( $ options [ $ name ] ) ) { $ options [ $ name ] = [ $ handler ] ; } elseif ( is_callable ( $ options [ $ name ] ) ) { $ options [ $ name ] = [ $ options [ $ name ] , $ handler ] ; ... | Converts an array of event options into a formatted array of valid event configuration . |
234,226 | public function addController ( $ uriPattern , callable $ controller , $ method = '' , $ contentType = '' ) { $ routeBuilder = new RouteBuilder ( ) ; $ routeBuilder -> addUriPattern ( $ uriPattern ) -> addController ( $ controller , $ this -> getAppController ( ) ) -> addMethod ( $ method ) -> addContentType ( $ conten... | Adds a controller to the list of observed controllers . |
234,227 | public function call ( Request $ request ) { if ( $ request !== $ this -> getRequestStack ( ) -> getCurrentRequest ( ) ) { $ this -> getRequestStack ( ) -> push ( $ request ) ; } if ( ! $ request -> getRequestFormat ( null ) && $ request -> getAcceptableContentTypes ( ) ) { $ request -> setRequestFormat ( $ request -> ... | Calls the controller matched with the request uri . |
234,228 | public function renderBasic ( ) { $ html = "<textarea rows='$this->rows'" ; $ html .= " " . $ this -> getCompiledAttributes ( "form-control" ) ; $ html .= ">" ; $ html .= $ this -> value ; $ html .= "</textarea>" ; return $ html ; } | Render basics of textarea |
234,229 | public function addContent ( string $ content ) : \ Symfony \ Component \ HttpFoundation \ Response { return $ this -> setContent ( $ this -> getContent ( ) . $ content ) ; } | Add To Content |
234,230 | protected function deserialize ( ResponseInterface $ response , $ type , $ format = 'json' ) { try { return $ this -> serializer -> deserialize ( ( string ) $ response -> getBody ( ) , $ type , $ format ) ; } catch ( \ Exception $ exception ) { $ this -> logger -> error ( '[WebServiceClient] Deserialization problem on ... | Deserializes request content . |
234,231 | public static function make ( $ uri , $ data = null , array $ queryParameters = [ ] , array $ headers = [ ] , $ method = null , $ contentType = null , $ contentCharset = null ) { if ( is_null ( $ method ) ) { $ method = is_null ( $ data ) ? static :: METHOD_GET : static :: METHOD_POST ; } $ uri = UriFactory :: make ( $... | Makes PSR - 7 compliant Request object from provided parameters |
234,232 | private static function extractCharset ( array $ contentTypeParts ) { foreach ( $ contentTypeParts as $ part ) { $ elements = explode ( '=' , $ part ) ; $ key = trim ( array_shift ( $ elements ) ) ; if ( strtolower ( $ key ) === 'charset' ) { $ value = trim ( reset ( $ elements ) ) ; return $ value ? : null ; } } retur... | Tries to extract charset from pre - parsed part of Content - Type value |
234,233 | public static function hasAction ( $ hook = '' , callable $ callback = null , $ priority = null ) { return static :: hasHook ( 'action' , $ hook , $ callback , $ priority ) ; } | Check if an action hook is added . Optionally check a specific callback and and priority . |
234,234 | public static function hasFilter ( $ hook = '' , callable $ callback = null , $ priority = null ) { return static :: hasHook ( 'filter' , $ hook , $ callback , $ priority ) ; } | Check if an filter hook is added . Optionally check a specific callback and and priority . |
234,235 | public static function hasHookFired ( $ type = 'action' , $ hook = null ) { if ( ! in_array ( $ type , [ 'action' , 'filter' ] , true ) ) { $ type = 'action' ; } $ target = $ type === 'filter' ? 'filters' : 'actions' ; if ( empty ( $ hook ) || ! is_string ( $ hook ) ) { $ msg = __METHOD__ . ' needs a valid hook to chec... | Check if an hook is was fired . |
234,236 | public static function assertActionAdded ( $ hook = '' , $ callback = null , $ priority = null , $ argsNum = null ) { static :: assertHookAdded ( 'action' , $ hook , $ callback , $ priority , $ argsNum ) ; } | Check if an action is added and throws a exceptions otherwise . |
234,237 | public static function assertFilterAdded ( $ hook = '' , callable $ callback = null , $ priority = null , $ numArgs = null ) { static :: assertHookAdded ( 'filter' , $ hook , $ callback , $ priority , $ numArgs ) ; } | Check if a filter is added and throws an exceptions otherwise . |
234,238 | public function getSrcsetAttributeValue ( ) { $ srcset = [ ] ; foreach ( $ this -> versions as $ id ) { $ srcset [ ] = sprintf ( '%s %sw' , $ id -> getUrl ( ) , $ id -> getWidth ( ) ) ; } return join ( ', ' , $ srcset ) ; } | Get the value for the srcset HTML attribute |
234,239 | public function getDefaultImageInfo ( ) { if ( isset ( $ this -> versions [ $ this -> class -> getDefaultWidth ( ) ] ) ) { return $ this -> versions [ $ this -> class -> getDefaultWidth ( ) ] ; } else { return reset ( $ this -> versions ) ; } } | Get WebImageInfo object for the default image size |
234,240 | public function createResizedVersions ( ImageResizer $ resizer ) { foreach ( $ this -> class -> getImageResizeDefinitions ( ) as $ ird ) { $ resizer -> resize ( $ ird , $ this -> original_ifi , true ) ; } } | Really create all resized versions of this image |
234,241 | public function getResizedVersion ( ImageResizer $ resizer , $ width ) { if ( ! $ this -> class -> hasWidth ( $ width ) ) { throw new WidthNotAllowedException ( $ width ) ; } return $ resizer -> resize ( $ this -> class -> getImageResizeDefinitionByWidth ( $ width ) , $ this -> original_ifi , true ) ; } | Resize the image to a defined width and return the corresponding ImageFileInfo object |
234,242 | protected function className ( $ suffix = '' ) { $ exp = explode ( '\\' , $ this -> getClass ( ) ) ; return ( ! empty ( $ suffix ) && substr ( $ exp [ count ( $ exp ) - 1 ] , ( strlen ( $ exp [ count ( $ exp ) - 1 ] ) - strlen ( $ suffix ) ) ) === $ suffix ) ? substr ( $ exp [ count ( $ exp ) - 1 ] , 0 , ( strlen ( $ e... | Fetches the class name |
234,243 | protected function getNamespace ( ) { $ np = explode ( '\\' , $ this -> getClass ( ) ) ; unset ( $ np [ count ( $ np ) - 1 ] ) ; return join ( '\\' , $ np ) ; } | Fetches the namespace of the current class |
234,244 | final protected function ExceptionAsXML ( \ Exception $ e , \ DOMNode & $ par ) { $ exc = $ par -> appendChild ( $ this -> createElement ( 'Exception' ) ) ; $ exc -> appendChild ( $ this -> createElement ( 'File' , $ e -> getFile ( ) ) ) ; $ exc -> appendChild ( $ this -> createElement ( 'Line' , $ e -> getLine ( ) ) )... | Converts a PHP Exception into a populated XML node |
234,245 | public static function boot ( ) { parent :: boot ( ) ; static :: deleting ( function ( $ permission ) { if ( ! method_exists ( config ( 'access.permission' ) , 'bootSoftDeletes' ) ) { $ permission -> roles ( ) -> sync ( [ ] ) ; } return true ; } ) ; } | Boot the permission model Attach event listener to remove the many - to - many records when trying to delete Will NOT delete any records if the permission model uses soft deletes . |
234,246 | public function getLimit ( $ end = false ) { $ bottom = ( $ this -> maxPerPage * ( $ this -> pageCurrent - 1 ) ) ; $ top = $ this -> maxPerPage ; if ( $ end === false ) { return array ( $ bottom , $ top ) ; } if ( $ end === 0 ) { return $ bottom ; } if ( $ end === 1 ) { return $ top ; } } | get a limit array usable in an sql query |
234,247 | public function generate ( $ pageCurrent , $ totalRows ) { $ this -> totalRows = $ totalRows ; $ this -> setPossiblePages ( ) ; $ this -> setPageCurrent ( $ pageCurrent ) ; if ( $ this -> possiblePages < 2 ) { return ; } $ pageCurrent = $ this -> pageCurrent ; $ pagination = $ this -> getPaginationContainer ( ) ; if ( ... | build the pagination array |
234,248 | protected function urlBuildPageLink ( $ page ) { $ url = $ this -> url ; $ urlBase = $ url -> generate ( ) . $ url -> getPath ( ) ; $ queryParts = $ url -> getQueryArray ( ) ; $ queryParts [ 'page' ] = $ page ; return $ urlBase . '?' . http_build_query ( $ queryParts ) ; } | add the page to the query string create an absolute url |
234,249 | protected function setPageCurrent ( $ page ) { $ page += 0 ; $ page = ( int ) $ page ; $ page = $ page ? $ page : 1 ; if ( $ page > $ this -> possiblePages ) { $ page = $ this -> possiblePages ; } $ this -> pageCurrent = $ page ; } | page is set within the constraints of lowest and highest value |
234,250 | public function regex ( ) { $ uri = preg_replace ( '#\(/\)#' , '/?' , $ this -> uri ) ; $ uri = $ this -> capture ( $ uri , '/:(' . self :: ALLOWED_REGEX . ')/' ) ; $ uri = $ this -> capture ( $ uri , '/{(' . self :: ALLOWED_REGEX . ')}/' ) ; return ( string ) '@^' . $ uri . '$@D' ; } | Returns a regular expression pattern from the given URI . |
234,251 | protected function capture ( $ pattern , $ search ) { $ replace = '(?<$1>' . self :: ALLOWED_REGEX . ')' ; return preg_replace ( $ search , $ replace , $ pattern ) ; } | Capture the specified regular expressions . |
234,252 | public function addField ( Field $ field ) { $ name = $ field -> getName ( ) ; if ( array_key_exists ( $ name , $ this -> fields ) ) { throw new DuplicateFieldNameException ( $ name ) ; } $ this -> fields [ $ name ] = $ field ; foreach ( $ field -> getAliases ( ) as $ alias ) { if ( array_key_exists ( $ alias , $ this ... | Define a field |
234,253 | public function removeField ( $ name ) { if ( ( $ field = $ this -> getField ( $ name ) ) === null ) { return false ; } foreach ( $ field -> getAliases ( ) as $ alias ) { unset ( $ this -> fieldAliases [ $ alias ] ) ; } unset ( $ this -> fields [ $ name ] ) ; return true ; } | Remove a field from the collection |
234,254 | public function getField ( $ name ) { if ( array_key_exists ( $ name , $ this -> fields ) ) { return $ this -> fields [ $ name ] ; } else if ( array_key_exists ( $ name , $ this -> fieldAliases ) ) { $ name = $ this -> fieldAliases [ $ name ] ; return $ this -> fields [ $ name ] ; } return null ; } | Get a field instance |
234,255 | public function getFields ( $ visibility = Field :: VISIBILITY_PUBLIC ) { $ ret = [ ] ; foreach ( $ this -> fields as $ name => $ field ) { if ( $ field -> getVisibility ( ) & $ visibility ) { $ ret [ $ name ] = $ field ; } } return $ ret ; } | Get an associative array of the fields in this collection |
234,256 | public function addValues ( array $ fieldValues ) { foreach ( $ fieldValues as $ fieldName => $ values ) { $ values = Arr :: cast ( $ values ) ; if ( null === ( $ field = $ this -> getField ( $ fieldName ) ) ) { $ message = "unknown field" ; $ len = count ( $ values ) ; if ( $ len !== 1 ) { $ message .= " (encountered ... | Add values to the fields in the collection |
234,257 | public function validate ( ) { $ errs = count ( $ this -> errors ) ; $ dataKey = constant ( get_called_class ( ) . "::EVENT_DATA_KEY" ) ; if ( $ this -> beforeValidate ( ) !== true ) { return false ; } foreach ( $ this -> fields as $ field ) { if ( $ field -> validate ( $ this ) === false ) { foreach ( $ field -> getEr... | Validate the all the fields |
234,258 | public function addError ( Error $ error , $ prepend = false ) { if ( $ prepend === true ) { array_unshift ( $ this -> errors , $ error ) ; } else { $ this -> errors [ ] = $ error ; } return count ( $ this -> errors ) ; } | Add a validation error |
234,259 | public function getErrors ( $ name = null ) { if ( $ name === null ) { return $ this -> errors ; } $ ret = [ ] ; foreach ( $ this -> errors as $ error ) { if ( $ error -> getName ( ) === $ name ) { $ ret [ ] = $ error ; } } return $ ret ; } | Get validation errors for one or all fields |
234,260 | public function exportErrors ( ) { $ ret = [ ] ; foreach ( $ this -> errors as $ error ) { $ ret [ ] = $ error -> export ( ) ; } return $ ret ; } | Export validation errors for all fields |
234,261 | public function exportFieldValue ( $ name , $ exportHandler = null ) { if ( ! is_string ( $ name ) ) { throw new InvalidArgumentException ( "invalid value provided for 'name'; " . "expecting a field name as string" ) ; } else if ( ( $ field = $ this -> getField ( $ name ) ) == null ) { throw new UnknownFieldException (... | Convenience method to get a particular field value |
234,262 | public function exportValues ( ) { $ ret = [ ] ; foreach ( $ this -> fields as $ field ) { if ( $ field -> getExportHandler ( ) !== Field :: EXPORT_SKIP ) { $ ret [ $ field -> getName ( ) ] = $ field -> exportValue ( ) ; } } return $ ret ; } | Get all field values using their respective export handlers |
234,263 | private function initializeCredentials ( ) { $ this -> credentials = base64_encode ( sprintf ( '%s:%s' , urlencode ( $ this -> configuration -> getConsumerKey ( ) ) , urlencode ( $ this -> configuration -> getConsumerSecret ( ) ) ) ) ; } | Initializes the bearer token credentials in the expected format |
234,264 | public function getAll ( ) { $ request = new KmbPuppetDb \ Request ( '/fact-names' ) ; $ response = $ this -> getPuppetDbClient ( ) -> send ( $ request ) ; return ( array ) $ response -> getData ( ) ; } | Get all fact names . |
234,265 | protected function getParameter ( $ name ) { if ( $ this -> hasResolver ( ) ) { $ found = $ this -> getResolver ( ) -> get ( $ name ) ; } else { $ parts = explode ( '.' , $ name ) ; $ found = $ this -> parameters ; while ( null !== ( $ part = array_shift ( $ parts ) ) ) { if ( ! isset ( $ found [ $ part ] ) ) { $ found... | Get this paramter s value either a string or an associate array |
234,266 | protected function fixServices ( array & $ definitions ) { foreach ( $ definitions as $ id => $ def ) { if ( is_array ( $ def ) ) { if ( ! isset ( $ def [ 'class' ] ) ) { $ def = [ 'class' => $ def ] ; } elseif ( ! is_array ( $ def [ 'class' ] ) ) { $ def [ 'class' ] = [ $ def [ 'class' ] ] ; } } else { $ def = [ 'clas... | Normalize service definitions |
234,267 | protected function getMySQLqueryType ( $ sQuery ) { $ queryPieces = explode ( ' ' , $ sQuery ) ; $ statementTypes = $ this -> listOfMySQLqueryStatementType ( $ queryPieces [ 0 ] ) ; if ( in_array ( $ queryPieces [ 0 ] , $ statementTypes [ 'keys' ] ) ) { $ type = $ statementTypes [ 'value' ] [ 'Type' ] ; $ ar1 = [ '1st ... | Returns the Query language type by scanning the 1st keyword from a given query |
234,268 | private function listOfMySQLqueryLanguageType ( $ qType ) { $ keyForReturn = 'Type ' . $ qType . ' stands for' ; $ vMap = [ 'DCL' , 'DDL' , 'DML' , 'DQL' , 'DTL' ] ; if ( in_array ( $ qType , $ vMap ) ) { $ valForReturn = $ this -> readTypeFromJsonFile ( 'MySQLiLanguageTypes' ) [ $ qType ] ; return [ $ keyForReturn => ... | Just to keep a list of type of language as array |
234,269 | private function listOfMySQLqueryStatementType ( $ firstKwordWQuery ) { $ statmentsArray = $ this -> readTypeFromJsonFile ( 'MySQLiStatementTypes' ) ; return [ 'keys' => array_keys ( $ statmentsArray ) , 'value' => [ 'Description' => $ statmentsArray [ $ firstKwordWQuery ] [ 1 ] , 'Type' => $ statmentsArray [ $ firstKw... | Just to keep a list of statement types as array |
234,270 | public function add ( $ oEntity ) { $ this -> checkClass ( $ oEntity ) ; $ this -> values [ $ oEntity -> getCollectionIndex ( ) ] = $ oEntity ; return $ this ; } | Add Entity to collection |
234,271 | protected function indexEntities ( array $ aEntities ) { $ aIndexEntities = array ( ) ; foreach ( $ aEntities as $ oEntity ) { $ aIndexEntities [ $ oEntity -> getCollectionIndex ( ) ] = $ oEntity ; } return $ aIndexEntities ; } | Create index array |
234,272 | protected function determineFeedType ( ) { $ feedType = strtolower ( $ this -> getRoutedParameter ( 'feedType' , static :: TYPE_JSON ) ) ; if ( $ feedType == static :: TYPE_JSON ) { $ this -> displayResolver = static :: RESOLVER_JSON ; if ( empty ( $ this -> callback ) ) { $ this -> contentType = static :: CONTENT_TYPE... | Determine feed type |
234,273 | public static function getWriters ( ) { if ( is_null ( self :: $ _writers ) ) { $ writers = Config :: getInstance ( "JooS_Log" ) -> writers ; if ( ! is_null ( $ writers ) ) { foreach ( $ writers -> valueOf ( ) as $ name ) { $ name = ucfirst ( strtolower ( $ name ) ) ; $ className = Loader :: getClassName ( __NAMESPACE_... | Return log writers |
234,274 | public static function addWriter ( Log_Interface $ writer ) { if ( is_null ( self :: $ _writers ) ) { self :: $ _writers = array ( ) ; } $ key = get_class ( $ writer ) ; if ( ! isset ( self :: $ _writers [ $ key ] ) ) { self :: $ _writers [ $ key ] = $ writer ; $ result = true ; } else { $ result = false ; } return $ r... | Add new writer |
234,275 | public function action ( $ name ) { $ command = '\\App\\Consoles\\' . ucfirst ( $ name ) . 'ConsoleCommand' ; $ command = class_exists ( $ command ) ? $ command : '\\Micro\\Cli\\Consoles\\' . ucfirst ( $ name ) . 'ConsoleCommand' ; if ( ! class_exists ( $ command ) ) { throw new Exception ( 'Command `' . $ name . '` no... | Run action of console command by name |
234,276 | public function regenerateUsernamePasswordTokenWithRoles ( array $ roles , $ mergeWithExistingRoles = true ) { $ user = $ this -> token -> getUser ( ) ; $ credentials = $ this -> token -> getCredentials ( ) ; $ providerKey = $ this -> token -> getProviderKey ( ) ; if ( $ mergeWithExistingRoles ) { $ roles = array_merge... | Regenerate same instance of this token with another roles |
234,277 | public function canSeePv ( $ gid = null ) { $ result = false ; if ( is_null ( $ gid ) ) { $ gid = $ this -> session -> getCustomerGroupId ( ) ; } if ( ! isset ( $ this -> cacheCanSeeByGid [ $ gid ] ) ) { $ item = $ this -> daoPvCustGroup -> getById ( $ gid ) ; if ( $ item ) $ result = ( bool ) $ item -> getCanSeePv ( )... | Cached accessor for Can See PV flag . |
234,278 | public function makeLinks ( $ text ) { $ pattern = '~(?xi) (?: ((ht|f)tps?://) # scheme:// | # or www\d{0,3}\. # "www.", "www1.", "www2." ... "www999." | ... | Make the links clickable . |
234,279 | public function makeHTML ( $ text ) { $ html = $ text ; if ( $ this -> defaultActions [ 'makeLinks' ] ) { $ html = $ this -> makeLinks ( $ html ) ; } if ( $ this -> defaultActions [ 'convertLineEndings' ] ) { $ html = $ this -> convertLineEndings ( $ html ) ; } return $ html ; } | The main function to use instead of calling everything individually . |
234,280 | public function generateTag ( $ tag , $ attributes , $ closeTag = true ) { $ openPattern = replace_variables ( $ this -> openTagPattern , compact ( 'tag' ) ) ; $ external = '' ; if ( in_array ( $ tag , $ this -> voidTags ) && ! empty ( $ this -> voidTagPattern ) && $ this -> voidTagPattern != $ this -> openTagPattern )... | Generate an HTML tag . |
234,281 | public function closeTag ( $ tag ) { if ( ! in_array ( $ tag , $ this -> voidTags ) ) { return replace_variables ( $ this -> closeTagPattern , compact ( 'tag' ) ) ; } return '' ; } | Close an HTML tag . |
234,282 | public function setCachingHeaders ( $ intervalString = CachableBaseComponent :: DEFAULT_MAXAGE ) { $ expires = new \ DateTime ( ) ; $ interval = new \ DateInterval ( $ intervalString ) ; $ maxAge = date_create ( '@0' ) -> add ( $ interval ) -> getTimestamp ( ) ; $ expires = $ expires -> add ( $ interval ) ; ResponseHea... | Set the default caching of pages |
234,283 | public function setNotCachingHeaders ( ) { ResponseHeaders :: add ( ResponseHeaders :: HEADER_CACHE_CONTROL , ResponseHeaders :: HEADER_CACHE_CONTROL_CONTENT_NO_STORE_NO_CACHE_MUST_REVALIDATE_MAX_AGE_0 ) ; ResponseHeaders :: add ( ResponseHeaders :: HEADER_PRAGMA , ResponseHeaders :: HEADER_PRAGMA_CONTENT_NO_CACHE ) ; ... | Set non caching |
234,284 | public function tokenize ( $ input ) { $ tokens = [ ] ; $ exp = ltrim ( $ input ) ; for ( $ length = strlen ( $ exp ) , $ i = 0 ; $ i < $ length ; $ i ++ ) { if ( trim ( $ exp [ $ i ] ) == '' ) { continue ; } if ( NULL !== ( $ token = $ this -> getTerminalToken ( $ exp , $ i ) ) ) { $ tokens [ ] = $ token ; continue ; ... | Tokenize the given source string into annotation tokens and returns the created token sequence . |
234,285 | protected function getStringToken ( $ exp , $ length , & $ i ) { if ( $ exp [ $ i ] == '"' || $ exp [ $ i ] == "'" ) { $ delim = $ exp [ $ i ++ ] ; $ buffer = '' ; $ terminated = false ; $ escaped = false ; for ( ; $ i < $ length ; $ i ++ ) { if ( $ exp [ $ i ] == '\\' ) { $ escaped = ! $ escaped ; } elseif ( $ exp [ $... | Reads a string token from the source expression . |
234,286 | protected function getIntegerToken ( array $ m ) { $ sign = ( isset ( $ m [ 'sign' ] ) && $ m [ 'sign' ] == '-' ) ? - 1 : 1 ; if ( isset ( $ m [ 'oct' ] ) && $ m [ 'oct' ] != '' ) { return new AnnotationToken ( AnnotationToken :: T_INTEGER , $ sign * intval ( $ m [ 'oct' ] , 8 ) ) ; } if ( isset ( $ m [ 'bin' ] ) && $ ... | Builds an integer token from the given match of PATTERN_INTEGER . |
234,287 | public function registerLogger ( LoggerInterface $ logger = null , $ debug = false ) { $ this -> logger = $ logger ? : new NullLogger ( ) ; $ this -> debug = $ debug ; return $ this ; } | register a logger and eventually debug mode into Loggable class |
234,288 | public function insert ( $ fields ) { $ _tmp_fields = [ ] ; $ _tmp_values = [ ] ; if ( is_array ( $ fields ) ) { foreach ( $ fields as $ key => $ value ) { array_push ( $ _tmp_fields , $ key ) ; if ( is_string ( $ value ) ) { array_push ( $ _tmp_values , '\'' . addslashes ( $ value ) . '\'' ) ; } else { array_push ( $ ... | Insert data to table |
234,289 | public function update ( $ fields ) { if ( is_array ( $ fields ) ) { foreach ( $ fields as $ key => $ value ) { if ( is_string ( $ value ) ) { array_push ( $ this -> _updates , $ key . ' = \'' . addslashes ( $ value ) . '\'' ) ; } else { array_push ( $ this -> _updates , $ key . ' = ' . $ value ) ; } } } else { return ... | Update data from table |
234,290 | public function asc ( $ fields ) { if ( is_array ( $ fields ) ) { $ this -> _order = ' ORDER BY ' . implode ( $ fields , ', ' ) . ' ASC' ; } else { $ this -> _order = ' ORDER BY ' . $ fields . ' ASC' ; } return $ this ; } | Order by ascending |
234,291 | public function desc ( $ fields ) { if ( is_array ( $ fields ) ) { $ this -> _order = ' ORDER BY ' . implode ( $ fields , ', ' ) . ' DESC' ; } else { $ this -> _order = ' ORDER BY ' . $ fields . ' DESC' ; } return $ this ; } | Order by descending |
234,292 | public function leftJoin ( $ table , $ field1 , $ operator , $ field2 ) { array_push ( $ this -> _joins , ' LEFT JOIN ' . $ table . ' ON ' . $ field1 . ' ' . $ operator . ' ' . $ field2 . ' ' ) ; return $ this ; } | Left Join Tables |
234,293 | public function rightJoin ( $ table , $ field1 , $ operator , $ field2 ) { array_push ( $ this -> _joins , ' RIGHT JOIN ' . $ table . ' ON ' . $ field1 . ' ' . $ operator . ' ' . $ field2 . ' ' ) ; return $ this ; } | Right Join Tables |
234,294 | private function AddSitemapActiveField ( ) { $ name = 'SitemapActive' ; $ field = new Checkbox ( $ name ) ; if ( ! $ this -> site -> Exists ( ) || $ this -> site -> GetSitemapActive ( ) ) { $ field -> SetChecked ( ) ; } $ this -> AddField ( $ field ) ; } | Adds the sitemap active checkbox |
234,295 | protected function OnSuccess ( ) { $ action = Action :: Update ( ) ; if ( ! $ this -> site -> Exists ( ) ) { $ action = Action :: Create ( ) ; $ this -> site -> SetUser ( self :: Guard ( ) -> GetUser ( ) ) ; } $ this -> site -> SetName ( $ this -> Value ( 'Name' ) ) ; $ this -> site -> SetUrl ( $ this -> Value ( 'Url' ... | Saves the site |
234,296 | public function get ( ? string $ index , string $ text , ? array $ params = null ) { if ( App :: $ Request -> getLanguage ( ) !== App :: $ Properties -> get ( 'baseLanguage' ) ) { if ( $ index && ! Arr :: in ( $ index , $ this -> indexes ) ) { $ this -> cached = Arr :: merge ( $ this -> cached , $ this -> load ( $ inde... | Get internalization of current text from i18n |
234,297 | public function translate ( string $ text , array $ params = null ) { $ index = null ; $ namespace = 'Apps\Controller\\' . env_name . '\\' ; foreach ( @ debug_backtrace ( ) as $ caller ) { if ( isset ( $ caller [ 'class' ] ) && Str :: startsWith ( $ namespace , $ caller [ 'class' ] ) ) { $ index = Str :: sub ( ( string... | Get internalization based on called controller |
234,298 | protected function load ( string $ index ) : ? array { $ file = root . '/I18n/' . env_name . '/' . App :: $ Request -> getLanguage ( ) . '/' . $ index . '.php' ; if ( ! File :: exist ( $ file ) ) { return [ ] ; } return require ( $ file ) ; } | Load locale file from local storage |
234,299 | public function append ( $ path ) : bool { $ path = Normalize :: diskFullPath ( $ path ) ; if ( ! File :: exist ( $ path ) ) { return false ; } $ addTranslation = require ( $ path ) ; if ( ! Any :: isArray ( $ addTranslation ) ) { return false ; } $ this -> cached = Arr :: merge ( $ this -> cached , $ addTranslation ) ... | Append translation data from exist full path |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.