idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
27,300
public function getImageSizeInBox ( array $ imageSize , array $ boxSize ) { list ( $ imageWidth , $ imageHeight ) = $ imageSize ; list ( $ boxWidth , $ boxHeight ) = $ boxSize ; if ( ( $ imageWidth <= $ boxWidth ) && ( $ imageHeight <= $ boxHeight ) ) { return $ imageSize ; } $ resizeRatio = min ( $ boxWidth / $ imageWidth , $ boxHeight / $ imageHeight ) ; $ imageWidth = ceil ( $ imageWidth * $ resizeRatio ) ; if ( $ imageWidth > $ boxWidth ) { $ imageWidth = $ boxWidth ; } $ imageHeight = ceil ( $ imageHeight * $ resizeRatio ) ; if ( $ imageHeight > $ boxHeight ) { $ imageHeight = $ boxHeight ; } return array ( $ imageWidth , $ imageHeight ) ; }
Get image size in box .
27,301
public function subtract ( Money $ other ) { $ other = $ other -> convertToCurrency ( $ this -> currency ) ; $ this -> assertSameCurrency ( $ this , $ other ) ; $ value = $ this -> amount - $ other -> getAmount ( ) ; $ this -> assertIsFloat ( $ value ) ; return $ this -> newMoney ( $ value ) ; }
Returns a new Money object that represents the monetary value of the difference of this Money object and another .
27,302
public function multiply ( $ factor , $ roundingMode = PHP_ROUND_HALF_UP ) { if ( ! in_array ( $ roundingMode , self :: $ roundingModes ) ) { throw new InvalidArgumentException ( '$roundingMode ' . \ Yii :: t ( 'skeeks/money' , 'must be a valid rounding mode' ) . ' (PHP_ROUND_*)' ) ; } return $ this -> newMoney ( $ this -> castToFloat ( round ( $ factor * $ this -> amount , 0 , $ roundingMode ) ) ) ; }
Returns a new Money object that represents the monetary value of this Money object multiplied by a given factor .
27,303
public function allocateToTargets ( $ n ) { if ( is_int ( $ n ) ) { $ n = ( float ) $ n ; } if ( ! is_float ( $ n ) ) { throw new InvalidArgumentException ( '$n ' . \ Yii :: t ( 'skeeks/money' , 'must be an integer' ) ) ; } $ low = $ this -> newMoney ( floatval ( $ this -> amount / $ n ) ) ; $ high = $ this -> newMoney ( $ low -> getAmount ( ) + 1 ) ; $ remainder = $ this -> amount % $ n ; $ result = array ( ) ; for ( $ i = 0 ; $ i < $ remainder ; $ i ++ ) { $ result [ ] = $ high ; } for ( $ i = $ remainder ; $ i < $ n ; $ i ++ ) { $ result [ ] = $ low ; } return $ result ; }
Allocate the monetary value represented by this Money object among N targets .
27,304
public function allocateByRatios ( array $ ratios ) { $ result = array ( ) ; $ total = array_sum ( $ ratios ) ; $ remainder = $ this -> amount ; for ( $ i = 0 ; $ i < count ( $ ratios ) ; $ i ++ ) { $ amount = $ this -> castToFloat ( $ this -> amount * $ ratios [ $ i ] / $ total ) ; $ result [ ] = $ this -> newMoney ( $ amount ) ; $ remainder -= $ amount ; } for ( $ i = 0 ; $ i < $ remainder ; $ i ++ ) { $ result [ $ i ] = $ this -> newMoney ( $ result [ $ i ] -> getAmount ( ) + 1 ) ; } return $ result ; }
Allocate the monetary value represented by this Money object using a list of ratios .
27,305
public function compareTo ( Money $ other ) { $ other = $ other -> convertToCurrency ( $ this -> currency ) ; $ this -> assertSameCurrency ( $ this , $ other ) ; if ( $ this -> amount == $ other -> getAmount ( ) ) { return 0 ; } return $ this -> amount < $ other -> getAmount ( ) ? - 1 : 1 ; }
Compares this Money object to another .
27,306
public function validate ( $ field , $ model ) { return $ this -> _validate ( $ this -> getValue ( $ model , $ field ) , $ field , $ model ) ; }
Validate given field and model against this Validator
27,307
protected function getEndpointClassName ( string $ name ) : string { $ className = sprintf ( '%s\\%s' , str_replace ( 'Section' , 'Endpoint' , get_class ( $ this ) ) , ucfirst ( $ name ) ) ; if ( ! class_exists ( $ className ) ) { throw new \ RuntimeException ( sprintf ( 'Invalid endpoint name "%s" (%s)' , $ name , $ className ) ) ; } return $ className ; }
Return the Endpoint Class Name .
27,308
protected function createEndpoint ( string $ name , array $ args ) : EndpointInterface { $ className = $ this -> getEndpointClassName ( $ name ) ; $ args [ ] = $ this -> authentication ; $ args [ ] = $ this -> client ; $ args [ ] = $ this -> throwsExceptions ; $ args [ ] = $ this -> baseUrl ; return new $ className ( ... $ args ) ; }
Return an endpoint instance properly initialized .
27,309
protected function getSectionClassName ( string $ name ) : string { $ className = sprintf ( '%s\\%s' , get_class ( $ this ) , ucfirst ( $ name ) ) ; if ( ! class_exists ( $ className ) ) { throw new \ RuntimeException ( sprintf ( 'Invalid section name "%s" (%s)' , $ name , $ className ) ) ; } return $ className ; }
Returns the Section Class Name .
27,310
protected function createSection ( string $ name , array $ args ) : SectionInterface { $ className = $ this -> getSectionClassName ( $ name ) ; $ args [ ] = $ this -> authentication ; $ args [ ] = $ this -> client ; $ args [ ] = $ this -> throwsExceptions ; $ args [ ] = $ this -> baseUrl ; return new $ className ( ... $ args ) ; }
Return a section instance properly initialized .
27,311
public function getConfiguration ( $ filename ) { $ cacheManager = new CacheManager ( ) ; $ configuration = $ cacheManager -> retrieveFromCache ( '/' . $ filename ) ; if ( ! is_array ( $ configuration ) ) { return null ; } $ config = new Config ( $ configuration ) ; $ cacheManager = null ; return $ config ; }
getConfiguration - loads the configuration
27,312
public function saveConfiguration ( $ filename , Config $ config ) { $ this -> workingPath = $ this -> parseFilepath ( $ filename ) ; $ cacheManager = new CacheManager ( ) ; $ cacheManager -> saveToCache ( '/' . $ filename , $ config -> toDetailsArray ( ) ) ; }
saveConfiguration - serializes a configuration
27,313
public static function random ( $ array , $ number = null ) { $ requested = \ is_null ( $ number ) ? 1 : $ number ; $ count = \ count ( $ array ) ; if ( $ requested > $ count ) { throw new InvalidArgumentException ( "You requested {$requested} items, but there are only {$count} items available." ) ; } if ( \ is_null ( $ number ) ) { return $ array [ array_rand ( $ array ) ] ; } if ( ( int ) $ number === 0 ) { return [ ] ; } $ keys = array_rand ( $ array , $ number ) ; $ results = [ ] ; foreach ( ( array ) $ keys as $ key ) { $ results [ ] = $ array [ $ key ] ; } return $ results ; }
Get one or a specified number of random values from an array .
27,314
public function notEmpty ( $ value , bool $ asString = true ) : bool { if ( $ asString && is_string ( $ value ) && strlen ( trim ( $ value ) ) == 0 ) { return false ; } return ! empty ( $ value ) ; }
Value should not be empty .
27,315
public function uploadFiles ( Request $ request , Model $ model , $ relativePath = null ) { if ( ! $ relativePath ) { $ relativePath = $ this -> getDefaultRelativePath ( ) ; } $ fileBag = $ request -> files ; foreach ( $ fileBag -> all ( ) as $ paramName => $ uploadedFiles ) { $ attributes = $ model -> getAttributes ( ) ; if ( array_key_exists ( $ paramName , $ attributes ) ) { $ this -> handleNonMultipleFileUploads ( $ model , $ paramName , $ uploadedFiles , $ relativePath ) ; } else { $ this -> handleMultipleFileUploads ( $ request , $ model , $ paramName , $ uploadedFiles , $ relativePath ) ; } } return $ request ; }
Upload request files and update or create relations handling array type request data .
27,316
protected function getFilename ( UploadedFile $ uploadedFile ) { $ extension = $ uploadedFile -> guessExtension ( ) ; $ filename = str_random ( ) . '.' . $ extension ; return $ filename ; }
Get the name of the file .
27,317
protected function handleMultipleFileUploads ( Request $ request , Model $ model , $ paramName , $ uploadedFiles , $ relativePath ) { $ this -> _checkFileRelationExists ( $ model , $ paramName ) ; $ data = $ request -> attributes -> all ( ) ; $ fileBag = $ request -> files ; foreach ( $ uploadedFiles as $ index => $ uploadedFile ) { if ( ! $ uploadedFile -> isValid ( ) ) { throw new UploadException ( $ uploadedFile -> getError ( ) ) ; } $ filename = $ this -> getFilename ( $ uploadedFile ) ; $ storagePath = $ this -> getStoragePath ( $ relativePath ) ; $ this -> moveUploadedFile ( $ uploadedFile , $ filename , $ storagePath ) ; $ location = $ relativePath . $ filename ; if ( count ( $ fileBag -> get ( $ paramName ) ) > 1 ) { $ data [ $ paramName ] [ $ index ] = [ $ this -> getLocationColumn ( ) => $ location ] ; } else { $ data [ $ paramName ] [ $ this -> getLocationColumn ( ) ] = $ location ; } $ request -> merge ( $ data ) ; } }
Handle multiple file uploads .
27,318
protected function handleNonMultipleFileUploads ( Model $ model , $ paramName , $ uploadedFile , $ relativePath ) { if ( ! $ uploadedFile -> isValid ( ) ) { throw new UploadException ( $ uploadedFile -> getError ( ) ) ; } $ filename = $ this -> getFilename ( $ uploadedFile ) ; $ destination = $ this -> getStoragePath ( $ relativePath ) ; $ this -> moveUploadedFile ( $ uploadedFile , $ filename , $ destination ) ; $ location = $ relativePath . $ filename ; $ model -> { $ paramName } = $ location ; $ model -> save ( ) ; }
Handle non - multiple file uploads .
27,319
private function _checkFileRelationExists ( Model $ model , $ relationName ) { if ( ( ! method_exists ( $ model , $ relationName ) && ! $ model -> { $ relationName } ( ) instanceof Relation ) ) { if ( Lang :: has ( 'resource-controller.filerelationinexistent' ) ) { $ message = trans ( 'resource-controller.filerelationinexistent' , [ 'relationName' => $ relationName ] ) ; } else { $ message = "Request file '{$relationName}' is not named after an existent relation." ; } throw new UploadException ( $ message ) ; } }
Throw an exception if request file is not named after an existent relation .
27,320
public function execute ( ) { if ( ! is_string ( $ this -> master_hostname ) || empty ( $ this -> master_hostname ) ) { throw new UnexpectedValueException ( 'Cannot execute CHANGE MASTER without a valid master hostname.' ) ; } if ( ! is_string ( $ this -> replication_username ) || empty ( $ this -> replication_username ) ) { throw new UnexpectedValueException ( 'Cannot execute CHANGE MASTER without a valid replication username.' ) ; } if ( ! is_string ( $ this -> replication_password ) || empty ( $ this -> replication_password ) ) { throw new UnexpectedValueException ( 'Cannot execute CHANGE MASTER without a valid replication password.' ) ; } if ( ! is_string ( $ this -> recorded_log_file_name ) ) { throw new UnexpectedValueException ( 'Cannot execute CHANGE MASTER without a valid log file name (empty is acceptable).' ) ; } if ( ! is_int ( $ this -> recorded_log_pos ) ) { throw new UnexpectedValueException ( 'Cannot execute CHANGE MASTER without a valid log file position.' ) ; } if ( $ this -> recorded_log_file_name == self :: EMPTY_LOG_FILENAME && $ this -> recorded_log_pos != self :: EMPTY_LOG_POSITION ) { throw new UnexpectedValueException ( sprintf ( 'The value of the log position must be equal to %d when the log file name is given as "%s".' , self :: EMPTY_LOG_POSITION , self :: EMPTY_LOG_FILENAME ) ) ; } if ( $ this -> recorded_log_file_name != self :: EMPTY_LOG_FILENAME && $ this -> recorded_log_pos <= self :: EMPTY_LOG_POSITION ) { throw new UnexpectedValueException ( sprintf ( 'The value of the log position must be greater than %d when the log file name is given something other than "%s".' , self :: EMPTY_LOG_POSITION , self :: EMPTY_LOG_FILENAME ) ) ; } $ statement = implode ( ', ' , array ( 'CHANGE MASTER TO MASTER_HOST=:master_hostname' , 'MASTER_USER=:replication_username' , 'MASTER_PASSWORD=:replication_password' , 'MASTER_LOG_FILE=:recorded_log_file_name' , 'MASTER_LOG_POS=:recorded_log_pos' , ) ) . ';' ; $ params = array ( ':master_hostname' => $ this -> master_hostname , ':replication_username' => $ this -> replication_username , ':replication_password' => $ this -> replication_password , ':recorded_log_file_name' => $ this -> recorded_log_file_name , ':recorded_log_pos' => array ( $ this -> recorded_log_pos , $ this -> client -> typeInt ( ) ) , ) ; return $ this -> client -> execute ( $ statement , $ params ) ; }
Execute the CHANGE MASTER MySQL query .
27,321
public function toActionCaller ( ) { $ actionCaller = new ActionCaller ( ) ; $ action = $ this -> getAction ( ) ; if ( $ action instanceof Closure ) { $ actionCaller -> byClosure ( $ action ) ; } else if ( is_callable ( $ action ) ) { $ actionCaller -> byCallable ( $ action ) ; } else { } return $ actionCaller ; }
rule convert to action caller
27,322
public function getMessageByCode ( $ code , array $ data = NULL , $ customMessage = NULL ) { if ( ! empty ( $ customMessage ) && \ strlen ( $ customMessage ) > 0 ) { return \ vsprintf ( $ customMessage , $ data ) ; } if ( ! \ array_key_exists ( $ code , $ this -> messages ) ) { return $ this -> messages [ self :: GENERIC ] ; } if ( \ is_array ( $ data ) ) { return \ vsprintf ( $ this -> messages [ $ code ] , $ data ) ; } return $ this -> messages [ $ code ] ; }
Returns a textual error message for an error code
27,323
protected function resetMessageTypes ( ) { foreach ( array_keys ( $ this -> config ( 'types' ) ) as $ type ) { $ _SESSION [ $ this -> alias ] [ $ type ] = [ ] ; } }
Clear all the messages but keep an empty array in the session
27,324
public function success ( $ message , $ dismissable = true , $ title = null ) { return $ this -> make ( $ message , $ title , $ dismissable , __FUNCTION__ ) ; }
Flash a success message
27,325
protected function getTitle ( $ type ) { return array_key_exists ( $ type , $ this -> config ( 'titles' ) ) ? $ this -> config ( 'titles' ) [ $ type ] : null ; }
Get the message title for the given type
27,326
protected function make ( $ message , $ title , $ dismissable , $ type ) { if ( ! $ this -> isValidType ( $ type ) ) { return false ; } if ( is_null ( $ title ) && $ this -> config ( 'withTitles' ) === true ) { $ title = $ this -> getTitle ( $ type ) ; } $ message = str_replace ( '{counter}' , count ( @ $ _SESSION [ $ this -> alias ] [ $ type ] ) + 1 , $ message ) ; $ this -> addMessageToSession ( $ message , $ title , $ dismissable , $ type ) ; return $ this ; }
Create the message and store it in the session
27,327
protected function addMessageToSession ( $ message , $ title , $ dismissable , $ type ) { $ _SESSION [ $ this -> alias ] [ $ type ] [ ] = compact ( 'message' , 'title' , 'dismissable' , 'type' ) ; return $ this ; }
Push the message to the session
27,328
public function config ( $ key , $ default = null ) { if ( is_array ( $ key ) ) { return $ this -> config = array_merge ( $ this -> config , $ key ) ; } return array_key_exists ( $ key , $ this -> config ) ? $ this -> config [ $ key ] : $ default ; }
Get or set configuration values
27,329
public function hasMessages ( $ type ) { return isset ( $ _SESSION [ $ alias = $ this -> alias ] [ $ type ] ) && count ( $ _SESSION [ $ alias ] [ $ type ] ) > 0 ; }
Indicate whether there is messages stored on the given type
27,330
public function getMessages ( $ type ) { return $ this -> hasMessages ( $ type ) ? $ _SESSION [ $ this -> alias ] [ $ type ] : null ; }
Get messages from the given type
27,331
public function display ( $ types = null , $ return = false ) { $ html = null ; $ types = $ types ? : array_keys ( $ this -> config ( 'types' ) ) ; foreach ( ( array ) $ types as $ type ) { if ( ! $ this -> isValidType ( $ type ) || ( $ messages = $ this -> getMessages ( $ type ) ) === null ) { continue ; } foreach ( $ messages as $ message ) { $ html .= $ this -> formatMessage ( $ message , $ type ) ; } $ this -> clear ( $ type ) ; } $ html = sprintf ( $ this -> config ( 'container' ) , $ html ) ; if ( $ return ) { return $ html ; } echo $ html ; }
Display the messages
27,332
protected function formatMessage ( array $ data , $ type ) { $ shouldBeSticky = $ this -> config ( 'sticky' ) === true || $ data [ 'dismissable' ] !== true ; $ templateData = [ '{message.baseClass}' => $ this -> config ( 'baseClass' ) , '{message.class}' => $ this -> config ( 'types' ) [ $ type ] , '{message.fadeClass}' => $ this -> config ( 'fadeOut' ) ? 'fade in' : null , '{message.contents}' => $ data [ 'message' ] , '{message.title}' => null , '{button}' => $ shouldBeSticky ? null : $ this -> config ( 'button' ) ] ; if ( $ data [ 'dismissable' ] === true ) { $ templateData [ '{message.class}' ] .= ' ' . $ this -> config ( 'dismissableClass' ) ; } if ( ! is_null ( $ title = $ data [ 'title' ] ) ) { $ templateData [ '{message.title}' ] = sprintf ( $ this -> config ( 'title' ) , $ title ) ; } return str_replace ( array_keys ( $ templateData ) , array_values ( $ templateData ) , $ this -> config ( 'wrapper' ) ) ; }
Format the given data
27,333
protected function getDomain ( ) { if ( $ this -> domain !== null ) { return $ this -> domain ; } if ( PHP_SAPI == 'cli' ) { $ this -> domain = '__CLI__' ; return $ this -> domain ; } $ this -> domain = isset ( $ _SERVER [ 'SERVER_NAME' ] ) ? $ _SERVER [ 'SERVER_NAME' ] : 'default' ; return $ this -> domain ; }
Current domain for retrieving values
27,334
public function getConfigValue ( $ name , $ default = null , $ domain = null ) { if ( $ domain === null ) { $ domain = $ this -> getDomain ( ) ; } else if ( $ domain === false ) { $ domain = '__default__' ; } $ domain = strtolower ( $ domain ) ; if ( isset ( $ this -> values [ $ domain ] ) && array_key_exists ( $ name , $ this -> values [ $ domain ] ) ) { return $ this -> values [ $ domain ] [ $ name ] ; } if ( isset ( $ this -> undefined [ $ domain ] [ $ name ] ) ) { return $ default ; } $ xpathName = $ this -> xpathQuote ( $ name ) ; if ( $ domain == '__default__' ) { $ node = $ this -> getNode ( "./property[@name = $xpathName and not(@domain)]" ) ; } else { $ xpathDomain = $ this -> xpathQuote ( $ domain ) ; $ node = $ this -> getNode ( "./property[@name = $xpathName and @domain = $xpathDomain]" ) ; if ( ! $ node instanceof xml \ SimpleXmlElement ) { $ node = $ this -> getNode ( "./property[@name = $xpathName and not(@domain)]" ) ; } } if ( ! $ node instanceof xml \ SimpleXmlElement ) { $ this -> undefined [ $ domain ] [ $ name ] = true ; return $ default ; } $ type = ( string ) $ node [ 'type' ] ; switch ( $ type ) { case 'array' : case 'instance' : $ value = $ node -> toPhpValue ( $ type ) ; break ; case '' : $ type = 'string' ; default : $ value = $ node -> toValue ( $ type , 'value' ) ; break ; } $ this -> values [ $ domain ] [ $ name ] = $ value ; return $ value ; }
Get a property name
27,335
protected function processConfigVariables ( $ value , $ prefix = null ) { if ( $ prefix && ! preg_match ( '~^[a-z0-9._-]*$~i' , $ prefix ) ) { throw new exception \ InvalidArgumentException ( 'Invalid config var prefix: ' . $ prefix ) ; } if ( $ prefix ) { $ prefix = strtr ( $ prefix , '.' , '\\.' ) ; } $ config = $ this ; $ value = preg_replace_callback ( "~{{({$prefix}[a-z0-9._-]+)}}~i" , function ( $ match ) use ( $ config ) { return ( string ) $ config -> getConfigValue ( $ match [ 1 ] , '' ) ; } , $ value ) ; return $ value ; }
Replace placeholders with config values
27,336
public static function formatDate ( $ firstDate , $ secondDate = null , $ returnAsArray = false ) { if ( $ firstDate instanceof \ DateTime ) { $ firstTimestamp = $ firstDate -> format ( 'U' ) ; } elseif ( is_int ( $ firstDate ) ) { $ firstTimestamp = strtotime ( $ firstDate ) ; } else { $ firstTimestamp = strtotime ( $ firstDate ) ; } $ secondTimestamp = null ; if ( $ secondDate instanceof \ DateTime ) { $ secondTimestamp = $ secondDate -> format ( 'U' ) ; } elseif ( is_int ( $ secondDate ) ) { $ secondTimestamp = strtotime ( $ secondDate ) ; } else { $ secondTimestamp = strtotime ( $ secondDate ) ; } return self :: formatTimestamp ( $ firstTimestamp , $ secondTimestamp , $ returnAsArray ) ; }
Format the difference of 2 dates in a human readable form If the second date is omitted the current time will be used .
27,337
public static function formatTimestamp ( $ firstTimestamp , $ secondTimestamp = null , $ returnAsArray = false ) { if ( $ secondTimestamp === null ) { $ secondTimestamp = time ( ) ; } $ startDiff = $ diff = abs ( $ firstTimestamp - $ secondTimestamp ) ; $ suffixes = array ( array ( 'single' => 'second' , 'multi' => 'seconds' , 'div' => 60 , 'cap' => 60 ) , array ( 'single' => 'minute' , 'multi' => 'minutes' , 'div' => 3600 , 'cap' => 60 ) , array ( 'single' => 'hour' , 'multi' => 'hours' , 'div' => 86400 , 'cap' => 24 ) , array ( 'single' => 'day' , 'multi' => 'days' , 'div' => 604800 , 'cap' => 7 ) , array ( 'single' => 'week' , 'multi' => 'weeks' , 'div' => 2629743.83 , 'cap' => 4 ) , array ( 'single' => 'month' , 'multi' => 'months' , 'div' => 31556925 , 'cap' => 12 ) , array ( 'single' => 'year' , 'multi' => 'years' , 'div' => 0 , 'cap' => 0 ) , ) ; foreach ( $ suffixes as $ suffixRow ) { $ single = $ suffixRow [ 'single' ] ; $ multi = $ suffixRow [ 'multi' ] ; $ div = $ suffixRow [ 'div' ] ; $ cap = $ suffixRow [ 'cap' ] ; if ( ! $ cap ) { break ; } if ( $ diff < $ cap ) { if ( $ returnAsArray ) { return array ( $ diff , ( $ diff === 1 ? $ single : $ multi ) ) ; } return $ diff . ' ' . ( $ diff === 1 ? $ single : $ multi ) ; } $ diff = ( int ) round ( $ startDiff / $ div ) ; } if ( $ returnAsArray ) { return array ( $ diff , ( $ diff === 1 ? $ single : $ multi ) ) ; } return $ diff . ' ' . ( $ diff === 1 ? $ single : $ multi ) ; }
Format the difference of 2 unix timestamps in a human readable form If the second date is omitted the current time will be used .
27,338
protected function loadMigrationFiles ( $ component ) { $ path = $ this -> laravel [ 'components' ] -> getComponentPath ( $ component ) . $ this -> getMigrationGeneratorPath ( ) ; $ files = $ this -> laravel [ 'files' ] -> glob ( $ path . '/*_*.php' ) ; foreach ( $ files as $ file ) { $ this -> laravel [ 'files' ] -> requireOnce ( $ file ) ; } }
Include all migrations files from the specified component .
27,339
public function request ( $ class , $ service , $ method , $ arguments = [ ] ) { $ wsdl = $ this -> getWsdlUri ( $ class ) ; $ this -> client = new SoapClient ( $ wsdl , [ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS , 'trace' => true , 'exceptions' => true , 'cache_wsdl' => WSDL_CACHE_MEMORY , ] ) ; $ request = $ this -> addAuthHeader ( $ arguments ) ; $ result = $ this -> client -> __soapcall ( $ service , array ( $ method => $ request ) ) ; if ( ! isset ( $ result -> ReturnValue ) ) { return ; } else { if ( is_array ( $ result -> ReturnValue ) && count ( $ result -> ReturnValue ) > 1 ) { return $ result ; } else { return $ result -> ReturnValue ; } } }
Forms and send a Web Service request to Schilling .
27,340
public function addAuthHeader ( $ arguments ) { $ authentication = [ 'Username' => $ this -> username , 'Password' => $ this -> password , 'Company' => $ this -> company , ] ; $ query = array_merge ( $ authentication , $ arguments ) ; return $ query ; }
Adds authentication information to the Web Service query .
27,341
public function firstWhere ( $ key , $ operator , $ value = null ) { return $ this -> first ( $ this -> operatorForWhere ( ... \ func_get_args ( ) ) ) ; }
Get the first item by the given key value pair .
27,342
protected function _createNotFoundException ( $ message = null , $ code = null , RootException $ previous = null , BaseContainerInterface $ container = null , $ dataKey = null ) { return new NotFoundException ( $ message , $ code , $ previous , $ container , $ dataKey ) ; }
Creates a new not found exception .
27,343
public function matches ( \ Exception $ exception , Handler $ handler ) : bool { return $ this -> matcher ? call_user_func ( $ this -> matcher , $ exception , $ handler ) : false ; }
Executes code in order to check whether this Condition matches the given Exception .
27,344
public function onMatch ( \ Exception $ exception , Handler $ handler ) { return $ this -> onMatch ? call_user_func ( $ this -> onMatch , $ exception , $ handler ) : null ; }
Executes code that applies when this Condition is met .
27,345
private function normToView ( $ value ) { if ( ! $ this -> config -> getViewTransformers ( ) ) { return null === $ value || is_scalar ( $ value ) ? ( string ) $ value : $ value ; } foreach ( $ this -> config -> getViewTransformers ( ) as $ transformer ) { $ value = $ transformer -> transform ( $ value ) ; } return $ value ; }
Transforms the value if a value transformer is set .
27,346
public function addGenre ( $ genre ) { if ( is_null ( $ genre ) ) { throw new \ InvalidArgumentException ( 'Genre cannot be null' ) ; } if ( ! is_string ( $ genre ) ) { throw new \ InvalidArgumentException ( 'Genre must be string' ) ; } if ( ! in_array ( $ genre , $ this -> genres ) ) { $ this -> genres [ ] = $ genre ; } return $ this ; }
Add a genre
27,347
public function set ( string $ name , $ value ) { if ( $ name === "default" ) { if ( is_scalar ( $ value ) ) $ this -> default = $ value ; } else if ( $ name !== "name" && isset ( $ this -> { $ name } ) && gettype ( $ this -> { $ name } ) === gettype ( $ value ) ) { $ this -> { $ name } = $ value ; } return $ this ; }
Update column value
27,348
public function createService ( ServiceLocatorInterface $ serviceLocator ) { $ mapper = new UserRoleLinkerMapper ; $ options = $ serviceLocator -> get ( 'UserRbac\ModuleOptions' ) ; $ class = $ options -> getUserRoleLinkerEntityClass ( ) ; $ mapper -> setEntityPrototype ( new $ class ) ; $ mapper -> setDbAdapter ( $ serviceLocator -> get ( 'UserRbac\DbAdapter' ) ) ; $ mapper -> setTableName ( $ options -> getTableName ( ) ) ; return $ mapper ; }
Gets user role linker
27,349
public static function register ( $ hook , $ id_module ) { $ Hook = self :: isRegistered ( $ hook ) ; if ( ! $ Hook ) { $ Hook = new Hook ( ) ; $ Hook -> name = $ hook ; if ( ! $ Hook -> save ( ) ) { \ Log :: info ( $ Hook -> errors ( ) ) ; return false ; } } return $ Hook -> registerModule ( $ id_module ) ; }
register hook in system
27,350
public static function execute ( $ hook , $ params = array ( ) ) { $ html = '' ; $ modules = Hook :: getModulesByName ( $ hook ) ; if ( ! $ modules || ! is_array ( $ modules ) || ! count ( $ modules ) ) return $ html ; else { foreach ( $ modules as $ module ) { if ( \ File :: exists ( app_path ( 'Modules/' . $ module -> author . '/' . $ module -> name . '/Module.php' ) ) ) { $ object = Module :: getInstance ( $ module -> author , $ module -> name ) ; if ( method_exists ( $ object , 'hook' . ucfirst ( $ hook ) ) ) { $ html .= $ object -> { 'hook' . ucfirst ( $ hook ) } ( $ params ) ; } } } } return $ html ; }
execute hook and load module relation to that
27,351
public static function getModulesByName ( $ hook ) { return \ Cache :: remember ( 'hook' . $ hook , 100000 , function ( ) use ( $ hook ) { return \ DB :: table ( 'modules AS m' ) -> select ( 'm.*' , 'hm.position' ) -> leftJoin ( 'hooks_modules AS hm' , 'hm.id_module' , '=' , 'm.id' ) -> leftJoin ( 'hooks AS h' , 'h.id' , '=' , 'hm.id_hook' ) -> where ( 'h.name' , $ hook ) -> where ( 'm.active' , '1' ) -> orderBy ( 'hm.position' , 'ASC' ) -> get ( ) ; } ) ; }
get modules by hook order by position asc
27,352
public static function getHighestPosition ( $ id_hook ) { return ( int ) \ DB :: table ( 'hooks_modules as hm' ) -> leftJoin ( 'hooks as h' , 'h.id' , '=' , 'hm.id_hook' ) -> where ( 'h.id' , $ id_hook ) -> orderBy ( 'hm.position' , 'DESC' ) -> value ( 'position' ) ; }
get highest position of given hook
27,353
public static function fromExtension ( $ extension ) { $ extension = strtolower ( $ extension ) ; return isset ( static :: $ mimetypes [ $ extension ] ) ? static :: $ mimetypes [ $ extension ] : null ; }
Get a mimetype value from a file extension
27,354
private function setFilesystemRootDir ( $ rootDir , ContainerBuilder $ container ) { $ definition = $ container -> getDefinition ( $ this -> getAlias ( ) . '.filesystem' ) ; $ definition -> replaceArgument ( 0 , $ rootDir ) ; }
Set filesystem root dir .
27,355
private function setImageConfigs ( array $ configs , ContainerBuilder $ container ) { $ definition = $ container -> getDefinition ( 'silvestra_media.image.default_config' ) ; $ definition -> addArgument ( $ configs [ 'available_mime_types' ] ) ; $ definition -> addArgument ( $ configs [ 'default_cropper_enabled' ] ) ; $ definition -> addArgument ( $ configs [ 'default_resize_strategy' ] ) ; $ definition -> addArgument ( $ configs [ 'max_file_size' ] ) ; $ definition -> addArgument ( $ configs [ 'max_height' ] ) ; $ definition -> addArgument ( $ configs [ 'max_width' ] ) ; $ definition -> addArgument ( $ configs [ 'min_height' ] ) ; $ definition -> addArgument ( $ configs [ 'min_width' ] ) ; }
Set image configs .
27,356
public function post ( PagerDutyEntityInterface $ pagerDutyEntity ) { $ data = null ; try { $ response = $ this -> getHttpClient ( ) -> post ( $ this -> getResourceUrl ( $ pagerDutyEntity ) , $ this -> headers , $ this -> getRepresentProcessor ( ) -> representJSON ( $ pagerDutyEntity ) ) ; $ data = $ this -> performResponse ( $ response ) ; } catch ( HttpClientException $ exception ) { throw EventClientTransportException :: transportProblem ( $ exception ) ; } catch ( EventValidationResponseException $ exception ) { throw ResponseDataValidationException :: validationFail ( $ exception ) ; } return $ data ; }
Make HTTP POST Request to the Event api .
27,357
private function getResourceUrl ( PagerDutyEntityInterface $ pagerDutyEntity ) { return sprintf ( '%s/%s' , $ this -> getApiRootUrl ( ) , $ this -> getRepresentProcessor ( ) -> getRESTResourcePath ( $ pagerDutyEntity ) ) ; }
Get Full resource Url .
27,358
private function performResponse ( $ response ) { $ data = false ; if ( $ response instanceof ResponseInterface ) { $ data = json_decode ( $ response -> getBody ( ) -> getContents ( ) ) ; $ this -> getValidationResponse ( ) -> validateResponseData ( $ data ) ; } return $ data ; }
Perform response and gets it date .
27,359
public function addSchemaValidation ( $ schemaFile , $ name = null ) { $ realName = $ this -> generateName ( $ schemaFile , $ name ) ; $ realPath = getcwd ( ) . DIRECTORY_SEPARATOR . $ schemaFile ; if ( file_exists ( $ realPath ) ) { if ( ! key_exists ( $ realName , $ this -> schemaValidations ) ) { if ( $ this -> devMode || ( ! $ this -> isSerialized ( $ realPath ) && ! $ this -> devMode ) ) { $ json = json_decode ( file_get_contents ( $ realPath ) , true ) ; if ( is_null ( $ json ) ) { trigger_error ( $ schemaFile . ' is not a valid json file' , E_USER_ERROR ) ; } $ validation = $ this -> createValidation ( $ json ) ; if ( ! $ this -> devMode ) { file_put_contents ( $ realPath . '.ser' , serialize ( $ validation ) ) ; } $ this -> schemaValidations [ $ realName ] = $ validation ; } else { $ this -> schemaValidations [ $ realName ] = unserialize ( file_get_contents ( $ realPath . '.ser' ) ) ; } } else { trigger_error ( 'Schema with the name ' . $ realName . ' already exist.' , E_USER_ERROR ) ; } } else { trigger_error ( $ schemaFile . ' could not be found' , E_USER_ERROR ) ; } }
This function adds a schema . json to this Validator . If no name is supplied it will use the name of the schema file . If the Validator is not in developer mode the Validator will loock for a serialised version of the schema file to save time for instanziating . If in developer mode the Validator will read the schema file regardless of any serialized file
27,360
public function addSchemaFromString ( $ string ) { $ json = json_decode ( $ string , true ) ; if ( is_null ( $ json ) ) { trigger_error ( 'not a valid json' ) ; } return $ this -> createValidation ( $ json ) ; }
This method creates a Validation object from string this validation will not get a name or will be stored inside the validator
27,361
public function uuidV4 ( ) { return sprintf ( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x' , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0x0fff ) | 0x4000 , mt_rand ( 0 , 0x3fff ) | 0x8000 , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0xffff ) ) ; }
Generate a valid V4 UUID
27,362
final protected function checkImmutability ( ) : void { $ this -> checkCallConstraints ( ) ; $ class = static :: class ; if ( isset ( static :: $ immutabilityCheckMap [ $ class ] ) ) { return ; } $ this -> checkPropertiesAccessibility ( ) ; $ this -> checkMethodsAccessibility ( ) ; static :: $ immutabilityCheckMap [ $ class ] = true ; }
Check immutability .
27,363
private function checkPropertiesAccessibility ( ) : void { $ publicProperties = ( new \ ReflectionObject ( $ this ) ) -> getProperties ( \ ReflectionProperty :: IS_PUBLIC ) ; if ( \ count ( $ publicProperties ) !== 0 ) { throw new ImmutabilityViolationException ( \ sprintf ( 'Class %s should not have public properties' , static :: class ) ) ; } }
Check properties accessibility .
27,364
private function checkMethodsAccessibility ( ) : void { $ publicMethods = $ this -> getClassPublicMethods ( ) ; \ sort ( $ publicMethods ) ; $ allowedPublicMethods = $ this -> getAllowedPublicMethods ( ) ; foreach ( static :: $ allowedMagicMethods as $ magicMethod ) { if ( \ array_search ( $ magicMethod , $ publicMethods , true ) !== false ) { $ allowedPublicMethods [ ] = $ magicMethod ; } } \ sort ( $ allowedPublicMethods ) ; if ( \ count ( $ publicMethods ) > \ count ( $ allowedPublicMethods ) || \ count ( \ array_diff ( $ allowedPublicMethods , $ publicMethods ) ) !== 0 ) { throw new ImmutabilityViolationException ( \ sprintf ( 'Class %s should not have public methods' , static :: class ) ) ; } }
Check methods accessibility .
27,365
private function getClassPublicMethods ( ) : array { return \ array_filter ( \ array_map ( function ( \ ReflectionMethod $ method ) : string { return ! $ method -> isStatic ( ) ? $ method -> getName ( ) : '' ; } , ( new \ ReflectionObject ( $ this ) ) -> getMethods ( \ ReflectionMethod :: IS_PUBLIC ) ) ) ; }
Get list of defined public methods .
27,366
protected function getAllowedPublicMethods ( ) : array { $ allowedInterfaces = \ array_unique ( \ array_merge ( $ this -> getAllowedInterfaces ( ) , [ ImmutabilityBehaviour :: class ] ) ) ; $ allowedMethods = \ array_merge ( ... \ array_map ( function ( string $ interface ) : array { return ( new \ ReflectionClass ( $ interface ) ) -> getMethods ( \ ReflectionMethod :: IS_PUBLIC ) ; } , $ allowedInterfaces ) ) ; return \ array_unique ( \ array_filter ( \ array_map ( function ( \ ReflectionMethod $ method ) : string { return ! $ method -> isStatic ( ) ? $ method -> getName ( ) : '' ; } , $ allowedMethods ) ) ) ; }
Get list of allowed public methods .
27,367
public function dispatch ( ) { $ name = $ this -> generateClassName ( $ this -> namespace , $ this -> class ) ; $ controller = App :: make ( $ name ) ; if ( $ controller instanceof Controller ) { $ controller -> runControllerWithParameters ( ParameterBag :: getParameters ( ) ) ; return $ controller ; } else { throw new ControllerException ( sprintf ( '%s is not a instance of controller' , $ name ) ) ; } }
dispatch the controller
27,368
public static function Ut1tai ( $ ut11 , $ ut12 , $ dta , & $ tai1 , & $ tai2 ) { $ dtad ; $ dtad = $ dta / DAYSEC ; if ( $ ut11 > $ ut12 ) { $ tai1 = $ ut11 ; $ tai2 = $ ut12 - $ dtad ; } else { $ tai1 = $ ut11 - $ dtad ; $ tai2 = $ ut12 ; } return 0 ; }
- - - - - - - - - - i a u U t 1 t a i - - - - - - - - - -
27,369
public function beforeFind ( Model $ model , $ query ) { if ( Configure :: read ( 'Cache.disable' ) || ! isset ( $ query [ 'cache' ] ) ) { $ this -> _isCaching = false ; return true ; } $ key = $ query [ 'cache' ] ; $ expires = isset ( $ query [ 'cacheExpires' ] ) ? $ query [ 'cacheExpires' ] : null ; $ forceRefresh = isset ( $ query [ 'cacheForceRefresh' ] ) ? $ query [ 'cacheForceRefresh' ] : false ; if ( $ key === true ) { $ key = array ( $ model -> alias , md5 ( json_encode ( $ query ) ) ) ; } else if ( is_array ( $ key ) ) { if ( isset ( $ key [ 'expires' ] ) ) { $ expires = $ key [ 'expires' ] ; } if ( isset ( $ key [ 'key' ] ) ) { $ key = $ key [ 'key' ] ; } } $ key = $ this -> cacheKey ( $ model , $ key , false ) ; $ expires = $ this -> getExpiration ( $ model , $ expires ) ; $ this -> _isCaching = true ; $ this -> _currentQuery = array ( 'key' => $ key , 'expires' => $ expires , 'forceRefresh' => $ forceRefresh ) ; $ results = null ; if ( ! $ forceRefresh ) { if ( ! empty ( $ this -> _cached [ $ key ] ) ) { $ results = $ this -> _cached [ $ key ] ; } else if ( $ fromCache = $ this -> readCache ( $ model , $ key ) ) { $ results = $ fromCache ; } } if ( $ results ) { $ this -> _cached [ $ key ] = $ results ; $ this -> _previousDbConfig = $ model -> useDbConfig ; $ dbConfig = $ this -> settings [ $ model -> alias ] [ 'dbConfig' ] ; ConnectionManager :: create ( $ dbConfig , array ( 'datasource' => 'Utility.ShimSource' , 'database' => null ) ) ; $ model -> useDbConfig = $ dbConfig ; } return true ; }
Before a query is executed look for the cache parameter . If the cache param exists generate a cache key and fetch the results from the cache . If the result is empty or the cache doesn t exist replace the current datasource with a dummy shim datasource allowing us to pull in cached results .
27,370
public function cacheKey ( Model $ model , $ keys , $ prefix = true ) { if ( ! empty ( $ model -> locale ) ) { $ keys = array_merge ( ( array ) $ model -> locale , ( array ) $ keys ) ; } if ( is_array ( $ keys ) ) { $ key = array_shift ( $ keys ) ; if ( $ keys ) { foreach ( $ keys as $ value ) { if ( is_array ( $ value ) ) { $ key .= '-' . md5 ( json_encode ( $ value ) ) ; } else if ( $ value ) { $ key .= '-' . $ value ; } } } } else { $ key = ( string ) $ keys ; } if ( $ prefix ) { $ key = ( string ) $ this -> settings [ $ model -> alias ] [ 'prefix' ] . $ key ; } $ key = str_replace ( array ( 'AppModel' , '::' ) , array ( $ model -> alias , '_' ) , $ key ) ; return $ key ; }
Generate a cache key . The first index should be the method name the other indices should be unique values .
27,371
protected function getUrlSlider ( $ onEachSide ) { $ window = $ onEachSide * 2 ; if ( ! $ this -> hasPages ( ) ) { return [ 'first' => null , 'slider' => null , 'last' => null , ] ; } if ( $ this -> currentPage ( ) <= $ window ) { return $ this -> getSliderTooCloseToBeginning ( $ window ) ; } elseif ( $ this -> currentPage ( ) > ( $ this -> lastPage ( ) - $ window ) ) { return $ this -> getSliderTooCloseToEnding ( $ window ) ; } return $ this -> getFullSlider ( $ onEachSide ) ; }
Create a URL slider links .
27,372
public function setFrom ( array $ addresses ) : Email { $ addresses = $ this -> transformAddressesToArray ( $ addresses ) ; $ this -> message -> setFrom ( $ addresses ) ; return $ this ; }
Set the From addresses .
27,373
public function setReplyTo ( array $ addresses ) : Email { $ addresses = $ this -> transformAddressesToArray ( $ addresses ) ; $ this -> message -> setReplyTo ( $ addresses ) ; return $ this ; }
Set the Reply - To addresses .
27,374
public function setTo ( array $ addresses ) : Email { $ addresses = $ this -> transformAddressesToArray ( $ addresses ) ; $ this -> message -> setTo ( $ addresses ) ; return $ this ; }
Set the To addresses .
27,375
public function setCc ( array $ addresses ) : Email { $ addresses = $ this -> transformAddressesToArray ( $ addresses ) ; $ this -> message -> setCc ( $ addresses ) ; return $ this ; }
Set the Cc addresses .
27,376
public function setBcc ( array $ addresses ) : Email { $ addresses = $ this -> transformAddressesToArray ( $ addresses ) ; $ this -> message -> setBcc ( $ addresses ) ; return $ this ; }
Set the Bcc addresses .
27,377
public function getSender ( ) { $ addresses = $ this -> transformArrayToAddresses ( $ this -> message -> getSender ( ) ) ; if ( $ address = reset ( $ addresses ) ) { return $ address ; } return null ; }
Get the sender address for this message .
27,378
public function setBounce ( Address $ address ) : Email { $ this -> message -> setReturnPath ( $ address -> getEmail ( ) , $ address -> getName ( ) ) ; return $ this ; }
Set the bounce address for this message .
27,379
public function getBounce ( ) { $ addresses = $ this -> transformArrayToAddresses ( $ this -> message -> getReturnPath ( ) ) ; if ( $ address = reset ( $ addresses ) ) { return $ address ; } return null ; }
Get the bounce address for this message .
27,380
public function addMessage ( Message $ message ) : Email { if ( null === $ this -> message -> getBody ( ) ) { $ this -> message -> setBody ( $ message -> getBody ( ) , $ message -> getContentType ( ) ) ; return $ this ; } $ this -> message -> addPart ( $ message -> getBody ( ) , $ message -> getContentType ( ) ) ; return $ this ; }
Add message body to email .
27,381
public function getMessages ( ) : array { $ templates = [ new Message ( $ this -> message -> getBody ( ) , $ this -> message -> getContentType ( ) ) , ] ; return $ templates ; }
Get all message body parts from the email .
27,382
public function getAnswers ( \ Composer \ Script \ Event $ event , array $ questions , \ SplFileInfo $ file ) : array { if ( $ event -> getIO ( ) -> isInteractive ( ) ) { $ answers = $ this -> getComposerIO ( ) -> getAnswers ( $ event -> getIO ( ) , $ questions ) ; } else { $ answers = $ this -> getFromArray ( ) -> getAnswers ( $ file ) ; } return $ answers ; }
Checks if the IO is interactive . If so it passes the IO and the questions to the ComposerIO collector .
27,383
private function makeBackup ( ) { if ( ( null === $ this -> backupFile ) || ! file_exists ( $ this -> filename ) ) { return ; } if ( ! is_dir ( dirname ( $ this -> backupFile ) ) ) { mkdir ( dirname ( $ this -> backupFile ) , 0700 , true ) ; } copy ( $ this -> filename , $ this -> backupFile ) ; }
Copy the file contents over to the backup .
27,384
public function save ( ) { $ this -> makeBackup ( ) ; if ( ! is_dir ( dirname ( $ this -> filename ) ) ) { mkdir ( dirname ( $ this -> filename ) , 0700 , true ) ; } file_put_contents ( $ this -> filename , ( string ) $ this ) ; return $ this ; }
Save the file data .
27,385
public function getRequire ( string $ path ) { if ( $ this -> isFile ( $ path ) ) { return $ this -> callback ( static function ( $ file ) { return require $ file ; } , $ path ) ; } throw new NotFoundFileException ( $ path , "File does not exist at path '{$path}'" ) ; }
Get the returned value of a file
27,386
public function getRequireData ( string $ path , $ default = [ ] ) { if ( $ this -> isFile ( $ path ) ) { return $ this -> callback ( function ( $ file ) use ( $ default ) { require $ file ; return $ data ?? $ default ?? null ; } , $ path ) ; } throw new NotFoundFileException ( $ path , "File does not exist at path '{$path}'" ) ; }
Get the saved data value of a file
27,387
public function reset ( ) { $ this -> queryType = null ; $ this -> offset = 0 ; $ this -> limit = null ; $ this -> joins = array ( ) ; $ this -> fields = array ( ) ; $ this -> fromTable = null ; $ this -> wheres = array ( ) ; $ this -> orderBy = null ; $ this -> groupBy = array ( ) ; $ this -> having = array ( ) ; return $ this ; }
Reset query before run new select update insert ...
27,388
public function from ( $ table , $ selectFields = array ( '*' ) ) { list ( $ tableName , $ tableAlias ) = $ this -> tableProcess ( $ table ) ; $ this -> fromTable [ $ tableAlias ] = $ tableName ; if ( empty ( $ selectFields ) ) { return $ this ; } if ( $ this -> queryType == self :: QUERYTYPE_SELECT ) { $ this -> fields [ $ tableAlias ] = $ this -> fieldProcess ( $ tableAlias , $ selectFields ) ; } else { $ this -> fields [ $ tableAlias ] = $ selectFields ; } return $ this ; }
Set from table and select fields
27,389
public function limit ( $ offset = null , $ limit = null ) { $ args = func_get_args ( ) ; if ( count ( $ args ) === 0 ) { throw new Exception ( 'At least 1 argument' ) ; } if ( count ( $ args ) == 1 ) { $ this -> limit = $ args [ 0 ] ; } else { list ( $ this -> offset , $ this -> limit ) = $ args ; } return $ this ; }
Set limit and offset
27,390
public function select ( $ table = null , $ selectFields = array ( '*' ) ) { $ this -> queryTypeProcess ( self :: QUERYTYPE_SELECT , $ table , $ selectFields ) ; return $ this ; }
Set select stament
27,391
public function update ( $ table , array $ updateFields ) { $ this -> queryTypeProcess ( self :: QUERYTYPE_UPDATE , $ table , $ updateFields ) ; return $ this ; }
Set update stament
27,392
public function insert ( $ table , array $ updateFields ) { $ this -> queryTypeProcess ( self :: QUERYTYPE_INSERT , $ table , $ updateFields ) ; return $ this ; }
Set insert stament
27,393
public function insertIgnore ( $ table , array $ updateFields ) { $ this -> queryTypeProcess ( self :: QUERYTYPE_INSERT_IGNORE , $ table , $ updateFields ) ; return $ this ; }
Set insert ignore stament
27,394
public function replace ( $ table , array $ updateFields ) { $ this -> queryTypeProcess ( self :: QUERYTYPE_REPLACE , $ table , $ updateFields ) ; return $ this ; }
Set replace stament
27,395
public function where ( $ cond ) { $ this -> wheres [ ] = $ this -> whereProcess ( self :: OPERATION_AND , func_get_args ( ) ) ; return $ this ; }
Set where AND
27,396
public function orWhere ( $ cond ) { $ this -> wheres [ ] = $ this -> whereProcess ( self :: OPERATION_OR , func_get_args ( ) ) ; return $ this ; }
Set where OR
27,397
public function setAccessTokenFromProfile ( FacebookProfile $ profile ) { $ this -> app [ 'facebook' ] -> setAccessToken ( $ profile -> access_token ) ; $ this -> profile = $ profile ; return $ this ; }
Sets the appropriate API access token using a given profile .
27,398
public function clearValues ( ) { foreach ( $ this -> record as $ key => $ value ) { $ this -> record [ $ key ] = null ; } }
Clears the value of all fields in the record and sets each field to null .
27,399
public function getFieldName ( int $ index ) { $ keyArray = array_keys ( $ this -> record ) ; if ( $ index > 0 && $ index < $ this -> count ( ) ) { return $ keyArray [ $ index ] ; } return null ; }
Returns the name of the field at position index . If the field does not exist an empty string is returned .