idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
237,600
public function clearAuthorizationState ( $ service ) { $ service = $ this -> normalizeServiceName ( $ service ) ; $ states = $ this -> sessionScope -> get ( self :: SESSION_STATE ) ; if ( array_key_exists ( $ service , $ states ) ) { unset ( $ states , $ service ) ; } $ this -> sessionScope -> set ( self :: SESSION_ST...
Clear the authorization state of a given service
237,601
public function getParameterDefinition ( $ name ) { if ( $ this -> hasParametersDefinitions ( ) ) { foreach ( $ this -> getParametersDefinitions ( ) as $ parameterDefinition ) { if ( $ parameterDefinition -> name === $ name ) { return $ parameterDefinition ; } } } return null ; }
Get specified parameter definition .
237,602
public function getParameterTemplate ( $ name ) { if ( $ this -> hasParametersTemplates ( ) ) { foreach ( $ this -> getParametersTemplates ( ) as $ parameterTemplate ) { if ( $ parameterTemplate -> name === $ name ) { return $ parameterTemplate ; } } } return null ; }
Get specified parameter template .
237,603
private function addShopFieldset ( FormInterface $ form ) { $ shopsData = $ form -> addChild ( $ this -> getElement ( 'nested_fieldset' , [ 'name' => 'shops_data' , 'label' => $ this -> trans ( 'common.fieldset.shops' ) ] ) ) ; $ shopsData -> addChild ( $ this -> getElement ( 'multi_select' , [ 'name' => 'shops' , 'lab...
Adds shop selector fieldset to form
237,604
public function fromMessage ( $ message ) { static $ parser ; if ( ! $ parser ) { $ parser = new MessageParser ( ) ; } if ( strtoupper ( substr ( $ message , 0 , 4 ) ) == 'HTTP' ) { $ data = $ parser -> parseResponse ( $ message ) ; return $ this -> createResponse ( $ data [ 'code' ] , $ data [ 'headers' ] , $ data [ '...
Create a request or response object from an HTTP message string
237,605
protected function addPostData ( RequestInterface $ request , array $ body ) { static $ fields = [ 'string' => true , 'array' => true , 'NULL' => true , 'boolean' => true , 'double' => true , 'integer' => true ] ; $ post = new PostBody ( ) ; foreach ( $ body as $ key => $ value ) { if ( isset ( $ fields [ gettype ( $ v...
Apply POST fields and files to a request to attempt to give an accurate representation .
237,606
public static function read ( $ file , $ force = false ) { if ( ! is_readable ( $ file ) ) { if ( $ force === true ) { return [ ] ; } else { throw new Exception ( sprintf ( 'Unable to read file "%s"' , $ file ) , ExitApp :: RUNTIME_ERROR ) ; } } $ fileContent = file_get_contents ( $ file ) ; if ( $ fileContent === fals...
Parse a JSON file
237,607
public static function write ( $ file , array $ content ) { $ jsonString = json_encode ( $ content , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) ; if ( $ jsonString === false ) { throw new Exception ( 'Unable to convert array to JSON string' , ExitApp :: RUNTIME_ERROR ) ; } $ status = file_put_contents ( $ file , $ js...
Write JSON - formatted content to file
237,608
public function generate ( string $ path , string $ namespace , string $ name ) { $ name = $ this -> camelize ( $ name ) ; $ vars = [ 'NAMESPACE' => $ namespace , 'NAME' => $ name , 'NAME:CAMELIZED' => $ name , 'NAME:UNDERSCORE' => $ this -> underscore ( $ name ) , 'NAME:UPPERCASE' => strtoupper ( $ name ) , ] ; $ this...
Generate a new ModelStructure folder .
237,609
public function getField ( array $ args = [ ] ) { if ( empty ( $ args ) ) { $ args = $ this -> args ; } $ className = sprintf ( 'GeminiLabs\Castor\Forms\Fields\%s' , ucfirst ( $ args [ 'type' ] ) ) ; if ( ! class_exists ( $ className ) ) { throw new ReflectionException ( "Class does not exist: {$className}" ) ; } retur...
Get a specific Field
237,610
public function normalize ( array $ args = [ ] ) { $ defaults = [ 'after' => '' , 'attributes' => '' , 'before' => '' , 'class' => '' , 'default' => null , 'depends' => null , 'desc' => '' , 'errors' => [ ] , 'inline' => false , 'label' => '' , 'name' => '' , 'options' => [ ] , 'path' => '' , 'placeholder' => '' , 'pre...
Normalize the field arguments
237,611
public function render ( $ print = true ) { if ( $ this -> args [ 'render' ] === false ) return ; $ field = $ this -> getField ( ) ; $ class = 'glsr-field' ; $ class .= $ this -> args [ 'errors' ] ? ' glsr-has-error' : '' ; $ renderedString = '%s' ; if ( ( isset ( $ field -> args [ 'required' ] ) && $ field -> args [ '...
Render the field
237,612
protected function checkForErrors ( array $ atts ) { $ args = $ this -> args ; if ( ! array_key_exists ( $ atts [ 'name' ] , $ args [ 'errors' ] ) ) { $ this -> args [ 'errors' ] = '' ; return ; } $ field_errors = $ args [ 'errors' ] [ $ atts [ 'name' ] ] ; $ errors = array_reduce ( $ field_errors [ 'errors' ] , functi...
Check for form submission field errors
237,613
protected function parseAttributes ( array $ args ) { if ( empty ( $ args [ 'attributes' ] ) ) { return [ ] ; } $ attributes = ( array ) $ args [ 'attributes' ] ; foreach ( $ attributes as $ key => $ value ) { if ( is_string ( $ key ) ) continue ; unset ( $ attributes [ $ key ] ) ; if ( ! isset ( $ attributes [ $ value...
Parse the field attributes and convert to an array if needed
237,614
protected function parseId ( array $ args ) { if ( isset ( $ args [ 'id' ] ) && ! $ args [ 'id' ] ) return ; ! $ args [ 'suffix' ] ? : $ args [ 'suffix' ] = "-{$args['suffix']}" ; return str_replace ( [ '[]' , '[' , ']' , '.' ] , [ '' , '-' , '' , '-' ] , $ this -> parseName ( $ args ) . $ args [ 'suffix' ] ) ; }
Parse the field ID from the field path
237,615
protected function parseName ( array $ args ) { $ name = $ args [ 'name' ] ; $ prefix = $ this -> parsePrefix ( $ args ) ; if ( $ prefix === false ) { return $ name ; } $ paths = explode ( '.' , $ name ) ; return array_reduce ( $ paths , function ( $ result , $ value ) { return $ result .= "[$value]" ; } , $ prefix ) ;...
Parse the field name
237,616
protected function parseType ( array $ args ) { $ type = $ args [ 'type' ] ; return false !== stripos ( $ type , '_inline' ) ? str_replace ( '_inline' , '' , $ type ) : $ type ; }
Parse the field type
237,617
protected function parseValue ( array $ args ) { $ default = $ args [ 'default' ] ; $ name = $ args [ 'name' ] ; $ prefix = $ args [ 'prefix' ] ; $ value = $ args [ 'value' ] ; if ( $ default == ':placeholder' ) { $ default = '' ; } return ( ! empty ( $ value ) || ! $ name || $ prefix === false ) ? $ value : $ default ...
Parse the field value
237,618
public function output ( $ response ) { switch ( $ this -> format ) { case 'json' : $ response = array_merge_recursive ( $ response , $ this -> extra ) ; $ this -> header ( 'Content-type: application/json; charset=utf-8' ) ; $ response = json_encode ( $ response ) ; $ response = preg_replace ( '/(")([0-9]+)(")/is' , '\...
Echoes out the response
237,619
public function error ( $ code , $ message , $ extra = [ ] ) { $ response [ 'success' ] = false ; $ this -> extra ( $ extra ) ; if ( ! in_array ( $ code , array_keys ( $ this -> errors ) ) ) { $ code = 500 ; } $ response [ 'error' ] [ 'code' ] = $ code ; $ this -> header ( $ this -> errors [ $ code ] ) ; $ response [ '...
Sets an error header and echoes out the response
237,620
private function html ( $ data ) { if ( ! is_array ( $ data ) ) { return $ data ; } $ return = '' ; foreach ( $ data as $ key => $ value ) { $ return .= '<li>' . $ key . ': ' . ( is_array ( $ value ) ? $ this -> html ( $ value ) : $ value ) . '</li>' ; } return '<ul>' . $ return . '</ul>' ; }
Transforms an array into an HTML list
237,621
private function flashManagement ( ) { $ flashdata = $ _SESSION [ $ this -> flashdataId ] ?? null ; if ( $ flashdata !== null ) { $ flashdata = unserialize ( base64_decode ( $ flashdata ) ) ; unset ( $ _SESSION [ $ this -> flashdataId ] ) ; if ( ! empty ( $ flashdata ) ) { $ this -> flashdata = $ flashdata ; $ this -> ...
Processes current requests flashdata recycles old .
237,622
public function set ( string $ key , $ value ) { $ key = $ this -> security -> normalize ( $ key ) ; $ value = $ this -> security -> normalize ( $ value ) ; parent :: set ( $ key , $ value ) ; $ _SESSION [ $ key ] = $ value ; }
In addition most superglobals are immuteable whereas session is not
237,623
public function destroy ( ) { $ _SESSION = [ ] ; if ( ini_get ( "session.use_cookies" ) ) { $ params = session_get_cookie_params ( ) ; $ time = time ( ) - 42000 ; $ path = $ params [ 'path' ] ; $ domain = $ params [ 'domain' ] ; $ secure = $ params [ 'secure' ] ; $ http = $ params [ 'httponly' ] ; setcookie ( session_n...
destroys a session and related cookies
237,624
protected function loadItemsForCurrentPage ( ) { $ items = $ this -> adapter -> getItems ( $ this -> getOffset ( ) , $ this -> itemsCountPerPage , $ this -> sort ) ; if ( ! ( $ items instanceof \ Traversable ) ) { $ this -> items = new \ ArrayIterator ( $ items ) ; } else { $ this -> items = $ items ; } }
Method load items for current page
237,625
protected function initialize ( array $ options ) { foreach ( $ options as $ option ) { if ( ! $ option instanceof Option ) { throw InvalidOption :: fromOption ( $ option ) ; } $ option = $ this -> identityMap -> put ( $ option , $ this ) ; $ this -> schema [ $ option -> getKey ( ) ] = $ option ; } }
Initialize the internal state of the repository .
237,626
public function getConnectionString ( ) { $ settings = $ this -> connectionInfo ; unset ( $ settings [ 'search_path' ] ) ; foreach ( $ settings as $ key => & $ value ) { $ value = sprintf ( "%s='%s'" , $ key , $ value ) ; } return implode ( ' ' , $ settings ) ; }
Generate a property formatted postgres connection string
237,627
public function findAllWithPagination ( $ filters , $ limit , $ offset , $ resultInArray = FALSE ) { $ where = $ this -> getQueryFilter ( $ filters ) ; $ query = $ this -> getEntityManager ( ) -> createQuery ( 'SELECT m FROM FulgurioLightCMSBundle:Media m ' . $ where . ' ORDER BY m.created_at DESC' ) -> setMaxResults (...
Find media with pagination
237,628
public function count ( $ filters ) { $ where = $ this -> getQueryFilter ( $ filters ) ; $ query = $ this -> getEntityManager ( ) -> createQuery ( 'SELECT COUNT(m) FROM FulgurioLightCMSBundle:Media m' . $ where ) ; if ( ! empty ( $ filters ) ) { foreach ( $ filters as $ filterKey => $ filterValue ) { $ query -> setPara...
Count number of result
237,629
private function getQueryFilter ( $ filters ) { $ where = '' ; if ( ! empty ( $ filters ) ) { foreach ( $ filters as $ filterKey => $ filterValue ) { $ where .= ' AND m.' . $ filterKey . ' LIKE :' . $ filterKey ; } $ where = ' WHERE ' . substr ( $ where , 4 ) ; } return $ where ; }
Make query filter string from given filters
237,630
protected function removeDeletedFsChildrenFromDb ( $ dbChildren ) { $ existingChildren = [ ] ; foreach ( $ dbChildren as $ child ) { if ( ! $ this -> filesystem -> exists ( $ child -> getPath ( ) ) ) { $ this -> nodeRepository -> delete ( $ child ) ; continue ; } $ existingChildren [ ] = $ child ; } return $ existingCh...
Delete the non existing
237,631
protected function absoluteToFilesystemPath ( $ filePath ) { if ( ! $ this -> isWithinFilesystem ( $ filePath ) ) { return $ filePath ; } $ fsPath = ( string ) $ this -> filesystem -> url ( ) -> path ; return str_replace ( $ fsPath , '' , $ filePath ) ; }
Cat the absolute part of a file path off to make a relative filesystem path
237,632
protected function isExcludedFromDb ( $ basename ) { if ( in_array ( mb_strtolower ( $ basename ) , $ this -> excludeFromDb ) ) { return true ; } return Helper :: startsWith ( $ basename , '.' ) || Helper :: startsWith ( $ basename , '_' ) ; }
Return true if the passed file should not be mirrored in the db .
237,633
public function createController ( $ name , SiteTreeNodeInterface $ page = null ) { $ this -> page = $ page ; $ controller = $ this -> makeController ( $ name ) ; $ this -> modifyController ( $ controller , $ page ) ; return $ controller ; }
Creates a controller while routing to a page . This method is used to configure dependencies of you controller according to a page . You can also configure your controller directly like setting a a layout
237,634
public function pushKey ( $ layer ) { $ this -> base .= $ this -> delimiter . str_replace ( $ this -> delimiter , $ this -> placeholder , $ layer ) ; return $ this -> getBase ( ) ; }
Add a layer of depth to the key hierarchy
237,635
public function popKey ( ) { if ( strlen ( $ this -> base ) ) { $ layers = explode ( $ this -> delimiter , $ this -> base ) ; $ last = count ( $ layers ) - 1 ; $ layer = $ layers [ $ last ] ; if ( $ last > 0 ) { unset ( $ layers [ $ last ] ) ; $ this -> base = implode ( $ this -> delimiter , $ layers ) ; } else { $ thi...
Remove a layer of depth from the key hierarchy
237,636
public function postGalleryAction ( ) { $ serializer = $ this -> get ( "tpg_extjs.phpcr_serializer" ) ; $ entity = $ serializer -> deserialize ( $ this -> getRequest ( ) -> getContent ( ) , 'Togu\MediaBundle\Document\Gallery' , 'json' , DeserializationContext :: create ( ) -> setGroups ( array ( "Default" , "post" ) ) ...
Create a new Gallery record
237,637
public function getBackgroundColorEscapeSequence ( $ colorName = '' ) { if ( $ this -> _isDefinedColor ( $ colorName ) === true ) { $ colors = self :: getDefinedColors ( ) ; list ( $ textColor , $ backgroundColor ) = $ colors [ $ colorName ] ; return $ backgroundColor ; } return '' ; }
Get Background color escape sequence
237,638
public function setIsBold ( $ isBold ) { if ( $ isBold === true ) { $ this -> _isBold = true ; } else { $ this -> _isBold = false ; } }
Set which is bold
237,639
public function setIsUnderlined ( $ isUnderlined ) { if ( $ isUnderlined === true ) { $ this -> _isUnderlined = true ; } else { $ this -> _isUnderlined = false ; } }
Set which is underlined
237,640
private function _isDefinedColor ( $ colorName ) { $ colors = self :: getDefinedColors ( ) ; $ colorNames = array_keys ( $ colors ) ; return in_array ( $ colorName , $ colorNames ) ; }
Which is defined color
237,641
final protected static function triggerEvent ( $ event , array $ context = array ( ) ) { if ( array_key_exists ( $ event , static :: $ registered_events ) ) { array_map ( function ( $ handler ) use ( $ context ) { call_user_func ( $ handler , $ context ) ; } , static :: $ registered_events [ $ event ] ) ; } }
Trigger an event an call its callback if any exist . Otherwise nothing
237,642
public function getElement ( ) { if ( $ this -> getDocblock ( ) ) { $ this -> setLines ( $ this -> getDocblock ( ) -> getElement ( ) ) ; } $ name = '' ; if ( $ this -> getName ( ) and ! is_array ( $ this -> getValue ( ) ) ) { $ name = ( $ this -> getType ( ) ? $ this -> getType ( ) . ' ' : '' ) . '$' . $ this -> getNam...
Return param content
237,643
public function offsetSet ( $ mOffset , $ oEntity ) { $ this -> checkClass ( $ oEntity ) ; return parent :: offsetSet ( $ mOffset , $ oEntity ) ; }
set the entity by the given offset
237,644
public function toArray ( ) { $ aReturn = array ( ) ; foreach ( $ this -> values as $ sKey => $ oEntity ) { $ aReturn [ $ sKey ] = $ oEntity -> toArray ( ) ; } return $ aReturn ; }
return this collection as array
237,645
protected function checkPropertyIncrement ( BaseProperty $ baseProperty , Profession $ profession ) { $ propertyFirstLevelModifier = static :: getBasePropertyFirstLevelModifier ( PropertyCode :: getIt ( $ baseProperty -> getCode ( ) ) , $ profession ) ; if ( $ baseProperty -> getValue ( ) !== $ propertyFirstLevelModifi...
It is only the increment based on first level of specific profession . There are other increments like race size etc . solved in different library .
237,646
final public static function instance ( ) { $ c = get_called_class ( ) ; if ( ! isset ( self :: $ instances [ $ c ] ) ) { self :: $ instances [ $ c ] = new $ c ; } return self :: $ instances [ $ c ] ; }
Grab an instance of the singleton .
237,647
public static function out ( $ line , ... $ args ) { if ( count ( $ args ) > 0 ) { $ line = call_user_func_array ( 'sprintf' , array_merge ( [ $ line ] , $ args ) ) ; } fwrite ( STDOUT , $ line . PHP_EOL ) ; }
Write line to STDOUT
237,648
public static function err ( $ message , ... $ args ) { if ( count ( $ args ) > 0 ) { $ message = call_user_func_array ( 'sprintf' , array_merge ( [ $ message ] , $ args ) ) ; } fwrite ( STDERR , $ message . PHP_EOL ) ; }
Write message to STDERR
237,649
public static function in ( $ message , ... $ args ) { if ( $ message !== '' ) { if ( count ( $ args ) > 0 ) { $ message = call_user_func_array ( 'sprintf' , array_merge ( [ $ message ] , $ args ) ) ; } $ message .= ' ' ; } fwrite ( STDERR , $ message ) ; $ input = fgets ( STDIN ) ; if ( $ input === false ) { throw new...
Read from STDIN
237,650
public static function validate ( $ type , $ paramName , $ data , array $ params = [ ] ) { $ data = ( array ) $ data ; switch ( $ type ) { case self :: VALIDATOR_USER : return static :: validateByCallback ( $ paramName , $ data , $ params ) ; case self :: VALIDATOR_EMAIL : return static :: validateEmail ( $ paramName ,...
Validate by type
237,651
public static function validateEmail ( $ paramName , array $ data ) { $ result = false ; if ( isset ( $ data [ $ paramName ] ) ) { $ result = filter_var ( $ data [ $ paramName ] , FILTER_VALIDATE_EMAIL ) !== false ; } else { throw new \ Exception ( 'Parameter is not set' ) ; } return $ result ; }
Validate e - mail
237,652
public static function validateByCallback ( $ paramName , array $ data , array $ params ) { if ( isset ( $ params [ 'callback' ] ) ) { return $ params [ 'callback' ] ( $ paramName , $ data ) ; } else { throw new \ Exception ( 'Callback parameter is required' ) ; } }
Validate by user function
237,653
public function release ( RevisionInterface $ revision , UserInterface $ user , $ comment ) { $ connection = $ this -> revisionRepository -> getDbAdapter ( ) -> getDriver ( ) -> getConnection ( ) -> beginTransaction ( ) ; try { if ( $ revision -> getReleasedAt ( ) != null ) { $ this -> revisionRepository -> remove ( $ ...
Release specified revision and create a current revision from it . If the revision had already been released the current revision should be removed first .
237,654
public function remove ( RevisionInterface $ revision ) { $ connection = $ this -> revisionRepository -> getDbAdapter ( ) -> getDriver ( ) -> getConnection ( ) -> beginTransaction ( ) ; try { $ this -> revisionRepository -> remove ( $ revision ) ; if ( $ revision -> getReleasedAt ( ) == null ) { $ lastReleasedRevision ...
Remove specified revision . If it s the current revision another current revision should be recreate from last released revision .
237,655
protected function transformPropertiesToArray ( ) { $ properties = $ this -> project -> getProperties ( ) ; foreach ( $ properties as $ propertyName => $ propertyValue ) { if ( 0 !== strpos ( $ propertyName , $ this -> propertyPrefix . '.' ) ) { continue ; } list ( , $ mainKey , $ subKey ) = $ this -> splitPropertyName...
transforms the flat property list into a local configuration array
237,656
protected function processRequest ( ) { $ request = $ this -> sm -> get ( 'Request' ) ; $ url = explode ( '?' , $ request -> getRequestUri ( ) ) ; $ this -> url = $ url [ 0 ] ; $ params = $ request -> getQuery ( ) ; if ( $ params -> get ( 'page' ) ) { $ this -> setPage ( ( int ) $ params -> get ( 'page' ) ) ; } if ( $ ...
Parses request and sets grid params
237,657
protected function countTotalRows ( ) { $ source = $ this -> getSource ( ) ; $ source -> resetDQLPart ( 'select' ) -> setFirstResult ( 0 ) -> select ( 'count(' . $ this -> entityAlias . ')' ) ; return ( int ) $ source -> getQuery ( ) -> getSingleScalarResult ( ) ; }
Get total rows in result ignoring limit
237,658
public function order ( $ column ) { if ( ! in_array ( $ column , $ this -> allowedOrders ) ) { return null ; } if ( isset ( $ this -> order [ $ column ] ) ) { $ order = strtolower ( $ this -> order [ $ column ] ) == self :: ORDER_ASC ? self :: ORDER_DESC : self :: ORDER_ASC ; } else { $ order = self :: ORDER_ASC ; } r...
Get url for order by column name
237,659
public function getServerMetadata ( Connection $ connection ) { try { $ statement = $ connection -> query ( 'SHOW DATABASES WHERE `Database` NOT IN ("information_schema", "performance_schema", "sys", "mysql");' ) ; } catch ( \ Throwable $ e ) { throw new \ RuntimeException ( 'Failed to list databases: ' . $ e -> getMes...
Query the server and build server metadata DTO .
237,660
public function getDatabaseMetadata ( Connection $ connection , string $ databaseName ) : DatabaseMetadata { $ tableNameStatement = $ connection -> createQueryBuilder ( ) -> select ( [ 'tables.TABLE_NAME AS name' ] ) -> from ( 'information_schema.TABLES' , 'tables' ) -> where ( 'TABLE_SCHEMA = :schema' ) -> andWhere ( ...
Query the server and build database metadata DTO .
237,661
public function getTableMetadata ( Connection $ connection , string $ databaseName , string $ tableName ) : TableMetadata { $ tableStatement = $ connection -> createQueryBuilder ( ) -> select ( [ 'tables.TABLE_NAME AS name' , 'tables.ENGINE AS engine' , 'tables.TABLE_COLLATION AS collation' , 'tables.TABLE_ROWS AS row_...
Query the server and build table metadata DTO .
237,662
public static function getCallStack ( $ asArray = false ) { $ i = 0 ; $ resp = [ ] ; if ( ! $ asArray ) { $ resp [ ] = str_repeat ( '=' , 50 ) ; } foreach ( debug_backtrace ( ) as $ node ) { $ file = Arr :: get ( $ node , 'file' , '' ) ; $ file = $ file ? : 'no_file' ; $ fn = $ node [ 'function' ] ; $ line = Arr :: get...
Prints stack trace .
237,663
public function add ( $ value ) : bool { if ( isset ( $ this -> hashMap [ $ value ] ) ) { return false ; } $ this -> hashMap [ $ value ] = 1 ; return true ; }
Add the given value to the set if it is not already present .
237,664
public function remove ( $ value ) : bool { if ( ! isset ( $ this -> hashMap [ $ value ] ) ) { return false ; } unset ( $ this -> hashMap [ $ value ] ) ; return true ; }
Remove the given value if it s present in the set .
237,665
protected function HasPages ( Site $ site ) { $ this -> site = $ site ; $ this -> tree = new PageTreeProvider ( $ site ) ; $ this -> page = $ this -> tree -> TopMost ( ) ; return ( bool ) $ this -> page ; }
Sets the site as current site and returns true if it has pages below
237,666
public function getTable ( ) { if ( false === isset ( $ this -> table ) ) { $ cl = new \ ReflectionClass ( $ this ) ; return trigger_error ( sprintf ( 'No table specified in "%s" class' , $ cl -> getFileName ( ) ) , E_USER_ERROR ) ; } return $ this -> table ; }
Returns the table
237,667
public function rows ( $ column = '*' , $ where = null , $ params = [ ] ) { if ( null === $ this -> getAdapter ( ) ) { return trigger_error ( sprintf ( 'No database adapter was set in "%s"' , __METHOD__ ) , E_USER_ERROR ) ; } if ( false === is_string ( $ column ) ) { return trigger_error ( sprintf ( 'Argument 1 passed ...
Retrieve the number of rows
237,668
public function call ( $ function , $ params ) { if ( null === $ this -> getAdapter ( ) ) { return trigger_error ( sprintf ( 'No database adapter was set in "%s"' , __METHOD__ ) , E_USER_ERROR ) ; } if ( null !== $ function && false === is_string ( $ function ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to...
Call stored procedure
237,669
public function select ( $ query , $ params = [ ] , $ type = null ) { $ type = $ type === null ? $ this -> getEntityNamespace ( $ this -> getTable ( ) ) : $ type ; if ( null === $ this -> getAdapter ( ) ) { return trigger_error ( sprintf ( 'No database adapter was set in "%s"' , __METHOD__ ) , E_USER_ERROR ) ; } return...
Execute select statement and returns a ResultSet
237,670
private function getEntityNamespace ( $ table ) { if ( false === is_string ( $ table ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ table ) ) , E_USER_ERROR ) ; } $ path = $ this -> getNamespace ( $ this , [ 'directory' , 'dbtable' ] ...
Loads entity table name
237,671
public function range ( $ min , $ max , $ steps = 1 , $ round = 0 ) { if ( false === is_numeric ( $ min ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type float or integer, "%s" given' , __METHOD__ , gettype ( $ min ) ) , E_USER_ERROR ) ; } if ( false === is_numeric ( $ max ) ) { retu...
Set the min . and max . number to iterate . The min will increase by the steps and can be formatted with the round parameter
237,672
protected function getProperty ( $ object , $ name ) { $ class = new \ ReflectionClass ( $ object ) ; while ( ! $ class -> hasProperty ( $ name ) ) { $ class = $ class -> getParentClass ( ) ; } return $ class -> getProperty ( $ name ) ; }
Returns the reflected property .
237,673
public function onPostAutoloadDump ( Event $ event ) { $ this -> io -> writeError ( '<info>Generating extensions files</info>' ) ; foreach ( $ this -> getPackages ( ) as $ package ) { if ( $ package instanceof \ Composer \ Package \ CompletePackageInterface ) { $ this -> processPackage ( $ package ) ; } } $ this -> pro...
Simply rewrites extensions file from scratch .
237,674
public function processPackage ( PackageInterface $ package ) { $ extra = $ package -> getExtra ( ) ; $ files = isset ( $ extra [ self :: EXTRA_OPTION_NAME ] ) ? $ extra [ self :: EXTRA_OPTION_NAME ] : null ; if ( $ package -> getType ( ) !== self :: PACKAGE_TYPE && is_null ( $ files ) ) { return ; } $ extension = [ 'n...
Scans the given package and collects extensions data .
237,675
protected function readExtensionConfig ( PackageInterface $ package , $ file ) { $ path = $ this -> preparePath ( $ package , $ file ) ; if ( ! file_exists ( $ path ) ) { $ this -> io -> writeError ( '<error>Non existent extension config file</error> ' . $ file . ' in ' . $ package -> getName ( ) ) ; exit ( 1 ) ; } ret...
Read extra config .
237,676
public function getGroup ( ) { $ groupTable = CmnTables :: getTableName ( CmnTables :: TABLE_GROUP ) ; return $ this -> hasOne ( Group :: class , [ 'id' => 'groupId' ] ) -> from ( "$groupTable group" ) ; }
Returns the corresponding group .
237,677
public function saveValuelist ( $ slug , $ postValues ) { $ valuelistObject = ValuelistFactory :: createValuelistFromPostValues ( $ postValues ) ; $ valuelists = $ this -> repository -> valuelists ; foreach ( $ valuelists as $ key => $ valuelist ) { if ( $ valuelist -> slug == $ slug ) { $ valuelists [ $ key ] = $ valu...
Save changes to a valuelist
237,678
public function getValuelistBySlug ( $ slug ) { $ valuelists = $ this -> repository -> valuelists ; foreach ( $ valuelists as $ valuelist ) { if ( $ valuelist -> slug == $ slug ) { return $ valuelist ; } } return null ; }
Get a valuelist by its slug
237,679
public function resetConfirmationAction ( $ uuid ) { $ em = $ this -> container -> get ( "doctrine" ) -> getEntityManager ( ) ; $ request = $ this -> container -> get ( "request" ) ; $ confirm_data = $ request -> get ( "haven_bundle_securitybundle_confirmtype" ) ; $ user_reset = $ em -> getRepository ( "HavenSecurityBu...
reset confirmation by the user
237,680
public function get ( $ key , $ default = null ) { $ this -> check ( ) ; $ value = $ this -> readValue ( $ key ) ; return is_null ( $ value ) ? $ default : $ value ; }
Get value from storage
237,681
public function has ( $ key ) { $ this -> check ( ) ; $ data = $ this -> readData ( ) ; return isset ( $ data [ $ key ] ) ; }
Check if storage has given key
237,682
public function destroy ( ) { if ( false === shmop_delete ( $ this -> shm ) ) { throw new RuntimeException ( sprintf ( 'Unable to destroy shared memory segment id: %s' , $ this -> shm ) ) ; } $ this -> destroyed = true ; }
Destroy shared memory segment
237,683
protected function setupSegment ( ) { $ this -> shm = @ shmop_open ( $ this -> getIdentifier ( ) , self :: SHM_OPEN_MODE , 0 , 0 ) ; if ( false === $ this -> shm ) { $ this -> createSegment ( ) ; } }
Create or open shared memory segment using current key
237,684
protected function createSegment ( ) { $ this -> shm = shmop_open ( $ this -> getIdentifier ( ) , self :: SHM_CREATE_MODE , self :: SHM_CREATE_PERMISSIONS , $ this -> size ) ; if ( false === $ this -> shm ) { throw new RuntimeException ( sprintf ( 'Unable to create shared memory segment with key: %s' , $ this -> getIde...
Create new shm segment and write base meta data
237,685
protected function updateSize ( $ size ) { $ size = sprintf ( '%' . self :: SHM_DATA_OFFSET . 'd' , intval ( $ size ) ) ; return ! ! $ this -> write ( 0 , $ size ) ; }
Update size field
237,686
protected function writeValue ( $ key , $ value ) { $ data = $ this -> readData ( ) ; $ data [ $ key ] = $ this -> encode ( $ value ) ; if ( $ this -> writeData ( $ data ) ) { return $ value ; } return false ; }
Write value to shm segment
237,687
protected function unsetValue ( $ key ) { $ data = $ this -> readData ( ) ; unset ( $ data [ $ key ] ) ; return $ this -> writeData ( $ data ) ; }
Removes item from storage
237,688
protected function readValue ( $ key ) { $ data = $ this -> readData ( ) ; return isset ( $ data [ $ key ] ) ? $ this -> decode ( $ data [ $ key ] ) : null ; }
Read value from shm segment
237,689
protected function writeData ( array $ data ) { $ size = $ this -> write ( self :: SHM_DATA_OFFSET , json_encode ( $ data ) ) ; return $ this -> updateSize ( $ size ) ; }
Write data to shm segment
237,690
protected function readData ( ) { $ used = $ this -> readSize ( ) ; return 0 === $ used ? array ( ) : json_decode ( $ this -> read ( self :: SHM_DATA_OFFSET , $ used ) , true ) ; }
Read data from shm segment
237,691
protected function encode ( $ val ) { switch ( true ) { case is_array ( $ val ) : return self :: T_ARRAY . json_encode ( $ val ) ; case is_int ( $ val ) : return self :: T_INT . $ val ; case is_bool ( $ val ) : return self :: T_BOOLEAN . $ val ; case is_float ( $ val ) : return self :: T_DOUBLE . $ val ; case is_object...
Serialize value with type prefix
237,692
protected function decode ( $ encoded ) { $ val = substr ( $ encoded , 1 ) ; switch ( $ encoded [ 0 ] ) { case self :: T_ARRAY : return json_decode ( $ val , true ) ; case self :: T_INT : return intval ( $ val ) ; case self :: T_BOOLEAN : return ! ! $ val ; case self :: T_DOUBLE : return floatval ( $ val ) ; case self ...
Unserialize value from storage
237,693
public function getTwilioConfig ( $ connection = 'twilio' ) { $ twilioconfig = config ( 'twilio.twilio' ) ; $ configSettings = [ ] ; $ configSettings [ 'sid' ] = $ twilioconfig [ 'connections' ] [ $ connection ] [ 'sid' ] ; $ configSettings [ 'token' ] = $ twilioconfig [ 'connections' ] [ $ connection ] [ 'token' ] ; $...
Get the Twilio config settings from the laravel - twilio package
237,694
public function watermarkDimensionCoords ( ) { $ watermarkInfo = $ this -> getWatermarkInfo ( ) ; $ imageInfo = $ this -> getImageInfo ( ) ; switch ( $ this -> getType ( ) ) : case self :: WATERMARK_TYPE_FULLWIDTH : default : $ resizedWatermarkWidth = number_format ( $ imageInfo [ 'width' ] , 0 , ',' , '' ) ; $ resized...
Get watermark type dimension from a type
237,695
public function setWatermarkTmpDir ( $ watermarkTmpDir ) { $ watermarkTmpDirCopy = $ watermarkTmpDir ; $ watermarkTmpDir = realpath ( $ watermarkTmpDir ) ; if ( empty ( $ watermarkTmpDir ) ) { throw new \ RuntimeException ( "Watermark directory is empty. This can be due to the provided directory '" . $ watermarkTmpDirC...
Set the watermark directory
237,696
private function check_type ( ) { $ this_class = new \ ReflectionClass ( $ this ) ; $ type = $ this_class -> getShortName ( ) ; if ( $ type == 'Thing' ) { $ type = $ this -> get_type ( ) ; unset ( $ this -> type ) ; } if ( ! is_null ( $ this -> realType ) ) { $ type = $ this -> realType ; unset ( $ this -> realType ) ;...
In most cases the name of the object withing json - ld markup will be the class name .
237,697
public function format ( ) { $ result = array ( ) ; $ result [ "@type" ] = $ this -> check_type ( ) ; $ values = array_filter ( get_object_vars ( $ this ) ) ; foreach ( $ values as $ key => $ value ) { if ( $ value instanceof ICanBecomeJSONLD ) { $ formatted = $ value -> format ( ) ; if ( ! empty ( $ formatted ) ) { $ ...
Creates an array of schema . org attribute ready to be json encoded .
237,698
protected function addPotentialAction ( ) { $ class = static :: $ helper -> get_search_action_type ( ) ; if ( class_exists ( $ class ) ) { $ class_test = new \ ReflectionClass ( $ class ) ; if ( $ class_test -> implementsInterface ( 'Lti\Seo\Generators\ICanSearch' ) ) { $ this -> potentialAction = new $ class ( static ...
Adds a search potential action if the website supports it .
237,699
private function charCodeAt ( $ str , $ index ) { $ char = mb_substr ( $ str , $ index , 1 , 'UTF-8' ) ; if ( mb_check_encoding ( $ char , 'UTF-8' ) ) { $ ret = mb_convert_encoding ( $ char , 'UTF-32BE' , 'UTF-8' ) ; $ result = hexdec ( bin2hex ( $ ret ) ) ; return $ result ; } return ; }
Get the Unicode of the character at the specified index in a string .