idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
25,300
public function handleErrors ( $ code , $ message , $ file , $ line ) { throw new ErrorException ( $ message , 0 , $ code , $ file , $ line ) ; }
convert to errors to exceptions
25,301
protected function generateExceptionResponse ( Exception $ e ) { $ e = FlattenException :: create ( $ e ) ; $ content = $ this -> decoreate ( $ this -> exceptionHandler -> getContent ( $ e ) , $ this -> exceptionHandler -> getStylesheet ( $ e ) , 'utf-8' ) ; return response ( $ content , 500 ) ; }
create response objecto to exception message
25,302
protected function shouldBeLog ( $ e ) { foreach ( $ this -> dontLog as $ instance ) { if ( $ e instanceof $ instance ) { return false ; } } return true ; }
Determine if the exception should be reported .
25,303
protected function getInternalCollection ( ) : ? Collection { if ( ! $ this -> hasInternalCollection ( ) ) { $ this -> setInternalCollection ( $ this -> getDefaultInternalCollection ( ) ) ; } return $ this -> internalCollection ; }
Get internal collection
25,304
function register ( ) { set_error_handler ( array ( $ this , '_handleError' ) ) ; set_exception_handler ( array ( $ this , '_handleException' ) ) ; register_shutdown_function ( array ( $ this , '_shutdown' ) ) ; $ this -> _registered = true ; return $ this ; }
Registers the error handler with PHP
25,305
public function _handleException ( $ e ) { if ( ! $ this -> _inError && $ handler = $ this -> _application -> errorHandler ( ) ) { $ this -> _inError = true ; $ handler -> handle ( $ e ) ; $ this -> _inError = false ; } else { if ( php_sapi_name ( ) == 'cli' ) { echo $ e -> __toString ( ) ; exit ( 1 ) ; } else { header ( 'HTTP/1.1 500 Internal Server Error' ) ; echo "<h1>Error: " . $ e -> getMessage ( ) . '</h1>' ; echo '<pre>' . $ e -> __toString ( ) . '</pre>' ; exit ( 1 ) ; } } }
PHP exception handler interface
25,306
public function _handleError ( $ errno , $ errstr , $ errfile , $ errline , $ context = null ) { if ( error_reporting ( ) & $ errno ) { try { $ message = $ this -> _errorNumberString ( $ errno ) . ': ' . $ errstr ; throw new \ ErrorException ( $ message , 0 , $ errno , $ errfile , $ errline ) ; } catch ( \ ErrorException $ e ) { $ this -> _handleException ( $ e ) ; } } }
PHP error handler interface
25,307
private function _errorNumberString ( $ intval ) { $ errorlevels = array ( E_ALL => 'E_ALL' , E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR' , E_STRICT => 'E_STRICT' , E_USER_NOTICE => 'E_USER_NOTICE' , E_USER_WARNING => 'E_USER_WARNING' , E_USER_ERROR => 'E_USER_ERROR' , E_COMPILE_WARNING => 'E_COMPILE_WARNING' , E_COMPILE_ERROR => 'E_COMPILE_ERROR' , E_CORE_WARNING => 'E_CORE_WARNING' , E_CORE_ERROR => 'E_CORE_ERROR' , E_NOTICE => 'E_NOTICE' , E_PARSE => 'E_PARSE' , E_WARNING => 'E_WARNING' , E_ERROR => 'E_ERROR' ) ; if ( defined ( 'E_DEPRECATED' ) ) { $ errorlevels [ E_DEPRECATED ] = 'E_DEPRECATED' ; $ errorlevels [ E_USER_DEPRECATED ] = 'E_USER_DEPRECATED' ; } return $ errorlevels [ $ intval ] ; }
Converts a PHP error int to a string
25,308
public function _shutdown ( ) { if ( $ this -> _registered && $ error = error_get_last ( ) ) { try { if ( ob_get_level ( ) >= 1 ) ob_end_clean ( ) ; if ( isset ( $ error [ 'type' ] ) && in_array ( $ error [ 'type' ] , array ( E_ERROR , E_PARSE , E_COMPILE_ERROR ) ) ) { $ this -> _handleError ( $ error [ 'type' ] , $ error [ 'message' ] , $ error [ 'file' ] , $ error [ 'line' ] ) ; } } catch ( Exception $ e ) { } } }
PHP shutdown function to catch fatal errors
25,309
public function dispatch ( ResolvedRequestInterface $ resolvedRequest ) { $ route = $ resolvedRequest -> getRoute ( ) ; $ controller = $ this -> container -> make ( $ route -> getController ( ) , [ 'resolvedRequest' => $ resolvedRequest ] ) ; if ( method_exists ( $ controller , 'before' ) ) { $ this -> container -> call ( [ $ controller , 'before' ] , [ 'resolvedRequest' => $ resolvedRequest ] ) ; } $ response = $ this -> container -> call ( [ $ controller , 'action' . $ route -> getAction ( ) ] , [ 'resolvedRequest' => $ resolvedRequest ] ) ; if ( method_exists ( $ controller , 'after' ) ) { $ this -> container -> call ( [ $ controller , 'after' ] , [ 'resolvedRequest' => $ resolvedRequest ] ) ; } return $ response ; }
Dispatch a route .
25,310
protected function registerBootProviders ( Repository $ config ) { foreach ( $ this -> getComponentsFromConfig ( $ config , 'boot' , getenv ( 'APP_ENV' ) ) as $ provider ) { $ this -> app -> register ( $ provider ) ; } }
Registers the boot providers to run
25,311
protected function registerServiceProviders ( Repository $ config ) { foreach ( $ this -> getComponentsFromConfig ( $ config , 'register' , getenv ( 'APP_ENV' ) ) as $ provider ) { $ this -> app -> register ( $ provider ) ; $ config -> push ( 'app.providers' , $ provider ) ; } }
Register the service providers under the register call
25,312
protected function registerFacadeAliases ( Repository $ config ) { $ loader = AliasLoader :: getInstance ( ) ; foreach ( $ this -> getComponentsFromConfig ( $ config , 'facades' , getenv ( 'APP_ENV' ) ) as $ alias => $ facade ) { $ loader -> alias ( $ alias , $ facade ) ; $ config -> set ( 'app.aliases.' . $ alias , $ facade ) ; } }
Registers any facades that have been defined
25,313
protected function init ( $ http_host = 'localhost' , $ http_port = 80 , $ http_scheme = 'http://' , $ log_level = Log :: INFO ) { $ this -> stream = Stream :: _get ( ) ; $ this -> stream -> setCompression ( Stream :: COMPRESS_GZIP ) ; $ this -> stream -> setEncryption ( Stream :: CRYPT_LSS ) ; $ this -> setHTTPHost ( $ http_host ) ; $ this -> setHTTPPort ( $ http_port ) ; $ this -> setHTTPScheme ( $ http_scheme ) ; $ this -> log = Log :: _get ( ) -> setLevel ( $ log_level ) ; if ( ! is_callable ( 'mda_get' ) ) throw new Exception ( 'MDA package not loaded: required mda_get()' ) ; }
the real constructor
25,314
public static function get ( $ array , $ pattern ) { if ( ! is_array ( $ array ) ) { return ; } if ( array_key_exists ( $ pattern , $ array ) ) { return $ array [ $ pattern ] ; } foreach ( explode ( '.' , $ pattern ) as $ segment ) { if ( is_array ( $ array ) && array_key_exists ( $ segment , $ array ) ) { $ array = $ array [ $ segment ] ; } else { return ; } } }
Get Element from array by dot aspect .
25,315
public static function push ( & $ array ) { $ params = func_get_arg ( ) ; for ( $ i = 1 ; $ i < static :: count ( $ params ) ; $ i ++ ) { array_push ( $ array , $ params [ $ i ] ) ; } }
Add element to end of array .
25,316
public static function concat ( array $ array , $ separator = ' ' ) { $ result = '' ; foreach ( $ array as $ string ) { if ( is_string ( $ string ) ) { $ result .= $ string ; } } return $ result ; }
Concat string elements in array .
25,317
public static function copy ( $ array , $ target ) { foreach ( $ array as $ key => $ element ) { self :: add ( $ target , $ element , $ key ) ; } }
Copy element of an array to another array .
25,318
public static function equal ( array $ array1 , array $ array2 ) { if ( static :: count ( $ array1 ) != static :: count ( $ array2 ) ) { return false ; } else { for ( $ i = 0 ; $ i < static :: count ( $ array1 ) ; $ i ++ ) { if ( $ array1 [ $ i ] != $ array2 [ $ i ] ) { return false ; } } } return true ; }
Check if array equal to another array .
25,319
public static function except ( $ array1 , $ array2 ) { $ result = [ ] ; foreach ( $ array1 as $ key => $ value ) { if ( ! static :: contains ( $ array2 , $ value ) ) { if ( is_int ( $ key ) ) { static :: add ( $ array , $ value ) ; } else { static :: add ( $ array , $ value , $ key ) ; } } } foreach ( $ array2 as $ key => $ value ) { if ( ! static :: contains ( $ array1 , $ value ) && ! self :: contains ( $ result , $ value ) ) { if ( is_int ( $ key ) ) { static :: add ( $ array , $ value ) ; } else { static :: add ( $ array , $ value , $ key ) ; } } } return $ result ; }
Distinct element between two array .
25,320
public static function exists ( array $ array , $ key ) { if ( array_key_exists ( $ key , $ array ) ) { return true ; } $ keys = dot ( $ key ) ; foreach ( $ keys as $ key ) { if ( array_key_exists ( $ key , $ array ) ) { $ array = ( array ) $ array [ $ key ] ; continue ; } else { return false ; } } return true ; }
check if array have a key from a given array using dot notation .
25,321
public function accept ( ) { $ command = $ this -> driver -> factoryCommand ( 'accept_alert' , WebDriver_Command :: METHOD_POST ) ; return $ this -> driver -> curl ( $ command ) [ 'value' ] ; }
Accepts the currently displayed alert dialog .
25,322
public function dismiss ( ) { $ command = $ this -> driver -> factoryCommand ( 'dismiss_alert' , WebDriver_Command :: METHOD_POST ) ; return $ this -> driver -> curl ( $ command ) [ 'value' ] ; }
Dismisses the currently displayed alert dialog .
25,323
public function wait ( $ timeout = 30 ) { $ lastException = null ; for ( $ i = 0 ; $ i < $ timeout ; $ i ++ ) { try { $ this -> text ( ) ; return $ this ; } catch ( WebDriver_Exception $ e ) { $ lastException = $ e ; sleep ( 1 ) ; } } if ( null !== $ lastException ) { throw $ lastException ; } return $ this ; }
Waits for an alert to appear .
25,324
public static function get_by_object ( $ object ) { $ db = Database :: Get ( ) ; $ class = get_class ( $ object ) ; $ data = $ db -> get_all ( 'SELECT * FROM object_text WHERE classname=? AND object_id=?' , [ $ class , $ object -> id ] ) ; $ object_texts = [ ] ; foreach ( $ data as $ details ) { $ object_text = new self ( ) ; $ object_text -> id = $ details [ 'id' ] ; $ object_text -> details = $ details ; $ object_texts [ ] = $ object_text ; } return $ object_texts ; }
Get by object
25,325
public static function get_by_object_label_language ( $ object , $ label , \ Skeleton \ I18n \ LanguageInterface $ language , $ auto_create = true ) { $ class_parents = class_parents ( $ object ) ; if ( $ class_parents === false OR count ( $ class_parents ) == 0 ) { $ class = get_class ( $ object ) ; } else { $ class = array_pop ( $ class_parents ) ; } if ( self :: trait_cache_enabled ( ) ) { try { $ key = $ class . '_' . $ object -> id . '_' . $ label . '_' . $ language -> name_short ; $ object = self :: cache_get ( $ key ) ; return $ object ; } catch ( \ Exception $ e ) { } } $ db = Database :: Get ( ) ; $ data = $ db -> get_row ( 'SELECT * FROM object_text WHERE classname=? AND object_id=? AND label=? AND language_id=?' , [ $ class , $ object -> id , $ label , $ language -> id ] ) ; if ( $ data === null ) { if ( ! $ auto_create ) { throw new \ Exception ( 'Object text does not exists' ) ; } else { $ requested = new self ( ) ; $ requested -> object = $ object ; $ requested -> language_id = $ language -> id ; $ requested -> label = $ label ; $ requested -> content = '' ; $ requested -> save ( ) ; if ( self :: trait_cache_enabled ( ) ) { $ key = $ class . '_' . $ object -> id . '_' . $ label . '_' . $ language -> name_short ; self :: cache_set ( $ key , $ requested ) ; } return $ requested ; } } $ object_text = new self ( ) ; $ object_text -> id = $ data [ 'id' ] ; $ object_text -> details = $ data ; if ( self :: trait_cache_enabled ( ) ) { $ key = $ class . '_' . $ object -> id . '_' . $ label . '_' . $ language -> name_short ; self :: cache_set ( $ key , $ object_text ) ; } return $ object_text ; }
Get by object label language
25,326
protected function parse ( ) { if ( ! preg_match ( '|Nodes/(.*)\s\((.*)\)|s' , $ this -> userAgent , $ match ) ) { return ; } list ( $ version , $ parameters ) = array_slice ( $ match , 1 ) ; $ parameters = explode ( ',' , $ parameters ) ; if ( ! empty ( $ version ) ) { $ this -> setVersion ( $ version ) ; } if ( ! empty ( $ parameters ) ) { $ this -> setParameters ( $ parameters ) ; } $ this -> successful = true ; }
Parse user agent string .
25,327
public function setVersion ( $ version ) { $ this -> version = $ version ; $ version = explode ( '.' , $ version ) ; if ( count ( $ version ) == 1 ) { array_push ( $ version , 0 , 0 ) ; } $ this -> majorVersion = ( int ) isset ( $ version [ 0 ] ) ? $ version [ 0 ] : 0 ; $ this -> minorVersion = ( int ) isset ( $ version [ 1 ] ) ? $ version [ 1 ] : 0 ; $ this -> patchVersion = ( int ) isset ( $ version [ 2 ] ) ? $ version [ 2 ] : 0 ; return $ this ; }
Set version .
25,328
public function authenticate ( array $ subject ) { $ caller = $ this -> identifier -> identify ( $ subject ) ; return $ this -> authenticator -> authenticate ( $ subject , $ caller ) ; }
Authenticates a subject
25,329
public function import ( $ dicon ) { $ defines = $ this -> get ( 'yaml' ) -> load ( $ dicon ) ; foreach ( $ defines as $ name => $ def ) { $ define = $ this -> getComponentDefine ( $ def ) ; $ this -> register ( $ name , $ define ) ; } }
import dicon file .
25,330
public function register ( $ name , $ component ) { if ( $ component instanceof \ Closure ) { $ component = new ComponentDefine ( $ component ) ; } if ( $ component instanceof ComponentDefine ) { $ component -> setContainer ( $ this ) ; } elseif ( method_exists ( $ component , 'raikiri' ) && ! $ component instanceof ProphecySubjectInterface ) { $ component -> setContainer ( $ this ) ; } $ this -> components [ $ name ] = $ component ; }
register component to container .
25,331
public function getComponentDefine ( $ setting = array ( ) ) { if ( is_string ( $ setting ) ) { $ setting = array ( 'class' => $ setting ) ; } $ define = new ComponentDefine ( $ setting ) ; return $ define ; }
get define instance
25,332
public function injectDependency ( $ component ) { $ nullFilter = function ( $ var ) { return $ var === null ; } ; $ members = array_keys ( array_filter ( get_object_vars ( $ component ) , $ nullFilter ) ) ; $ names = array_keys ( $ this -> components ) ; $ members = array_intersect ( $ members , $ names ) ; foreach ( $ members as $ key ) { $ component -> $ key = $ this -> get ( $ key ) ; } }
Inject dependency to component
25,333
public function inherit ( Container $ parent ) { foreach ( $ parent -> getAll ( ) as $ name => $ component ) { if ( ! $ this -> has ( $ name ) ) { $ this -> register ( $ name , $ component ) ; } } return $ this ; }
inherit other container
25,334
private static function checkSavePath ( $ path ) { if ( is_string ( $ path ) ) { $ dir = dirname ( $ path ) ; return file_exists ( $ dir ) && is_writeable ( $ dir ) ; } elseif ( is_resource ( $ path ) ) { return true ; } return false ; }
Checks if the log save path is acceptable
25,335
public function getIterator ( ) : \ Generator { while ( ! $ this -> stream -> eof ( ) ) { $ item = $ this -> stream -> read ( $ this -> chunkSize ) ; if ( $ item === '' ) { continue ; } yield $ item ; } }
Generates chunks based on the passed chunk size through reading from the stream .
25,336
public function flash ( ) { if ( $ this -> flashdata === null ) { $ this -> flashdata = new Flash ( isset ( $ _SESSION [ $ this -> flashslot ] ) ? $ _SESSION [ $ this -> flashslot ] : array ( ) ) ; } return $ this -> flashdata ; }
Access flash object .
25,337
private function validatePaginatedCollectionRequest ( PaginatedCollectionRequestInterface $ paginationInfo ) { if ( ! ( ctype_digit ( ( string ) $ paginationInfo -> getPage ( ) ) && 0 <= ( int ) $ paginationInfo -> getPage ( ) ) ) { throw new \ InvalidArgumentException ( 'Page must be a positive integer' ) ; } if ( ! ( ctype_digit ( ( string ) $ paginationInfo -> getItemsPerPage ( ) ) && 0 <= ( int ) $ paginationInfo -> getItemsPerPage ( ) ) ) { throw new \ InvalidArgumentException ( 'Items per page must be a positive integer' ) ; } }
Checks the pagination request validity
25,338
protected function handleRequestError ( $ result ) { if ( $ result === false ) { throw new Exception \ TransferError ( $ this -> request -> getErrorString ( ) , $ this -> request -> getErrorCode ( ) ) ; } switch ( $ this -> request -> getResponseHTTPCode ( ) ) { case 401 : $ this -> error ( $ result , [ 'CODE' => 401 ] ) ; throw new Exception \ AuthenticationFailure ( $ result , 401 ) ; break ; case 403 : $ this -> error ( $ result , [ 'CODE' => 403 ] ) ; throw new Exception \ AccessDenied ( $ result , 403 ) ; break ; case 404 : if ( stripos ( $ result , '{' ) === 0 ) { $ error = json_decode ( $ result ) ; $ errorMessage = $ error -> Message ; } else { $ errorMessage = $ result ; } $ this -> error ( $ errorMessage , [ 'CODE' => 404 ] ) ; throw new Exception \ NotFound ( $ errorMessage , 404 ) ; break ; } }
Handles a potential request error by throwing a useful exception
25,339
public function setPopover ( string $ title , string $ txt , $ placement = null , $ html = null , $ container = null , $ delay = null ) { $ this -> popover = [ 'title' => $ title , 'data-content' => $ txt ] ; $ this -> popoverOptions [ 'title' ] = $ title ; $ placement !== null && Checkers :: checkPlacement ( $ placement ) ; $ placement !== null && $ this -> popoverOptions [ 'data-placement' ] = $ placement ; $ html !== null && $ this -> popoverOptions [ 'data-html' ] = ( int ) ( bool ) $ html ; $ container !== null && $ this -> popoverOptions [ 'data-container' ] = ( string ) $ container ; $ delay !== null && $ this -> popoverOptions [ 'data-delay' ] = ( int ) $ delay ; return $ this ; }
Help bubble with title
25,340
public function getPopoverAttributes ( ) : array { if ( $ this -> popover !== null ) { Component :: getJquery ( ) -> enablePopovers ( ) ; $ attrs = $ this -> popoverOptions ; $ attrs [ 'data-toggle' ] = 'popover' ; $ attrs [ 'title' ] = $ this -> popover [ 'title' ] ; $ attrs [ 'data-content' ] = $ this -> popover [ 'data-content' ] ; return $ attrs ; } return [ ] ; }
Get attributes and active popovers for jquery
25,341
protected static function flatten ( array $ arguments ) : array { $ result = [ ] ; foreach ( $ arguments as $ argument ) { if ( is_array ( $ argument ) ) { $ result = array_merge ( $ result , $ argument ) ; } elseif ( $ argument !== null ) { $ result [ ] = $ argument ; } } return $ result ; }
An api consumer can pass arrays coming from function calls as children to the method create . Elements in this array are direct children of the node created with the method create . Those must therefore be flattened .
25,342
private function add ( string $ property , ? InstructsHowToMap $ instruction ) : array { return $ this -> properties + [ $ property => $ instruction ? : Is :: string ( ) ] ; }
Adds a property to the mapper .
25,343
public static function _camelName ( $ name , $ prefix = null ) { $ name = str_replace ( '_' , ' ' , $ name ) ; $ name = ucwords ( $ name ) ; $ name = str_replace ( ' ' , '' , $ name ) ; if ( ! is_null ( $ prefix ) ) $ name = lcfirst ( $ name ) ; return $ prefix . $ name ; }
converts real_name into camelName
25,344
public static function _realName ( $ name , $ prefix = null ) { $ name = preg_replace ( '/^' . $ prefix . '/' , '' , $ name ) ; $ name = preg_replace ( '/([A-Z]{1})/' , '_$1' , $ name ) ; $ name = strtolower ( $ name ) ; $ name = trim ( $ name , '_' ) ; return $ name ; }
this converts camel case into real_case
25,345
public function getAsserts ( ) { $ metadata = $ this -> app [ 'validator.mapping.class_metadata_factory' ] -> getMetadataFor ( get_class ( $ this ) ) ; return array_map ( function ( $ member ) { return $ member [ 0 ] -> constraints ; } , $ metadata -> members ) ; }
Model validation metadata getter
25,346
public function dispatch ( $ method , $ parameters = [ ] ) { $ base = ucfirst ( $ method ) ; $ traits = $ this -> getRecursiveTraits ( ) ; foreach ( $ traits as $ trait ) { $ trait = explode ( '\\' , $ trait ) ; $ trait = str_replace ( 'model' , '' , strtolower ( array_pop ( $ trait ) ) ) ; $ method = $ trait . $ base ; if ( method_exists ( $ this , $ method ) ) { call_user_func_array ( [ $ this , $ method ] , $ parameters ) ; } } }
Calls a given method on all the current s class used traits based on a prefix
25,347
private function getRecursiveTraits ( $ class = null ) { if ( null == $ class ) { $ class = get_class ( $ this ) ; } $ reflection = new \ ReflectionClass ( $ class ) ; $ traits = array_keys ( $ reflection -> getTraits ( ) ) ; foreach ( $ traits as $ trait ) { $ traits = array_merge ( $ traits , $ this -> getRecursiveTraits ( $ trait ) ) ; } if ( $ parent = $ reflection -> getParentClass ( ) ) { $ traits = array_merge ( $ traits , $ this -> getRecursiveTraits ( $ parent -> getName ( ) ) ) ; } return $ traits ; }
Gets a recursive list of traits used by a class
25,348
public function Delete ( $ DraftID = '' , $ TransientKey = '' ) { $ Form = Gdn :: Factory ( 'Form' ) ; $ Session = Gdn :: Session ( ) ; if ( is_numeric ( $ DraftID ) && $ DraftID > 0 && $ Session -> UserID > 0 && $ Session -> ValidateTransientKey ( $ TransientKey ) ) { $ Draft = $ this -> DraftModel -> GetID ( $ DraftID ) ; if ( $ Draft && ! $ this -> DraftModel -> Delete ( $ DraftID ) ) $ Form -> AddError ( 'Failed to delete discussion' ) ; } else { $ Form -> AddError ( 'ErrPermission' ) ; } if ( $ this -> _DeliveryType === DELIVERY_TYPE_ALL ) { $ Target = GetIncomingValue ( 'Target' , '/vanilla/drafts' ) ; Redirect ( $ Target ) ; } if ( $ Form -> ErrorCount ( ) > 0 ) $ this -> SetJson ( 'ErrorMessage' , $ Form -> Errors ( ) ) ; $ this -> Render ( ) ; }
Delete a single draft .
25,349
protected function hasMethodAnnotation ( $ method , $ annotation ) { if ( ! $ this -> getReflection ( ) -> hasMethod ( $ method ) ) { return FALSE ; } $ rm = Method :: from ( $ this -> getReflection ( ) -> getName ( ) , $ method ) ; return $ rm -> hasAnnotation ( $ annotation ) ; }
Checks if given method has a given annotation
25,350
protected function getAnnotation ( $ reflection , $ name ) { $ res = $ reflection -> getAnnotations ( ) ; if ( isset ( $ res [ $ name ] ) ) { if ( sizeof ( $ res [ $ name ] ) > 1 ) { return $ res [ $ name ] ; } return end ( $ res [ $ name ] ) ; } return NULL ; }
Get all anotations of given name
25,351
public function handleEvent ( Event $ event , Queue $ queue ) { if ( $ event instanceof UserEvent ) { $ nick = $ event -> getNick ( ) ; $ channel = $ event -> getSource ( ) ; $ params = $ event -> getParams ( ) ; $ text = $ params [ 'text' ] ; $ matched = stripos ( $ text , '8 ball' ) !== false ; if ( $ matched ) { $ msg = $ nick . ', the magic 8 ball says "' . $ this -> getMagicEightBallAnswer ( ) . '"' ; $ queue -> ircPrivmsg ( $ channel , $ msg ) ; } } }
Responds with a magic eight ball phrase when asked questions
25,352
protected function getDefinition ( ) : DefinitionInterface { if ( $ this -> definition === null ) { $ this -> definition = ( new Definition ( ) ) -> addOption ( new Option ( 'verbose' , 'Be more verbose.' , 'v' , 'verbose' , true , true ) ) -> addOption ( new Option ( 'help' , 'Show help about shell or command.' , 'h' , 'help' ) ) ; } return $ this -> definition ; }
Get definition for default options .
25,353
public function unlock ( string $ id ) : LockableInterface { if ( isset ( $ this -> locks [ $ id ] ) === true ) { unset ( $ this -> locks [ $ id ] ) ; } return $ this ; }
Unlocks an index
25,354
private function recursivCompleteEntity ( $ entity ) { switch ( true ) { case is_a ( $ entity , \ RGU \ Dvoconnector \ Domain \ Model \ Meta \ Association \ Repertoire :: class ) : return $ this -> metaRepository -> findAssociationRepertoireByID ( $ entity -> getID ( ) ) ; break ; case is_a ( $ entity , \ RGU \ Dvoconnector \ Domain \ Model \ Meta \ Association \ Category :: class ) : return $ this -> metaRepository -> findAssociationCategoryByID ( $ entity -> getID ( ) ) ; break ; case is_a ( $ entity , \ RGU \ Dvoconnector \ Domain \ Model \ Meta \ Association \ Performancelevel :: class ) : return $ this -> metaRepository -> findAssociationPerformancelevelByID ( $ entity -> getID ( ) ) ; break ; case is_a ( $ entity , \ RGU \ Dvoconnector \ Domain \ Model \ Meta \ Event \ Type :: class ) : return $ this -> metaRepository -> findEventTypeByID ( $ entity -> getID ( ) ) ; break ; default : $ classSchema = $ this -> reflectionService -> getClassSchema ( get_class ( $ entity ) ) ; foreach ( $ classSchema -> getProperties ( ) as $ propertyName => $ propertyDefinition ) { switch ( true ) { case is_a ( $ propertyDefinition [ 'type' ] , \ TYPO3 \ CMS \ Extbase \ Persistence \ ObjectStorage :: class , true ) : $ objectStorage = $ entity -> _getProperty ( $ propertyName ) ; $ newObjectStorage = new \ TYPO3 \ CMS \ Extbase \ Persistence \ ObjectStorage ( ) ; $ objectStorage -> rewind ( ) ; while ( $ objectStorage -> valid ( ) ) { $ subEntity = $ objectStorage -> current ( ) ; if ( ! is_null ( $ subEntity ) ) { $ newSubEntity = $ this -> recursivCompleteEntity ( $ subEntity ) ; if ( $ newSubEntity ) { $ newObjectStorage -> attach ( $ newSubEntity ) ; } else { $ newObjectStorage -> attach ( $ subEntity ) ; } } $ objectStorage -> next ( ) ; } $ entity -> _setProperty ( $ propertyName , $ newObjectStorage ) ; break ; case is_a ( $ propertyDefinition [ 'type' ] , \ TYPO3 \ CMS \ Extbase \ DomainObject \ AbstractEntity :: class , true ) : $ subEntity = $ entity -> _getProperty ( $ propertyName ) ; if ( ! is_null ( $ subEntity ) ) { $ newSubEntity = $ this -> recursivCompleteEntity ( $ subEntity ) ; $ entity -> _setProperty ( $ propertyName , $ newSubEntity ) ; } break ; } } return $ entity ; break ; } }
complete a entity
25,355
protected static function prepareDate ( $ date ) { if ( null === $ date ) { return null ; } if ( $ date instanceof DateTime ) { return static :: timeToString ( $ date -> getTimestamp ( ) ) ; } elseif ( is_numeric ( $ date ) ) { return static :: timeToString ( $ date ) ; } elseif ( is_array ( $ date ) ) { return @ $ date [ 'date' ] ; } elseif ( self :: hasTimestamp ( $ date ) ) { return static :: timeToString ( $ date -> getTimestamp ( ) ) ; } elseif ( is_string ( $ date ) ) { return false !== strtotime ( $ date ) ? $ date : null ; } return null ; }
Prepara data para validar .
25,356
public function generate ( string $ resourceId , string $ thumbId , $ quality = 100 ) { $ setting = $ this -> getThumbSettings ( $ thumbId ) ; $ this -> setThumbFolderName ( $ setting ) ; $ resource = $ this -> getResource ( $ resourceId ) ; $ file = $ this -> getOriginalFile ( $ resource ) ; if ( $ file ) { $ image = $ this -> resizeImage ( $ file , $ setting ) ; $ image -> encode ( 'jpg' , $ quality ) ; $ image -> save ( $ this -> getLocation ( $ resource ) ) ; } }
Generate thumb by given params
25,357
protected function getOriginalFile ( $ resource ) { $ file = null ; $ path = storage_path ( 'app/' . $ resource -> path ) ; if ( ! File :: exists ( $ path ) ) { HCLog :: error ( 'R-THUMB-001' , 'File not found at path: ' . $ path ) ; } else if ( $ resource -> isImage ( ) || strpos ( $ resource -> mime_type , 'svg' ) !== false ) { $ file = File :: get ( $ path ) ; } return $ file ; }
Get original file instance
25,358
protected function resizeImage ( $ file , $ setting ) { $ image = ImageManagerStatic :: make ( $ file ) ; if ( $ setting -> fit === "1" ) { $ image -> fit ( $ setting -> width , $ setting -> height , function ( $ constraint ) use ( $ setting ) { $ constraint -> upsize ( ) ; } ) ; } else { $ image -> resize ( $ setting -> width , $ setting -> height , function ( $ constraint ) use ( $ setting ) { $ constraint -> aspectRatio ( ) ; $ constraint -> upsize ( ) ; } ) ; } return $ image ; }
Resize image by given settings
25,359
protected function setThumbFolderName ( $ setting ) { $ name = getThumbName ( $ setting ) ; $ this -> thumbsFolder = storage_path ( 'app/public/thumbs/' . $ name . DIRECTORY_SEPARATOR ) ; $ this -> createThumbsFolder ( $ this -> thumbsFolder ) ; }
Get thumb folder name
25,360
public function filter ( EventInterface $ event ) { $ result = $ this -> filter -> filter ( $ event ) ; if ( $ result === null ) { return null ; } return ! $ result ; }
Filters events that do not pass the contained filter .
25,361
public static function get_instance ( ) { if ( self :: $ _entityManager === null ) { self :: initConfig ( ) ; $ config = Setup :: createAnnotationMetadataConfiguration ( self :: $ settings [ 'entidades' ] , self :: $ settings [ 'isDevMod' ] ) ; $ config -> addCustomStringFunction ( 'group_concat' , 'Oro\ORM\Query\AST\Functions\String\GroupConcat' ) ; $ config -> addCustomNumericFunction ( 'hour' , 'Oro\ORM\Query\AST\Functions\SimpleFunction' ) ; $ config -> addCustomNumericFunction ( 'timestampdiff' , 'Oro\ORM\Query\AST\Functions\Numeric\TimestampDiff' ) ; $ config -> addCustomDatetimeFunction ( 'date' , 'Oro\ORM\Query\AST\Functions\SimpleFunction' ) ; self :: $ _entityManager = Em :: create ( self :: $ settings [ 'dbParams' ] , $ config ) ; } return self :: $ _entityManager ; }
Retorna \ Doctrine \ ORM \ EntityManager
25,362
protected function create_color ( $ hex , $ alpha ) { extract ( $ this -> create_hex_color ( $ hex ) ) ; return new \ ImagickPixel ( 'rgba(' . $ red . ', ' . $ green . ', ' . $ blue . ', ' . round ( $ alpha / 100 , 2 ) . ')' ) ; }
Creates a new color usable by Imagick .
25,363
public function getLeflersLaw ( $ number = null ) : string { return in_array ( $ number , array_keys ( $ this -> theLaws ) ) ? $ this -> theLaws [ $ number ] : $ this -> theLaws [ array_rand ( $ this -> theLaws , 1 ) ] ; }
Lefler s Laws .
25,364
public static function getInstance ( $ key = 'default' , array $ params = [ ] ) { $ class = get_called_class ( ) ; if ( isset ( static :: $ _instances [ $ class ] [ $ key ] ) ) { return static :: $ _instances [ $ class ] [ $ key ] ; } $ reflection = new ReflectionClass ( $ class ) ; $ object = $ reflection -> newInstanceArgs ( $ params ) ; static :: $ _instances [ $ class ] [ $ key ] = $ object ; return $ object ; }
Return an object instance else instantiate a new one .
25,365
public function renderJs ( ) { $ jsLines = "\n" ; if ( $ this -> getView ( ) -> assetBundles ) { foreach ( $ this -> getView ( ) -> assetBundles as $ assetBundle ) { if ( ! $ assetBundle -> sourcePath ) { foreach ( $ assetBundle -> js as $ jsFile ) { $ jsLines .= "\n" . Html :: jsFile ( $ jsFile , $ assetBundle -> jsOptions ) ; } } } } if ( $ this -> getView ( ) -> jsFiles ) { foreach ( $ this -> getView ( ) -> jsFiles as $ jsFiles ) { $ jsLines .= implode ( "\n" , $ jsFiles ) ; } } if ( $ this -> getView ( ) -> js ) { foreach ( $ this -> getView ( ) -> js as $ js ) { $ jsLines .= implode ( "\n" , $ js ) ; } } return $ jsLines ; }
render js in page
25,366
public function calculate ( ) { $ this -> rolls = array ( ) ; $ this -> equation = preg_replace_callback ( "/(?P<count>\d+)d(?P<sides>\d+)/i" , "self::_expand_equation" , $ this -> input ) ; $ this -> result = @ eval ( "return $this->equation;" ) ; return $ this ; }
Calculate the results based on the user input
25,367
private function _validate ( $ input ) { if ( ! is_string ( $ input ) && ! is_numeric ( $ input ) ) { throw new \ Exception ( "Input must be an equation or a number." ) ; } if ( trim ( $ input ) === '' ) { throw new \ Exception ( "Input can't be blank." ) ; } if ( ! preg_match ( "/^[\(\s]*(([1-9][0-9]*d[1-9][0-9]*)|\d+)[\s\)]*(\s*([\-\+\*\/])[\s\(]*(([1-9][0-9]*d[1-9][0-9]*)|\d+)\)*)*$/i" , $ input ) ) { throw new \ Exception ( "Invalid equation." ) ; } if ( ! $ this -> _is_balanced ( $ input ) ) { throw new \ Exception ( "Unbalanced parens." ) ; } $ this -> input = $ input ; }
Validate user input
25,368
private function _is_balanced ( $ input ) { $ balance = 0 ; foreach ( str_split ( $ input ) as $ char ) { if ( $ char == '(' ) { $ balance ++ ; } else if ( $ char == ')' ) { $ balance -- ; } if ( $ balance < 0 ) { break ; } } return $ balance === 0 ; }
Check if equation has balanced parens
25,369
private function _expand_equation ( $ matches ) { $ rolls = array ( ) ; for ( $ i = 0 ; $ i < $ matches [ 'count' ] ; $ i ++ ) { $ rolls [ ] = mt_rand ( 1 , $ matches [ 'sides' ] ) ; } $ this -> rolls [ ] = array ( 'notation' => $ matches [ 0 ] , 'rolls' => $ rolls ) ; return "(" . implode ( " + " , $ rolls ) . ")" ; }
Roll dice and expand the input into a matching equation
25,370
protected function tearDown ( ) { if ( $ this -> _logger -> isHandling ( ehough_epilog_Logger :: DEBUG ) ) { $ this -> _logger -> debug ( 'Closing cURL' ) ; } if ( isset ( $ this -> _handle ) ) { curl_close ( $ this -> _handle ) ; unset ( $ this -> _handle ) ; } }
Perform optional tear down after handling a request .
25,371
public function add ( $ item ) { if ( is_array ( $ item ) ) { foreach ( $ item as $ element ) { $ this -> add ( $ element ) ; } } else if ( ! $ this -> contains ( $ item -> path ( ) ) ) { $ this -> items [ $ item -> path ( ) ] = [ 'instance' => $ item , 'listener_index' => $ item -> addPathListener ( [ $ this , 'updatePath' ] ) ] ; } return $ this ; }
Adds new items to the collection . If an item already exists It will be ignored .
25,372
public function updatePath ( $ oldPath , $ newPath ) { if ( $ this -> contains ( $ oldPath ) ) { $ this -> items [ $ newPath ] = $ this -> items [ $ oldPath ] ; unset ( $ this -> items [ $ oldPath ] ) ; } }
This is called when the path of an item is changed It updates the paths array by replacing the old path with the new one .
25,373
public function files ( ) { $ filesList = array_filter ( $ this -> items , function ( $ item ) { return ( $ item [ 'instance' ] instanceof FileInterface ) ; } ) ; $ filesList = array_map ( function ( $ item ) { return $ item [ 'instance' ] ; } , $ filesList ) ; return new Collection ( $ filesList ) ; }
Returns a new collection containing only files .
25,374
public function dirs ( ) { $ filesList = array_filter ( $ this -> items , function ( $ item ) { return ( $ item [ 'instance' ] instanceof DirectoryInterface ) ; } ) ; $ filesList = array_map ( function ( $ item ) { return $ item [ 'instance' ] ; } , $ filesList ) ; return new Collection ( $ filesList ) ; }
Returns a new collection containing only directories .
25,375
public function remove ( $ path ) { if ( $ this -> contains ( $ path ) ) { $ item = $ this -> items [ $ path ] ; $ item [ 'instance' ] -> removePathListener ( $ item [ 'listener_index' ] ) ; unset ( $ this -> items [ $ path ] ) ; } return $ this ; }
Removes a file or directory from the collection .
25,376
public static function set ( $ driver , $ host , $ database , $ user , $ password , $ prefixing , $ prefix ) { $ default = self :: dbRow ( 'default' , "'default' => '$driver', " ) ; switch ( $ driver ) { case 'mysql' : $ connections = self :: mysqlConnections ( $ host , $ database , $ user , $ password ) ; break ; } $ connections = self :: dbRow ( 'connections' , $ connections ) ; $ table = self :: dbRow ( 'table' , "'migration' => 'vinala_migrations'," ) ; $ prefixing = self :: dbRow ( 'prefixing' , "'prefixing' => $prefixing ," ) ; $ prefixe = self :: dbRow ( 'prefixe' , "'prefixe' => '" . $ prefix . "_'," ) ; return "<?php\n\nreturn [\n\t" . $ default . $ connections . $ table . $ prefixing . $ prefixe . "\n];" ; }
set database config file .
25,377
public function getParameter ( $ parameter ) { $ value = NULL ; if ( $ parameter != NULL ) { if ( isset ( $ this -> params [ $ parameter ] ) ) { $ value = $ this -> params [ $ parameter ] ; } } if ( is_null ( $ value ) ) { if ( isset ( $ _POST [ $ parameter ] ) ) { $ value = $ _POST [ $ parameter ] ; } } if ( is_null ( $ value ) ) { if ( isset ( $ _GET [ $ parameter ] ) ) { $ value = $ _GET [ $ parameter ] ; } } if ( is_string ( $ value ) ) { $ value = urldecode ( $ value ) ; } return $ value ; }
Retorna el valor del parametro . Si no existe retorna NULL .
25,378
protected function addValue ( $ value ) { $ name = 'where' . $ this -> whereContainer -> getBindingCount ( ) ; $ this -> values [ $ name ] = $ value ; return ':' . $ name ; }
Add a value to the value list
25,379
public function loadDatabaseMapping ( ItemMetaData $ itemMetaData ) { $ databaseMapping = array ( ) ; foreach ( $ itemMetaData -> getEntityIdentifiers ( ) as $ entityKey => $ entityIdentifier ) { $ tableAlias = 't' . $ entityKey ; $ databaseMapping [ $ entityIdentifier ] = $ this -> loadEntity ( $ entityIdentifier , $ tableAlias , $ itemMetaData ) ; } return $ databaseMapping ; }
Loads the database mapping for the specified item
25,380
protected function loadEntity ( $ entityIdentifier , $ tableAlias , $ itemMetaData ) { $ entityMetaData = $ this -> em -> getMetadataFactory ( ) -> getMetadataFor ( $ itemMetaData -> getEntityClass ( $ entityIdentifier ) ) ; $ table = $ entityMetaData -> getTableName ( ) ; $ joins = array ( ) ; $ columns = array ( ) ; foreach ( $ itemMetaData -> getOrderedRequiredHits ( ) as $ hitPos => $ hitIdentifier ) { if ( $ hitIdentifier == ItemMetaData :: TYPE ) { $ columns [ $ hitPos ] = array ( 'expression' => '\'' . $ entityIdentifier . '\'' , 'type' => Type :: STRING , 'scoreFactor' => 0 ) ; } elseif ( $ hitIdentifier != ItemMetaData :: SCORE ) { $ attribute = $ itemMetaData -> getHitEntityAttribute ( $ hitIdentifier , $ entityIdentifier ) ; $ columns [ $ hitPos ] = array ( ) ; $ this -> loadEntityHit ( $ columns [ $ hitPos ] , $ joins , $ tableAlias , $ itemMetaData -> getEntityClass ( $ entityIdentifier ) , $ attribute ) ; $ hitScoreFactors = $ itemMetaData -> getHitScoreFactors ( ) ; $ columns [ $ hitPos ] [ 'scoreFactor' ] = isset ( $ hitScoreFactors [ $ hitIdentifier ] ) ? $ hitScoreFactors [ $ hitIdentifier ] : 0 ; } } return array ( 'table' => $ table , 'tableAlias' => $ tableAlias , 'joins' => $ joins , 'columns' => $ columns ) ; }
Loads the database mapping for the specified entity
25,381
public function getProviders ( PaymentServiceProvider $ psp = null ) { if ( ! is_null ( $ psp ) ) { foreach ( $ this -> providers as $ ppf ) { if ( $ ppf -> getSlug ( ) == $ psp -> getSlug ( ) ) { return $ ppf ; } } } return $ this -> providers ; }
Return ArrayCollection of PaymentProviderFactory
25,382
public function savedetailsAction ( Request $ request ) { $ user = $ this -> getUser ( ) -> setFirstname ( $ request -> request -> get ( 'firstname' ) ) -> setLastname ( $ request -> request -> get ( 'lastname' ) ) -> setEmail ( $ request -> request -> get ( 'email' ) ) ; $ this -> get ( 'phlexible_user.user_manager' ) -> updateUser ( $ user ) ; return new ResultResponse ( true , 'User details saved.' ) ; }
Save details .
25,383
public function savepasswordAction ( Request $ request ) { $ user = $ this -> getUser ( ) ; if ( $ request -> request -> has ( 'password' ) ) { $ user -> setPlainPassword ( $ request -> request -> get ( 'password' ) ) ; } $ this -> get ( 'phlexible_user.user_manager' ) -> updateUser ( $ user ) ; return new ResultResponse ( true , 'User password saved.' ) ; }
Save password .
25,384
protected function postUpdateActions ( $ type , $ downloadPath , PackageInterface $ package ) { switch ( $ type ) { case 'pff2-module' : $ this -> moveConfiguration ( $ downloadPath , $ package ) ; $ this -> updatePff ( ) ; break ; case 'pff2-core' : $ this -> updatePff ( ) ; break ; } }
Performs actions on the updated files after an installation or update
25,385
public static function get ( $ name ) { $ class = get_called_class ( ) ; if ( ! isset ( self :: $ instance [ $ class ] ) ) { self :: $ instance [ $ class ] = new static ( ) ; } return self :: $ instance [ $ class ] -> getExtensions ( ) -> get ( $ name ) ; }
Get an extension
25,386
public static function getAll ( ) { $ class = get_called_class ( ) ; if ( ! isset ( self :: $ instance [ $ class ] ) ) { self :: $ instance [ $ class ] = new static ( ) ; } return self :: $ instance [ $ class ] -> getExtensions ( ) ; }
Get all extension
25,387
protected function processComparison ( $ query , Comparison $ comparison ) { $ subject = self :: translateColumnName ( $ query , $ comparison ) ; $ value = self :: translateParameter ( $ query , $ comparison -> getValue ( ) ) ; $ operator = $ comparison -> getOperator ( ) ; switch ( $ operator ) { case Operator :: SEARCH : $ value = '%' . $ value . '%' ; $ operator = 'LIKE' ; break ; } $ query -> where ( $ subject , $ operator , $ value ) ; }
Process a single comparison
25,388
protected function getEntityTable ( $ subject ) { if ( ! isset ( $ this -> tableNames [ $ subject ] ) ) { $ this -> tableNames [ $ subject ] = $ this -> resolveEntityTable ( $ subject ) ; } return $ this -> tableNames [ $ subject ] ; }
Translate a parameter subject and translate it to the table name
25,389
public function registerHook ( $ callback ) { if ( ! is_callable ( $ callback ) ) { throw new \ Exception ( 'Callback not callable' ) ; } if ( in_array ( $ callback , $ this -> callbacks ) ) { throw new \ Exception ( 'Callback already registered' ) ; } $ this -> callbacks [ ] = $ callback ; return $ this ; }
Register a new callback for this hook .
25,390
public function triggerHook ( $ params = NULL ) { if ( ! isset ( $ params ) ) { $ params = array ( 0 => null , ) ; } else if ( ! is_array ( $ params ) ) { $ params = array ( 0 => $ params , ) ; } foreach ( $ this -> callbacks as $ callback ) { $ r = call_user_func_array ( $ callback , $ params ) ; if ( $ r !== NULL ) { $ params [ 0 ] = $ r ; } } return isset ( $ params [ 0 ] ) ? $ params [ 0 ] : null ; }
Trigger this hook .
25,391
public static function create ( $ name ) { $ name = static :: slug ( $ name ) ; static :: $ hooks [ $ name ] = new static ( $ name ) ; return self :: $ hooks [ $ name ] ; }
Create new Hook
25,392
public static function trigger ( $ name , $ silent = false ) { $ name = static :: slug ( $ name ) ; $ firstParam = null ; if ( ! is_bool ( $ silent ) ) { $ firstParam = $ silent ; $ silent = false ; } if ( empty ( static :: $ hooks [ $ name ] ) ) { if ( $ silent ) { return ; } throw new \ Exception ( 'No hook with this name' ) ; } $ params = null ; if ( func_num_args ( ) > 2 ) { $ params = func_get_args ( ) ; unset ( $ params [ 0 ] , $ params [ 1 ] ) ; if ( isset ( $ firstParam ) ) { $ params [ 0 ] = $ firstParam ; } $ params = array_values ( $ params ) ; } return static :: $ hooks [ $ name ] -> triggerHook ( $ params ) ; }
Trigger a hook by name
25,393
public function getByIds ( array $ ids ) { if ( empty ( $ ids ) ) { return null ; } $ parameters = array ( 'api_action' => 'list_list' , 'ids' => implode ( ',' , $ ids ) ) ; $ response = $ this -> request ( $ parameters ) ; if ( $ response === null || $ response -> getStatusCode ( ) !== 200 ) { return null ; } $ json = $ response -> getBody ( ) -> getContents ( ) ; return $ this -> serializer -> deserialize ( $ this -> removeResultInformation ( $ json ) , 'array<integer, ' . \ FondOfPHP \ ActiveCampaign \ DataTransferObject \ MailingList :: class . '>' , 'json' ) ; }
Get multiple mailing lists by ids
25,394
public function details ( $ useIndex = false ) { $ details = [ ] ; foreach ( $ this -> names ( ) as $ index => $ name ) { if ( $ useIndex ) $ idx = $ index ; else $ idx = $ name ; $ details [ $ idx ] [ 'name' ] = $ name ; $ details [ $ idx ] [ 'index' ] = $ index ; $ details [ $ idx ] [ 'description' ] = $ this -> descriptions ( ) [ $ index ] ; $ details [ $ idx ] [ 'hasDeviceState' ] = $ this -> deviceStates ( ) [ $ index ] ; $ details [ $ idx ] [ 'hasProgressIndications' ] = $ this -> progressIndications ( ) [ $ index ] ; $ details [ $ idx ] [ 'canTransfer' ] = $ this -> transfers ( ) [ $ index ] ; $ details [ $ idx ] [ 'activeCalls' ] = $ this -> activeCalls ( ) [ $ index ] ; } return $ details ; }
Utility function to gather channel details together in an associative array .
25,395
public function setAboutMe ( $ aboutMe = null ) { if ( ( $ this -> getMajorProtocolVersion ( ) == null ) || ( $ this -> getMajorProtocolVersion ( ) == 1 ) ) { require_once 'Zend/Gdata/App/VersionException.php' ; throw new Zend_Gdata_App_VersionException ( 'The setAboutMe ' . ' method is only supported as of version 2 of the YouTube ' . 'API.' ) ; } else { $ this -> _aboutMe = $ aboutMe ; return $ this ; } }
Sets the content of the about me field .
25,396
public function setFirstName ( $ firstName = null ) { if ( ( $ this -> getMajorProtocolVersion ( ) == null ) || ( $ this -> getMajorProtocolVersion ( ) == 1 ) ) { require_once 'Zend/Gdata/App/VersionException.php' ; throw new Zend_Gdata_App_VersionException ( 'The setFirstName ' . ' method is only supported as of version 2 of the YouTube ' . 'API.' ) ; } else { $ this -> _firstName = $ firstName ; return $ this ; } }
Sets the content of the first name field .
25,397
public function setLastName ( $ lastName = null ) { if ( ( $ this -> getMajorProtocolVersion ( ) == null ) || ( $ this -> getMajorProtocolVersion ( ) == 1 ) ) { require_once 'Zend/Gdata/App/VersionException.php' ; throw new Zend_Gdata_App_VersionException ( 'The setLastName ' . ' method is only supported as of version 2 of the YouTube ' . 'API.' ) ; } else { $ this -> _lastName = $ lastName ; return $ this ; } }
Sets the content of the last name field .
25,398
public function create ( $ context ) { $ providerManager = $ this -> providerService -> getProviderManager ( $ context ) ; $ media = $ this -> mediaManager -> createMedia ( $ context ) ; $ mediaProvider = $ providerManager -> getMediaProviderManager ( ) -> createMediaProvider ( ) ; $ mediaProvider -> setMedia ( $ media ) ; return $ mediaProvider ; }
Create an empty instance of the MediaProvider by the context
25,399
public function push ( ShortMessage $ shortMessage ) { if ( $ shortMessage -> hasManyReceivers ( ) ) { throw new \ LogicException ( "Expected one receiver per short message, got many." ) ; } $ this -> items [ ] = $ shortMessage ; return $ this ; }
Push a new short message to the given collection .