idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
44,900
public function extract ( ) { if ( ! $ this -> valid ( ) ) { return false ; } $ value = $ this -> current ( ) ; $ this -> nextAndRemove ( ) ; return $ value ; }
Extract an element in the queue according to the priority and the order of insertion
44,901
public function current ( ) { switch ( $ this -> extractFlag ) { case self :: EXTR_DATA : return current ( $ this -> values [ $ this -> maxPriority ] ) ; case self :: EXTR_PRIORITY : return $ this -> maxPriority ; case self :: EXTR_BOTH : return [ 'data' => current ( $ this -> values [ $ this -> maxPriority ] ) , 'priority' => $ this -> maxPriority ] ; } }
Get the current element in the queue
44,902
protected function nextAndRemove ( ) { if ( false === next ( $ this -> values [ $ this -> maxPriority ] ) ) { unset ( $ this -> priorities [ $ this -> maxPriority ] ) ; unset ( $ this -> values [ $ this -> maxPriority ] ) ; $ this -> maxPriority = empty ( $ this -> priorities ) ? 0 : max ( $ this -> priorities ) ; $ this -> subIndex = - 1 ; } ++ $ this -> index ; ++ $ this -> subIndex ; -- $ this -> count ; }
Set the iterator pointer to the next element in the queue removing the previous element
44,903
public function next ( ) { if ( false === next ( $ this -> values [ $ this -> maxPriority ] ) ) { unset ( $ this -> subPriorities [ $ this -> maxPriority ] ) ; reset ( $ this -> values [ $ this -> maxPriority ] ) ; $ this -> maxPriority = empty ( $ this -> subPriorities ) ? 0 : max ( $ this -> subPriorities ) ; $ this -> subIndex = - 1 ; } ++ $ this -> index ; ++ $ this -> subIndex ; }
Set the iterator pointer to the next element in the queue without removing the previous element
44,904
public function rewind ( ) { $ this -> subPriorities = $ this -> priorities ; $ this -> maxPriority = empty ( $ this -> priorities ) ? 0 : max ( $ this -> priorities ) ; $ this -> index = 0 ; $ this -> subIndex = 0 ; }
Rewind the current iterator
44,905
public function setExtractFlags ( $ flag ) { switch ( $ flag ) { case self :: EXTR_DATA : case self :: EXTR_PRIORITY : case self :: EXTR_BOTH : $ this -> extractFlag = $ flag ; break ; default : throw new Exception \ InvalidArgumentException ( "The extract flag specified is not valid" ) ; } }
Set the extract flag
44,906
public static function getIPAddress ( ) { if ( isset ( $ _SERVER [ 'HTTP_CLIENT_IP' ] ) ) { return $ _SERVER [ 'HTTP_CLIENT_IP' ] ; } elseif ( isset ( $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] ) ) { return $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] ; } elseif ( isset ( $ _SERVER [ 'REMOTE_ADDR' ] ) ) { return $ _SERVER [ 'REMOTE_ADDR' ] ; } return null ; }
Get the ip address of the client
44,907
public function getOffensivenessOfWeaponlike ( WeaponlikeCode $ weaponlikeCode ) : int { return $ this -> tables -> getWeaponlikeTableByWeaponlikeCode ( $ weaponlikeCode ) -> getOffensivenessOf ( $ weaponlikeCode ) ; }
Even shield can be used as weapon just quite ineffective .
44,908
public function canHoldItByTwoHands ( WeaponlikeCode $ weaponToHoldByTwoHands ) : bool { return $ this -> isTwoHandedOnly ( $ weaponToHoldByTwoHands ) || ( $ weaponToHoldByTwoHands -> isMelee ( ) && $ this -> getLengthOfWeaponOrShield ( $ weaponToHoldByTwoHands ) >= 1 ) ; }
Not all weapons can be hold by two hands - some of them are simply so small so it is not possible or highly ineffective .
44,909
public function getMissingStrengthForArmament ( ArmamentCode $ armamentCode , Strength $ currentStrength , Size $ bodySize ) : int { $ requiredStrength = $ this -> tables -> getArmamentsTableByArmamentCode ( $ armamentCode ) -> getRequiredStrengthOf ( $ armamentCode ) ; if ( $ requiredStrength === false ) { return 0 ; } $ missingStrength = $ requiredStrength - $ currentStrength -> getValue ( ) ; if ( $ armamentCode instanceof ArmorCode ) { $ missingStrength += $ bodySize -> getValue ( ) ; } if ( $ missingStrength < 0 ) { return 0 ; } return $ missingStrength ; }
See PPH page 91 right column
44,910
public function getAttackNumberModifierByDistance ( Distance $ targetDistance , EncounterRange $ currentEncounterRange , MaximalRange $ currentMaximalRange ) : int { if ( $ targetDistance -> getBonus ( ) -> getValue ( ) > $ currentMaximalRange -> getValue ( ) ) { throw new DistanceIsOutOfMaximalRange ( "Given distance {$targetDistance->getBonus()} ({$targetDistance->getMeters()} meters)" . " is out of maximal range {$currentMaximalRange}" . ' (' . $ currentMaximalRange -> getInMeters ( $ this -> tables ) . ' meters)' ) ; } if ( $ currentEncounterRange -> getValue ( ) > $ currentMaximalRange -> getValue ( ) ) { throw new EncounterRangeCanNotBeGreaterThanMaximalRange ( "Got encounter range {$currentEncounterRange} greater than given maximal range {$currentMaximalRange}" ) ; } $ attackNumberModifier = $ this -> tables -> getAttackNumberByContinuousDistanceTable ( ) -> getAttackNumberModifierByDistance ( $ targetDistance ) ; if ( $ targetDistance -> getBonus ( ) -> getValue ( ) > $ currentEncounterRange -> getValue ( ) ) { $ attackNumberModifier += $ currentEncounterRange -> getValue ( ) - $ targetDistance -> getBonus ( ) -> getValue ( ) ; } return $ attackNumberModifier ; }
Distance modifier can be solved very roughly by a simple table or more precisely with continual values by a calculation . This uses that calculation . See PPH page 104 left column .
44,911
public function getLoadingInRoundsByStrengthWithRangedWeapon ( RangedWeaponCode $ rangedWeaponCode , Strength $ currentStrength ) : int { return $ this -> tables -> getRangedWeaponStrengthSanctionsTable ( ) -> getLoadingInRounds ( $ this -> getMissingStrengthForArmament ( $ rangedWeaponCode , $ currentStrength , Size :: getIt ( 0 ) ) ) ; }
The final number of rounds needed to load a weapon .
44,912
public function getLoadingInRoundsMalusByStrengthWithRangedWeapon ( RangedWeaponCode $ rangedWeaponCode , Strength $ currentStrength ) : int { return $ this -> tables -> getRangedWeaponStrengthSanctionsTable ( ) -> getLoadingInRoundsSanction ( $ this -> getMissingStrengthForArmament ( $ rangedWeaponCode , $ currentStrength , Size :: getIt ( 0 ) ) ) ; }
The relative number of rounds as a malus to standard number of rounds needed to load a weapon .
44,913
public function getEncounterRangeWithWeaponlike ( WeaponlikeCode $ weaponlikeCode , Strength $ currentStrength , Speed $ currentSpeed ) : EncounterRange { if ( ! ( $ weaponlikeCode instanceof RangedWeaponCode ) ) { return EncounterRange :: getIt ( 0 ) ; } $ encounterRange = $ this -> getRangeOfRangedWeapon ( $ weaponlikeCode ) ; $ encounterRange += $ this -> getEncounterRangeMalusByStrength ( $ weaponlikeCode , $ currentStrength ) ; $ encounterRange += $ this -> getEncounterRangeBonusByStrength ( $ weaponlikeCode , $ currentStrength ) ; $ encounterRange += $ this -> getEncounterRangeBonusBySpeed ( $ weaponlikeCode , $ currentSpeed ) ; return EncounterRange :: getIt ( $ encounterRange ) ; }
Gives bonus to range of a weapon which can be turned into meters .
44,914
public function getProtectiveArmamentRestrictionForSkillRank ( ProtectiveArmamentCode $ protectiveArmamentCode , PositiveInteger $ protectiveArmamentSkillRank ) : int { $ restriction = $ this -> getRestrictionOfProtectiveArmament ( $ protectiveArmamentCode ) + $ this -> getProtectiveArmamentRestrictionBonusForSkillRank ( $ protectiveArmamentCode , $ protectiveArmamentSkillRank ) ; if ( $ restriction > 0 ) { return 0 ; } return $ restriction ; }
Restriction is Fight number malus .
44,915
public function getBaseOfWoundsUsingWeaponlike ( WeaponlikeCode $ weaponlikeCode , Strength $ currentStrength ) : int { $ baseOfWounds = $ this -> tables -> getBaseOfWoundsTable ( ) -> getBaseOfWounds ( $ this -> getApplicableStrength ( $ weaponlikeCode , $ currentStrength ) , new IntegerObject ( $ this -> getWoundsOfWeaponlike ( $ weaponlikeCode ) ) ) ; $ baseOfWounds += $ this -> getBaseOfWoundsMalusByStrengthWithWeaponlike ( $ weaponlikeCode , $ currentStrength ) ; return $ baseOfWounds ; }
Gives base of wound with a weapon and user strength .
44,916
protected function callQueueMethodOnHandler ( $ class , $ method , $ arguments ) { $ handler = ( new ReflectionClass ( $ class ) ) -> newInstanceWithoutConstructor ( ) ; $ handler -> queue ( $ this -> resolveQueue ( ) , 'Illuminate\Events\CallQueuedHandler@call' , [ 'class' => $ class , 'method' => $ method , 'data' => serialize ( $ arguments ) , ] ) ; }
Call the queue method on the handler class .
44,917
protected function createFirstUser ( ) { $ info = [ 'first_name' => $ this -> askForFirstName ( ) , 'last_name' => $ this -> askForLastName ( ) , 'email' => $ this -> askForEmail ( ) , 'password' => $ this -> askForPassword ( ) , 'created_at' => Carbon :: now ( ) , 'updated_at' => Carbon :: now ( ) , ] ; $ this -> application -> make ( 'Modules\User\Repositories\UserRepository' ) -> createWithRoles ( $ info , $ this -> getAdminRole ( ) ) ; $ this -> command -> info ( 'Admin account created!' ) ; }
Create a first admin user .
44,918
public function getInstallScript ( ) { if ( ! $ this -> installScript ) { $ installClass = $ this -> installNamespace . 'Install' ; if ( ! class_exists ( $ installClass ) ) { $ message = sprintf ( 'No install class found at %s. Nothing to do.' , $ installClass ) ; throw new RuntimeException ( $ message ) ; } $ installScript = new $ installClass ; $ this -> installScript = $ installScript ; } return $ this -> installScript ; }
Get install script
44,919
protected function hasTablesOrViews ( ) { $ tables = $ this -> db -> query ( 'SHOW TABLES' , DbAdapter :: QUERY_MODE_EXECUTE ) ; return ( bool ) count ( $ tables ) ; }
Checks for existing tables in the database
44,920
protected function dropTables ( ) { $ tables = $ this -> db -> query ( 'SHOW FULL TABLES WHERE TABLE_TYPE LIKE "BASE_TABLE"' , DbAdapter :: QUERY_MODE_EXECUTE ) ; $ this -> db -> query ( 'SET FOREIGN_KEY_CHECKS = 0' , DbAdapter :: QUERY_MODE_EXECUTE ) ; foreach ( $ tables as $ table ) { $ this -> db -> query ( 'DROP TABLE ' . reset ( $ table ) , DbAdapter :: QUERY_MODE_EXECUTE ) ; } $ this -> db -> query ( 'SET FOREIGN_KEY_CHECKS = 1' , DbAdapter :: QUERY_MODE_EXECUTE ) ; }
Drop all tables from the database
44,921
protected function dropViews ( ) { $ views = $ this -> db -> query ( 'SHOW FULL TABLES WHERE TABLE_TYPE LIKE "VIEW"' , DbAdapter :: QUERY_MODE_EXECUTE ) ; foreach ( $ views as $ view ) { $ this -> db -> query ( 'DROP VIEW ' . reset ( $ view ) , DbAdapter :: QUERY_MODE_EXECUTE ) ; } }
Drop all views from the database
44,922
protected function install ( AbstractInstall $ installScript , OutputInterface $ output ) { $ dataPath = DATADIR ; $ output -> writeln ( ' Installing App...' ) ; $ this -> runSql ( $ dataPath . DIRECTORY_SEPARATOR . GenerateInstallCommand :: STRUCTURE_FILE , ' Creating initial database schema' , sprintf ( ' Database schema file %s not found' , GenerateInstallCommand :: STRUCTURE_FILE ) , $ output ) ; $ this -> runSql ( $ dataPath . DIRECTORY_SEPARATOR . GenerateInstallCommand :: DATA_FILE , ' Inserting initial data' , sprintf ( ' Database data file %s not found' , GenerateInstallCommand :: DATA_FILE ) , $ output ) ; $ output -> writeln ( ' Running install script' ) ; $ installScript -> execute ( $ this -> db ) ; $ output -> write ( [ ' Install completed!' , '' ] , true ) ; }
Install fresh version of the database from db_structure and db_data files
44,923
protected function runSql ( $ file , $ message , $ notFoundMessage , $ output ) { if ( ! is_file ( $ file ) ) { $ output -> writeln ( $ notFoundMessage ) ; return ; } $ output -> writeln ( $ message ) ; $ dataSql = file_get_contents ( $ file ) ; foreach ( preg_split ( '/;\s*\n/' , $ dataSql ) as $ command ) { try { $ query = $ this -> db -> query ( $ command , DbAdapter :: QUERY_MODE_EXECUTE ) ; } catch ( Database_Exception $ e ) { if ( $ e -> getCode ( ) !== 1065 ) { throw $ e ; } } } }
Given a filepath to a SQL file load it and run the SQL statements inside
44,924
public function percentUsage ( ) { $ total = $ this -> systemTotal ( ) ; $ free = $ this -> systemFree ( ) ; $ usage = [ ] ; foreach ( $ total as $ slotId => $ amount ) { $ usage [ $ slotId ] = intval ( ceil ( ( ( $ amount - $ free [ $ slotId ] ) * 100 ) / $ amount ) ) ; } return $ usage ; }
Percentage of memory used per slot
44,925
public function add ( $ text , $ value ) { $ this -> select [ ] = array ( $ text , $ value ) ; $ this -> validator -> addPossibility ( $ value ) ; }
Adds a value to the list of possiblities
44,926
public static function setPermissions ( Event $ event ) { $ options = array_merge ( array ( self :: PARAM_WRITABLE => array ( ) , self :: PARAM_EXECUTABLE => array ( ) , ) , $ event -> getComposer ( ) -> getPackage ( ) -> getExtra ( ) ) ; foreach ( ( array ) $ options [ self :: PARAM_WRITABLE ] as $ path ) { echo "Setting writable: $path ..." ; if ( is_dir ( $ path ) ) { chmod ( $ path , 0777 ) ; echo "done\n" ; } else { echo "The directory was not found: " . getcwd ( ) . DIRECTORY_SEPARATOR . $ path ; return ; } } foreach ( ( array ) $ options [ self :: PARAM_EXECUTABLE ] as $ path ) { echo "Setting executable: $path ... " ; if ( is_file ( $ path ) ) { chmod ( $ path , 0755 ) ; echo "done\n" ; } else { echo "\n\tThe file was not found: " . getcwd ( ) . DIRECTORY_SEPARATOR . $ path . "\n" ; return ; } } }
Sets the correct permissions of files and directories .
44,927
public function partialFormat ( $ data , $ nodeName = null ) { if ( ! $ nodeName ) { $ nodeName = $ this -> getNodeName ( $ data ) ; } $ data = $ this -> parseData ( $ data ) ; if ( is_scalar ( $ data ) ) { return "<$nodeName>" . $ this -> parseScalarData ( $ data ) . "</$nodeName>" ; } return "<$nodeName>" . $ this -> parseNonScalarData ( $ data , $ nodeName ) . "</$nodeName>" ; }
Format part of the data
44,928
protected function getNodeName ( $ data ) { if ( is_object ( $ data ) ) { $ nodeName = preg_replace ( '/.*\\\/' , '' , get_class ( $ data ) ) ; return preg_replace ( '/\W/' , '' , $ nodeName ) ; } elseif ( is_array ( $ data ) ) { return 'array' ; } return $ this -> defaultNodeName ; }
Try to guess the node name
44,929
protected function parseNonScalarData ( $ data , $ fallbackName = null ) { $ xml = '' ; if ( ! $ fallbackName ) { $ fallbackName = $ this -> defaultNodeName ; } foreach ( $ data as $ property => $ value ) { $ property = preg_replace ( '/\W/' , '' , $ property ) ; if ( is_numeric ( $ property ) ) { $ property = $ fallbackName ; } $ xml .= $ this -> partialFormat ( $ value , $ property ) ; } return $ xml ; }
Recurse through non scalar data serializing it
44,930
protected function registerCommands ( ) { $ this -> add ( new \ Daedalus \ Command \ DumpContainerCommand ( $ this -> kernel -> getContainer ( ) ) ) ; $ this -> add ( new \ Daedalus \ Command \ HelpCommand ( $ this -> kernel -> getContainer ( ) ) ) ; }
Registers the commands that are displayed to the developer
44,931
protected function addOutputFormatterStyles ( OutputInterface $ output ) { foreach ( $ this -> getOutputFormatterStyles ( ) as $ name => $ style ) { $ output -> getFormatter ( ) -> setStyle ( $ name , $ style ) ; } }
Adds extra styles to the output
44,932
public function fake ( $ field , $ type , array $ options = [ ] ) { $ field = $ this -> get ( $ field ) ; $ field -> setFake ( $ type , $ options ) ; return $ this ; }
Fake the contents of a field .
44,933
public function copy ( $ type = null ) { $ builder = new Builder ( $ this -> type , $ this -> dogmatist , $ this -> parent , $ this -> strict ) ; $ this -> copyData ( $ builder ) ; if ( $ type !== null ) { $ builder -> setType ( $ type ) ; } return $ builder ; }
Returns a clone for the current builder
44,934
public static function validate ( string $ key ) : bool { $ le = strlen ( $ key ) ; if ( $ le < static :: VALID_LENGTH_MIN || $ le > static :: VALID_LENGTH_MAX ) { return false ; } if ( $ key { 0 } === '-' ) { return false ; } return ! ! ctype_alnum ( 'A' . str_replace ( static :: VALID_NON_ALPHANUM , '' , $ key ) ) ; }
Checks that length and content is legal .
44,935
private function setDueDate ( Carbon $ dueDate = null ) { if ( is_null ( $ dueDate ) ) { $ dueDate = Carbon :: now ( ) ; } $ this -> dueDate = $ dueDate ; }
Set the due date of the invoice if null set the current date .
44,936
private function setCreatedAt ( Carbon $ createdAt = null ) { if ( is_null ( $ createdAt ) ) { $ createdAt = Carbon :: now ( ) ; } $ this -> createdAt = $ createdAt ; }
Set the creation date of the invoice if null set the current date .
44,937
public function moveUsersToAlternativeGroups ( $ userIdGroupIdMapping ) { $ affectedUsers = 0 ; $ affectedGroups = [ ] ; foreach ( $ userIdGroupIdMapping as $ userId => $ groupId ) { $ affectedUsers += $ this -> UsersGroups -> updateAll ( [ 'group_id' => $ groupId ] , [ 'user_id' => $ userId ] ) ; if ( ! in_array ( $ groupId , $ affectedGroups ) ) { $ affectedGroups [ ] = $ groupId ; } } if ( $ affectedUsers > 0 && ! empty ( $ affectedGroups ) ) { $ this -> updateUserCount ( $ affectedGroups ) ; } return $ affectedUsers ; }
Assign users to new groups .
44,938
public static function addBroadcaster ( BroadcasterInterface $ broadcaster ) { self :: instantiateDefaultBroadcasters ( ) ; self :: $ broadcasters [ $ broadcaster -> getName ( ) ] = $ broadcaster ; }
Add a broadcaster .
44,939
public static function get ( $ name ) { $ name = strtolower ( $ name ) ; if ( ! isset ( self :: $ instantiated [ $ name ] ) ) { throw new InvalidArgumentException ( sprintf ( 'Broadcaster "%s" is not instantiated.' , $ name ) ) ; } return self :: $ instantiated [ $ name ] ; }
Get instantiated broadcaster .
44,940
public static function build ( $ name , array $ configs = array ( ) ) { if ( isset ( self :: $ instantiated [ $ name ] ) ) { return self :: $ instantiated [ $ name ] ; } self :: instantiateDefaultBroadcasters ( ) ; if ( ! isset ( self :: $ broadcasters [ $ name ] ) ) { throw new InvalidArgumentException ( sprintf ( 'Undefined broadcaster with name "%s".' , $ name ) ) ; } self :: $ instantiated [ $ name ] = self :: instantiate ( self :: $ broadcasters [ $ name ] , $ configs ) ; return self :: $ instantiated [ $ name ] ; }
Build a broadcaster .
44,941
private static function instantiate ( $ class , array $ configs ) { $ reflection = new ReflectionClass ( $ class ) ; $ constructor = $ reflection -> getConstructor ( ) ; $ arguments = array ( ) ; foreach ( $ constructor -> getParameters ( ) as $ param ) { $ name = $ param -> getName ( ) ; if ( isset ( $ configs [ $ name ] ) ) { $ arguments [ ] = $ configs [ $ name ] ; continue ; } $ arguments [ ] = null ; } $ broadcaster = $ reflection -> newInstanceArgs ( $ arguments ) ; if ( ! $ broadcaster instanceof BroadcasterInterface ) { throw new RuntimeException ( sprintf ( 'Broadcaster "%s" should implement Borobudur\Broadcasting\Broadcaster\BroadcasterInterface' , $ class ) ) ; } return $ broadcaster ; }
Instantiate broadcaster .
44,942
public function addData ( $ key , $ value ) { if ( isset ( $ this -> data [ $ key ] ) ) { $ this -> data [ $ key ] = array_merge_recursive ( $ this -> data [ $ key ] , $ value ) ; } else { $ this -> setData ( $ key , $ value ) ; } }
Stores the response data in a key - value fashion adding the data to the existing set .
44,943
public function link ( $ content , $ url = [ ] , array $ options = [ ] ) { $ url_helper = $ this -> url ; $ cfg = [ 'href' => is_array ( $ url ) ? ( key_exists ( 'push' , $ url ) ? $ url_helper -> push ( $ url [ 'push' ] ) : ( key_exists ( 'add' , $ url ) || key_exists ( 'remove' , $ url ) ? $ url_helper -> modify ( key_exists ( 'add' , $ url ) ? $ url [ 'add' ] : [ ] , key_exists ( 'remove' , $ url ) ? $ url [ 'remove' ] : [ ] ) : ( key_exists ( 'generate' , $ url ) ? $ url_helper -> build ( $ url , Arr :: trim ( $ url , 'generate' ) ) : ( key_exists ( 'mailto' , $ url ) ? 'mailto:' . $ url [ 'mailto' ] : $ url_helper -> build ( $ url ) ) ) ) ) : ( $ url_helper -> routeExist ( $ url ) ? $ url_helper -> build ( [ ] , $ url ) : $ url ) ] + $ options ; return '<a ' . Str :: htmlserialize ( $ cfg ) . ' >' . $ content . '</a>' ; }
Crea un enlace
44,944
public function js ( $ name = NULL , $ external = FALSE , array $ options = [ ] ) { if ( $ name ) { $ this -> _js [ $ name ] = $ options + [ 'src' => $ external ? $ name : PO_PATH_JS . '/' . $ name ] ; } else { return implode ( PHP_EOL , array_map ( function ( $ value ) { return '<script ' . Str :: htmlserialize ( $ value ) . '></script>' ; } , $ this -> _js ) ) . PHP_EOL ; } }
Agrega un archivo javascript o enlista los agregados
44,945
public function meta ( $ name = NULL , $ content = NULL ) { if ( $ name ) { $ this -> _meta [ $ name ] = [ 'name' => $ name , 'content' => $ content ] ; } else { return implode ( PHP_EOL , array_map ( function ( $ meta ) { return '<meta name="' . $ meta [ 'name' ] . '" content="' . $ meta [ 'content' ] . '" />' ; } , $ this -> _meta ) ) . PHP_EOL ; } }
Agrega una etiqueta META
44,946
public function img ( $ name , array $ options = [ ] , $ external = FALSE ) { $ cfg = $ options + [ 'class' => '' ] ; return '<img src = "' . ( $ external ? $ name : PO_PATH_IMG . '/' . $ name ) . '" ' . Str :: htmlserialize ( $ cfg ) . ' />' ; }
Crea una imagen
44,947
public function nestedList ( array $ list , array $ options = [ ] , array $ item_options = [ ] , $ type_list = 'list' ) { $ type = $ type_list == 'list' ? 'ul' : 'ol' ; $ r = '<' . $ type . ' ' . Str :: htmlserialize ( $ options ) . '>' ; foreach ( $ list as $ key => $ l ) { $ r .= is_array ( $ l ) ? $ this -> nestedList ( $ l , key_exists ( $ key , $ item_options ) ? $ item_options [ $ key ] : [ ] ) : '<li ' . ( key_exists ( $ key , $ item_options ) ? Str :: htmlserialize ( $ item_options [ $ key ] ) : '' ) . ' >' . $ l . '</li>' ; } $ r .= '</' . $ type . '>' ; return $ r ; }
Crea una lista simple u ordenada
44,948
public function get ( $ name ) { if ( isset ( $ this -> factories [ $ name ] ) ) { return $ this -> factories [ $ name ] ; } throw JobFactoryException :: create ( sprintf ( 'Not found %s job factory' , $ name ) ) ; }
Get factory .
44,949
public static function make ( ) { $ services = Provider :: getServices ( ) ; $ config = $ services -> get ( 'Config' ) ; $ strategies = [ ] ; if ( isset ( $ config [ 'error' ] [ 'strategies' ] ) ) { $ strategies = ( array ) $ config [ 'error' ] [ 'strategies' ] ; } $ listener = new ErrorListener ; foreach ( $ strategies as $ name ) { $ strategy = $ services -> get ( $ name ) ; $ listener -> attachErrorStrategy ( $ strategy ) ; } return $ listener ; }
Makes the error listener .
44,950
public function actionEncode ( ) { $ text = Enter :: display ( 'Enter text' ) ; $ encrypted = \ App :: $ domain -> encrypt -> coder -> encode ( $ text ) ; Output :: block ( $ encrypted , 'Encrypted' ) ; }
encryption of data
44,951
public function actionDecode ( ) { $ encrypted = Enter :: display ( 'Enter encrypted' ) ; $ text = \ App :: $ domain -> encrypt -> coder -> decode ( $ encrypted ) ; Output :: block ( $ text , 'Text' ) ; }
decryption of data
44,952
protected static function translator ( ) { if ( static :: $ translator === null ) { $ translator = new Translator ( 'en' ) ; $ translator -> addLoader ( 'array' , new ArrayLoader ( ) ) ; static :: $ translator = $ translator ; static :: setLocale ( 'en' ) ; } return static :: $ translator ; }
Intialize the translator instance if necessary .
44,953
protected function render ( ) { if ( ! isset ( $ this -> items [ 0 ] ) ) { return '' ; } foreach ( $ this -> items as $ itemId => $ item ) { $ item -> setCollapsable ( self :: $ id , self :: $ id . $ itemId , in_array ( $ itemId , $ this -> openedItems ) ) ; } $ this -> setAttribute ( 'id' , self :: $ id ) ; $ this -> addCssClass ( $ this -> itemType . '-group' ) ; return $ this -> html ( '<div' . $ this -> getEltDecorationStr ( ) . '>' ) -> html ( implode ( "\n" , $ this -> items ) ) -> html ( '</div>' ) -> getHtml ( ) ; }
Display the box at the end of configuration
44,954
public static function Ry ( $ theta , array & $ r ) { $ s ; $ c ; $ a00 ; $ a01 ; $ a02 ; $ a20 ; $ a21 ; $ a22 ; $ s = sin ( $ theta ) ; $ c = cos ( $ theta ) ; $ a00 = $ c * $ r [ 0 ] [ 0 ] - $ s * $ r [ 2 ] [ 0 ] ; $ a01 = $ c * $ r [ 0 ] [ 1 ] - $ s * $ r [ 2 ] [ 1 ] ; $ a02 = $ c * $ r [ 0 ] [ 2 ] - $ s * $ r [ 2 ] [ 2 ] ; $ a20 = $ s * $ r [ 0 ] [ 0 ] + $ c * $ r [ 2 ] [ 0 ] ; $ a21 = $ s * $ r [ 0 ] [ 1 ] + $ c * $ r [ 2 ] [ 1 ] ; $ a22 = $ s * $ r [ 0 ] [ 2 ] + $ c * $ r [ 2 ] [ 2 ] ; $ r [ 0 ] [ 0 ] = $ a00 ; $ r [ 0 ] [ 1 ] = $ a01 ; $ r [ 0 ] [ 2 ] = $ a02 ; $ r [ 2 ] [ 0 ] = $ a20 ; $ r [ 2 ] [ 1 ] = $ a21 ; $ r [ 2 ] [ 2 ] = $ a22 ; return ; }
- - - - - - i a u R y - - - - - -
44,955
final public function isActive ( $ active = null ) { if ( isset ( $ active ) ) { $ this -> active = ( bool ) $ active ; return $ this ; } else { return $ this -> active ; } }
Sets or gets active state of element
44,956
public function getCalendarEventFeed ( $ location = null ) { if ( $ location == null ) { $ uri = self :: CALENDAR_EVENT_FEED_URI ; } else if ( $ location instanceof Zend_Gdata_Query ) { $ uri = $ location -> getQueryUrl ( ) ; } else { $ uri = $ location ; } return parent :: getFeed ( $ uri , 'Zend_Gdata_Calendar_EventFeed' ) ; }
Retreive feed object
44,957
public function get ( $ class ) { $ class = ltrim ( $ class , '\\' ) ; if ( ! isset ( $ this -> sharedInstances [ $ class ] ) ) { $ this -> sharedInstances [ $ class ] = $ this -> create ( $ class ) ; } return $ this -> sharedInstances [ $ class ] ; }
Get object from shared instances by class name .
44,958
public function invoke ( $ object , $ method , array $ arguments = [ ] ) { $ reflection = new \ ReflectionClass ( $ object ) ; $ method = $ reflection -> getMethod ( $ method ) ; $ args = $ this -> resolveArguments ( $ method , $ arguments ) ; return $ method -> invokeArgs ( $ object , $ args ) ; }
Invoke method of object .
44,959
protected function resolveArguments ( ReflectionMethod $ method , array $ arguments ) { $ params = $ method -> getParameters ( ) ; $ result = [ ] ; foreach ( $ params as $ param ) { if ( isset ( $ arguments [ $ param -> name ] ) ) { $ result [ $ param -> name ] = $ arguments [ $ param -> name ] ; continue ; } $ class = $ param -> getClass ( ) ; if ( $ class ) { $ className = $ class -> getName ( ) ; if ( $ this -> isShared ( $ className ) ) { $ result [ $ className ] = isset ( $ this -> sharedInstances [ $ className ] ) ? $ this -> sharedInstances [ $ className ] : $ this -> get ( $ className ) ; } else { $ result [ $ className ] = $ this -> create ( $ className ) ; } } } return $ result ; }
Resolve argument of method .
44,960
public function checkVersionConstraintAction ( Request $ request ) { try { $ inputData = new JsonArray ( $ request -> getContent ( ) ) ; } catch ( \ Exception $ exception ) { return new JsonResponse ( [ 'status' => 'ERROR' , 'error' => 'invalid payload' ] , JsonResponse :: HTTP_BAD_REQUEST ) ; } $ versionParser = new VersionParser ( ) ; if ( ! $ inputData -> has ( 'constraint' ) ) { return new JsonResponse ( [ 'status' => 'ERROR' , 'error' => 'invalid payload' ] , JsonResponse :: HTTP_BAD_REQUEST ) ; } try { $ versionParser -> parseConstraints ( $ inputData -> get ( 'constraint' ) ) ; } catch ( \ Exception $ exception ) { return new JsonResponse ( [ 'status' => 'ERROR' , 'error' => $ exception -> getMessage ( ) ] , JsonResponse :: HTTP_OK ) ; } return new JsonResponse ( [ 'status' => 'OK' , ] , JsonResponse :: HTTP_OK ) ; }
Try to validate the version constraint .
44,961
public function set_config ( $ key , $ value = null ) { if ( is_array ( $ key ) ) { $ this -> config = \ Arr :: merge ( $ this -> config , $ key ) ; } else { \ Arr :: set ( $ this -> config , $ key , $ value ) ; } return $ this ; }
Sets a config item
44,962
public function get_parent_themes ( $ theme_name ) { $ return = array ( $ this -> create_theme_array ( $ theme_name ) ) ; $ theme_info = $ this -> load_info ( $ theme_name ) ; if ( ! empty ( $ theme_info [ 'parent' ] ) ) { $ return = array_merge ( $ return , $ this -> get_parent_themes ( $ theme_info [ 'parent' ] ) ) ; } elseif ( $ theme_name !== $ this -> fallback [ 'name' ] ) { $ return [ ] = $ this -> fallback ; } return $ return ; }
Returns parent theme info
44,963
public function asset_url ( $ path ) { $ url = $ this -> asset_path ( $ path ) ; if ( filter_var ( $ url , FILTER_VALIDATE_URL ) === false ) { $ url = \ Uri :: create ( $ url ) ; } return $ url ; }
Returns an absolute URL to asset
44,964
public function loadRoutes ( ) { if ( $ this -> bound ( 'router' ) ) { if ( $ this [ 'config' ] -> get ( 'routes.cache' ) && $ this [ 'files' ] -> exists ( $ this [ 'config' ] -> get ( 'routes.compiled' ) ) ) { $ contents = $ this [ 'files' ] -> get ( $ this [ 'config' ] -> get ( 'routes.compiled' ) ) ; if ( ! empty ( $ contents ) ) { $ this [ 'router' ] -> setRoutes ( unserialize ( base64_decode ( $ contents ) ) ) ; } } else { $ route = $ this [ 'router' ] ; $ response = $ this [ 'response' ] ; if ( $ this [ 'files' ] -> exists ( $ this -> base_path . '/app/Http/routes.php' ) ) { require_once $ this -> base_path . '/app/Http/routes.php' ; } } if ( $ this [ 'config' ] -> get ( 'routes.cache' ) && ! $ this [ 'files' ] -> exists ( $ this [ 'config' ] -> get ( 'routes.compiled' ) ) ) { try { if ( ! $ this [ 'files' ] -> exists ( $ this [ 'config' ] -> get ( 'routes.compiled' ) ) ) { $ allRoutes = $ this [ 'router' ] -> getRoutes ( ) ; if ( count ( $ allRoutes ) > 0 ) { foreach ( $ allRoutes as $ routeObject ) { $ routeObject -> prepareForSerialization ( ) ; } } $ this [ 'files' ] -> put ( $ this [ 'config' ] -> get ( 'routes.compiled' ) , base64_encode ( serialize ( $ allRoutes ) ) ) ; } } catch ( \ Exception $ exception ) { if ( ! empty ( $ exception -> getMessage ( ) ) ) { add_action ( 'admin_notices' , function ( ) use ( $ exception ) { ?> <div class="error notice"> <p>&#9888; <?php echo $ exception -> getMessage ( ) ; ?> </p> <p><em> <? echo 'Route caching cannot serialize closures' ; ?> .</em></p> </div> <?php } ) ; } } } } }
Load Routes into Router
44,965
public function routeRequest ( ) { if ( $ this -> bound ( 'router' ) ) { try { $ pluginRequest = $ this [ 'request' ] ; $ this [ 'router' ] -> matched ( function ( $ event ) { global $ wp_query ; $ wp_query -> is_404 = false ; $ this -> route_dispatched = true ; } ) ; $ response = $ this [ 'router' ] -> dispatch ( $ pluginRequest ) ; if ( $ route = $ pluginRequest -> route ( ) ) { foreach ( $ route -> computedMiddleware as $ middleware ) { $ instance = $ this -> make ( $ middleware ) ; if ( method_exists ( $ instance , 'terminate' ) ) { $ instance -> terminate ( $ pluginRequest , $ response ) ; } } } if ( $ this -> bound ( 'session' ) ) { $ this [ 'session' ] -> save ( ) ; } $ response -> send ( ) ; exit ; } catch ( \ Exception $ e ) { $ this -> reportException ( $ e ) ; $ this -> renderException ( $ pluginRequest , $ e ) ; } catch ( \ Throwable $ e ) { $ this -> reportException ( $ e = new FatalThrowableError ( $ e ) ) ; $ this -> renderException ( $ pluginRequest , $ e ) ; } } }
Try Routing Requests
44,966
public function parse ( \ DOMDocument $ dom ) { $ feed = $ this -> getStandard ( ) -> newFeed ( ) ; $ rootNode = $ this -> getStandard ( ) -> getRootNode ( $ dom ) ; $ this -> parseNodeChildren ( $ rootNode , $ feed ) ; return $ feed ; }
Turn a dom document into a feed object .
44,967
public function parseNodeChildren ( \ DOMNode $ node , NodeInterface $ target ) { $ rules = $ this -> getStandard ( ) -> getRules ( ) ; foreach ( $ node -> childNodes as $ childNode ) { foreach ( $ rules as $ rule ) { if ( $ rule -> canHandle ( $ childNode , $ target ) ) { $ rule -> handle ( $ this , $ childNode , $ target ) ; break ; } } } }
Parse the children of a given node .
44,968
public function getQuery ( $ index = false ) { return ( $ index ) ? array_value ( $ this -> query , $ index ) : $ this -> query ; }
Gets one or all query parameters .
44,969
private function calculateLanguagesPercentage ( $ referers ) { $ total = $ referers -> sum ( 'count' ) ; return $ referers -> transform ( function ( $ item ) use ( $ total ) { return $ item + [ 'percentage' => round ( ( $ item [ 'count' ] / $ total ) * 100 , 2 ) ] ; } ) ; }
Calculate the referers percentage .
44,970
public function select ( $ sql , $ class = "" , $ all = FALSE , $ array = array ( ) ) { $ sth = $ this -> prepare ( $ sql ) ; foreach ( $ array as $ key => $ value ) { $ tipo = ( is_int ( $ value ) ) ? PDO :: PARAM_INT : PDO :: PARAM_STR ; $ sth -> bindValue ( "$key" , $ value , $ tipo ) ; } $ sth -> execute ( ) ; if ( $ sth -> rowCount ( ) <= 0 ) return null ; if ( $ class == "" ) { if ( $ all == false and $ sth -> rowCount ( ) == 1 ) { $ array = $ sth -> fetchAll ( PDO :: FETCH_OBJ ) ; return array_shift ( $ array ) ; } return $ sth -> fetchAll ( PDO :: FETCH_OBJ ) ; } else { if ( $ all == false and $ sth -> rowCount ( ) == 1 ) { $ array = $ sth -> fetchAll ( PDO :: FETCH_CLASS , $ this -> getClass ( $ class ) ) ; return array_shift ( $ array ) ; } return $ sth -> fetchAll ( PDO :: FETCH_CLASS , $ this -> getClass ( $ class ) ) ; } }
Executa um select no banco
44,971
public function ExecuteInsert ( $ table , $ data ) { if ( is_object ( $ data ) ) ModelState :: ModelTreatment ( $ data ) ; $ data = ( array ) $ data ; ksort ( $ data ) ; $ camposNomes = implode ( '`, `' , array_keys ( $ data ) ) ; $ camposValores = ':' . implode ( ', :' , array_keys ( $ data ) ) ; $ sth = $ this -> prepare ( "INSERT INTO $table (`$camposNomes`) VALUES ($camposValores)" ) ; foreach ( $ data as $ key => $ value ) { $ tipo = ( is_int ( $ value ) ) ? PDO :: PARAM_INT : PDO :: PARAM_STR ; $ sth -> bindValue ( ":$key" , $ value , $ tipo ) ; } $ sth -> execute ( ) ; return $ this -> lastInsertId ( ) ; }
Executa um INSERT no banco
44,972
public function ExecuteUpdate ( $ table , $ data , $ where ) { if ( is_object ( $ data ) ) ModelState :: ModelTreatment ( $ data ) ; $ data = ( array ) $ data ; ksort ( $ data ) ; $ novosDados = NULL ; foreach ( $ data as $ key => $ value ) { $ novosDados .= "`$key`=:$key," ; } $ novosDados = rtrim ( $ novosDados , ',' ) ; $ sth = $ this -> prepare ( "UPDATE $table SET $novosDados WHERE $where" ) ; foreach ( $ data as $ key => $ value ) { $ tipo = ( is_int ( $ value ) ) ? PDO :: PARAM_INT : PDO :: PARAM_STR ; $ sth -> bindValue ( ":$key" , $ value , $ tipo ) ; } return $ sth -> execute ( ) ; }
Executa com UPDATE no banco
44,973
public static function _success ( $ objects , $ echoResponse = TRUE , $ format = 'json' ) { return self :: _doResponse ( 'success' , $ objects , $ echoResponse , $ format ) ; }
Create a service response of success
44,974
public static function _failure ( $ objects , $ echoResponse = TRUE , $ format = 'json' ) { return self :: _doResponse ( 'failure' , $ objects , $ echoResponse , $ format ) ; }
Create a service response of failure
44,975
private static function _doResponse ( $ type , $ objects , $ echoResponse , $ format ) { $ ret = array ( ) ; $ ret [ 'status' ] = $ type ; if ( is_array ( $ objects ) ) { foreach ( $ objects as $ k => $ v ) { $ ret [ $ k ] = $ v ; } } else { $ ret [ ] = $ objects ; } switch ( $ format ) { case 'xml' : require_once 'XML/Serializer.php' ; $ options = array ( "indent" => " " , "linebreak" => "\n" , "typeHints" => false , "addDecl" => true , "encoding" => "UTF-8" , "rootName" => "data" , "defaultTagName" => "item" , "attributesArray" => "_attributes" ) ; $ serializer = new \ XML_Serializer ( $ options ) ; $ rc = $ serializer -> serialize ( $ ret ) ; if ( $ rc !== TRUE ) { } $ ret = $ serializer -> getSerializedData ( ) ; break ; case 'json' : default : $ ret = json_encode ( $ ret ) ; break ; } if ( $ echoResponse ) { echo $ ret ; } return $ ret ; }
Builds the response
44,976
private function loadFile ( $ file ) { if ( ! isset ( $ this -> files [ $ file ] ) ) { $ filename = $ this -> folder . $ file . '.php' ; if ( file_exists ( $ filename ) ) { $ this -> files [ $ file ] = include ( $ filename ) ; } if ( isset ( $ this -> environment ) ) { $ filename = $ this -> folder . $ this -> environment . '/' . $ file . '.php' ; if ( file_exists ( $ filename ) ) { $ this -> merge ( $ file , include ( $ filename ) ) ; } } } }
Load a file in case it s not loaded yet .
44,977
private function getValue ( $ name , $ default ) { $ parts = explode ( '.' , $ name ) ; $ file = array_shift ( $ parts ) ; $ this -> loadFile ( $ file ) ; if ( ! isset ( $ this -> files [ $ file ] ) ) { return $ default ; } else { $ out = $ this -> files [ $ file ] ; foreach ( $ parts as $ part ) { if ( ! isset ( $ out [ $ part ] ) ) { return $ default ; } else { $ out = $ out [ $ part ] ; } } } return $ out ; }
Find a config variable and return it .
44,978
public function expandDirectories ( $ baseDir ) { $ directories = array ( ) ; foreach ( scandir ( $ baseDir ) as $ file ) { if ( $ file == '.' || $ file == '..' ) continue ; $ dir = $ baseDir . DS . $ file ; if ( is_dir ( $ dir ) ) { $ directories [ ] = $ dir ; $ directories = array_merge ( $ directories , $ this -> expandDirectories ( $ dir ) ) ; } } return $ directories ; }
Recursive function that returns all directories inside a base directory .
44,979
public function register ( Application $ app ) { $ this -> config = $ app [ 'config' ] -> load ( 'log' ) ; $ handlers = $ this -> getHandlers ( $ app ) ; $ app [ 'log' ] = $ app -> share ( function ( $ app ) use ( $ handlers ) { return new Logger ( 'main' , $ handlers ) ; } ) ; $ app -> initializer ( 'Synapse\\Log\\LoggerAwareInterface' , function ( $ object , $ app ) { $ object -> setLogger ( $ app [ 'log' ] ) ; return $ object ; } ) ; }
Register logging related services
44,980
public function boot ( Application $ app ) { $ monologErrorHandler = new MonologErrorHandler ( $ app [ 'log' ] ) ; $ monologErrorHandler -> registerErrorHandler ( ) ; $ monologErrorHandler -> registerFatalHandler ( ) ; }
Perform extra chores on boot
44,981
protected function getHandlers ( Application $ app ) { $ handlers = [ ] ; $ file = Arr :: path ( $ this -> config , 'file.path' ) ; if ( $ file ) { $ handlers [ ] = $ this -> getFileHandler ( $ file ) ; $ handlers [ ] = $ this -> getFileExceptionHandler ( $ file ) ; } $ enableLoggly = Arr :: path ( $ this -> config , 'loggly.enable' ) ; if ( $ enableLoggly ) { $ handlers [ ] = $ this -> getLogglyHandler ( ) ; } $ enableRollbar = Arr :: path ( $ this -> config , 'rollbar.enable' ) ; if ( $ enableRollbar ) { $ handlers [ ] = $ this -> getRollbarHandler ( $ app [ 'environment' ] ) ; } $ syslogIdent = Arr :: path ( $ this -> config , 'syslog.ident' ) ; if ( $ syslogIdent ) { $ handlers [ ] = $ this -> getSyslogHandler ( $ syslogIdent ) ; } return $ handlers ; }
Get an array of logging handlers to use
44,982
protected function getFileHandler ( $ file ) { $ format = '[%datetime%] %channel%.%level_name%: %message% %context% %extra%' . PHP_EOL ; $ handler = new StreamHandler ( $ file , Logger :: INFO ) ; $ handler -> setFormatter ( new LineFormatter ( $ format ) ) ; return new DummyExceptionHandler ( $ handler ) ; }
Log handler for files
44,983
protected function getFileExceptionHandler ( $ file ) { $ format = '%context.stacktrace%' . PHP_EOL ; $ handler = new StreamHandler ( $ file , Logger :: ERROR ) ; $ handler -> setFormatter ( new ExceptionLineFormatter ( $ format ) ) ; return $ handler ; }
Exception log handler for files
44,984
protected function getLogglyHandler ( ) { $ token = Arr :: path ( $ this -> config , 'loggly.token' ) ; if ( ! $ token ) { throw new ConfigException ( 'Loggly is enabled but the token is not set.' ) ; } return new LogglyHandler ( $ token , Logger :: INFO ) ; }
Log handler for Loggly
44,985
protected function getRollbarHandler ( $ environment ) { $ rollbarConfig = Arr :: get ( $ this -> config , 'rollbar' , [ ] ) ; return new RollbarHandler ( $ rollbarConfig , $ environment ) ; }
Register log handler for Rollbar
44,986
public function findRootOf ( $ id ) { return $ this -> findOne ( array ( 'id' => $ this -> sql ( ) -> select ( ) -> columns ( array ( 'rootId' ) ) -> where ( array ( 'id' => $ id , ) ) , ) ) ; }
Find root paragraph of paragraph by id
44,987
private function getTagIdByName ( $ tag ) { $ tagSql = $ this -> sql ( $ this -> getTableInSchema ( static :: $ tagTableName ) ) ; $ select = $ tagSql -> select ( ) -> columns ( array ( 'id' ) ) -> where ( array ( new TypedParameters ( 'LOWER(?) = ?' , array ( 'name' , mb_strtolower ( $ tag , 'UTF-8' ) , ) , array ( TypedParameters :: TYPE_IDENTIFIER , TypedParameters :: TYPE_VALUE , ) ) , ) ) ; $ result = $ tagSql -> prepareStatementForSqlObject ( $ select ) -> execute ( ) ; foreach ( $ result as $ row ) { return $ row [ 'id' ] ; } return null ; }
Get tag id by its name
44,988
protected function setTagFor ( $ paragraphId , $ tag ) { $ rows = 0 ; $ tagSql = $ this -> sql ( $ this -> getTableInSchema ( static :: $ tagTableName ) ) ; $ tagJoinSql = $ this -> sql ( $ this -> getTableInSchema ( static :: $ tagJoinTableName ) ) ; $ tagId = $ this -> getTagIdByName ( $ tag ) ; if ( empty ( $ tagId ) ) { $ insert = $ tagSql -> insert ( ) -> values ( array ( 'locale' => $ this -> getLocale ( ) , 'name' => $ tag , ) ) ; $ rows += $ tagSql -> prepareStatementForSqlObject ( $ insert ) -> execute ( ) -> getAffectedRows ( ) ; $ tagId = $ this -> getTagIdByName ( $ tag ) ; } $ data = array ( 'paragraphId' => $ paragraphId , 'tagId' => $ tagId , ) ; $ select = $ tagJoinSql -> select ( ) -> where ( $ data ) ; if ( ! $ tagJoinSql -> prepareStatementForSqlObject ( $ select ) -> execute ( ) -> getAffectedRows ( ) ) { $ insert = $ tagJoinSql -> insert ( ) -> values ( $ data ) ; $ rows += $ tagJoinSql -> prepareStatementForSqlObject ( $ insert ) -> execute ( ) -> getAffectedRows ( ) ; } return $ rows ; }
Set a tag for a paragraph
44,989
public function saveRawProperties ( $ id , $ properties ) { $ result = 0 ; if ( ! empty ( $ properties ) ) { foreach ( $ properties as $ property ) { $ result += $ this -> saveProperty ( $ id , empty ( $ property [ 'locale' ] ) ? null : $ property [ 'locale' ] , empty ( $ property [ 'name' ] ) ? null : $ property [ 'name' ] , empty ( $ property [ 'value' ] ) ? null : $ property [ 'value' ] ) ; } } return $ result ; }
Save raw paragraph properties
44,990
public function saveRawData ( array $ data ) { if ( ! parent :: save ( $ data ) ) { return null ; } return isset ( $ data [ 'id' ] ) ? $ data [ 'id' ] : null ; }
Save paragraph form raw data
44,991
protected function chooseView ( ) { if ( $ this -> guestView ) { if ( Yii :: $ app -> user -> isGuest ) { $ this -> controller -> layout = $ this -> guestLayout ; $ this -> view = $ this -> guestView ; } } if ( $ this -> userView ) { if ( ! Yii :: $ app -> user -> isGuest ) { $ this -> controller -> layout = $ this -> userLayout ; $ this -> view = $ this -> userView ; } } }
select view template of error view by different group
44,992
public function installViaSubtree ( ) { return new Process ( sprintf ( 'cd %s && git remote add %s %s && git subtree add --prefix=%s --squash %s %s' , base_path ( ) , $ this -> getComponentName ( ) , $ this -> getRepoUrl ( ) , $ this -> getDestinationPath ( ) , $ this -> getComponentName ( ) , $ this -> getBranch ( ) ) ) ; }
Install the component via git subtree .
44,993
public function retrieve ( $ key ) { $ value = $ this -> redis -> get ( $ key ) ; if ( $ value === false ) return null ; return $ value ; }
Retrieve value from redis server
44,994
public function values ( array $ valuesArray ) { $ this -> _checkColumnsArrayIsset ( ) -> _checkArraysForSameLength ( $ valuesArray ) -> _checkValuesArrayType ( $ valuesArray ) ; $ this -> values [ ] = $ valuesArray ; return $ this ; }
Validate the passed array and add their values to the insert statement . The columns method must called before otherwise an exception will thrown .
44,995
public final function setUrl ( $ url ) { if ( is_string ( $ url ) ) { $ this -> _url = new ehough_curly_Url ( $ url ) ; return ; } if ( ! $ url instanceof ehough_curly_Url ) { throw new ehough_shortstop_api_exception_InvalidArgumentException ( 'setUrl() only takes a string or a ehough_curly_Url instance' ) ; } $ this -> _url = $ url ; }
Sets the URL of this request .
44,996
protected function getErrFunc ( ) { if ( null === $ this -> errFunc ) { $ this -> errFunc = function ( $ errno , $ errstr , $ errfile , $ errline ) { $ this -> stopErrorHandling ( ) ; throw new \ ErrorException ( $ errstr , 0 , $ errno , $ errfile , $ errline ) ; } ; } return $ this -> errFunc ; }
Get the error handler
44,997
public function mapper ( $ entityName ) { if ( ! class_exists ( $ entityName ) ) { throw new \ Exception ( 'Unable to get mapper for unknown entity class ' . $ entityName ) ; } $ locator = $ this [ 'spot2.locator' ] ; return $ locator -> mapper ( $ entityName ) ; }
Get a mapper for a given entity .
44,998
public function indexAction ( $ page , $ sort , $ direction ) { $ acl = $ this -> get ( 'bacon_acl.service.authorization' ) ; if ( ! $ acl -> authorize ( 'module' , 'INDEX' ) ) { throw $ this -> createAccessDeniedException ( ) ; } $ breadcumbs = $ this -> container -> get ( 'bacon_breadcrumbs' ) ; $ breadcumbs -> addItem ( [ 'title' => 'Module' , 'route' => '' , ] ) ; $ breadcumbs -> addItem ( [ 'title' => 'List' , 'route' => '' , ] ) ; $ entity = new Module ( ) ; if ( $ this -> get ( 'session' ) -> has ( 'module_search_session' ) ) { $ objSerialize = $ this -> get ( 'session' ) -> get ( 'module_search_session' ) ; $ entity = unserialize ( $ objSerialize ) ; } $ query = $ this -> getDoctrine ( ) -> getRepository ( 'BaconAclBundle:Module' ) -> getQueryPagination ( $ entity , $ sort , $ direction ) ; $ paginator = $ this -> getPagination ( $ query , $ page , Module :: PER_PAGE ) ; $ paginator -> setUsedRoute ( 'module_pagination' ) ; $ form = $ this -> createForm ( ModuleFormType :: class , $ entity , [ 'search' => true , ] ) ; return [ 'pagination' => $ paginator , 'form_search' => $ form -> createView ( ) , 'form_delete' => $ this -> createDeleteForm ( ) -> createView ( ) , ] ; }
Lists all Module entities .
44,999
public function newAction ( Request $ request ) { $ acl = $ this -> get ( 'bacon_acl.service.authorization' ) ; if ( ! $ acl -> authorize ( 'module' , 'NEW' ) ) { throw $ this -> createAccessDeniedException ( ) ; } $ breadcumbs = $ this -> container -> get ( 'bacon_breadcrumbs' ) ; $ breadcumbs -> addItem ( [ 'title' => 'Module' , 'route' => 'module' , ] ) ; $ breadcumbs -> addItem ( [ 'title' => 'New' , 'route' => '' , ] ) ; $ form = $ this -> createForm ( ModuleFormType :: class , new Module ( ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) ) { $ handler = new ModuleFormHandler ( $ form , $ this -> getDoctrine ( ) -> getManager ( ) , $ this -> get ( 'session' ) -> getFlashBag ( ) ) ; if ( $ handler -> save ( ) ) { return $ this -> redirect ( $ this -> generateUrl ( 'module' ) ) ; } } return [ 'form' => $ form -> createView ( ) , ] ; }
Displays a form to create a new Module entity .