idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
4,700
function getColumnValue ( $ column_name ) { return isset ( $ this -> last_row [ $ column_name ] ) ? $ this -> last_row [ $ column_name ] : null ; }
Get value from column from last row
4,701
public function member ( $ memberId ) { if ( isset ( $ this -> info [ 'memberList' ] [ $ memberId ] ) ) { return $ this -> info [ 'memberList' ] [ $ memberId ] ; } return null ; }
Attempts to get a member by the member id .
4,702
public function isMethod ( $ methods ) { if ( is_array ( $ methods ) ) { return in_array ( $ this -> getMethod ( ) , $ methods ) ; } if ( is_string ( $ methods ) ) { return ( $ this -> getMethod ( ) == $ methods ) ; } return false ; }
Check if HTTP method match any of the passed methods
4,703
public function getMediaType ( ) { $ contentType = $ this -> getServer ( 'CONTENT_TYPE' ) ; if ( ! empty ( $ contentType ) ) { if ( $ parts = explode ( ';' , $ contentType ) ) { return trim ( $ parts [ 0 ] ) ; } } return '' ; }
Get request media type
4,704
protected function getQualityHeader ( $ serverIndex , $ name ) { $ httpServer = $ this -> getHeaderLine ( $ serverIndex ) ; $ parts = preg_split ( '/,\\s*/' , $ httpServer ) ; $ output = [ ] ; foreach ( $ parts as $ part ) { $ headerParts = explode ( ';' , $ part ) ; if ( isset ( $ headerParts [ 1 ] ) ) { $ qualityPart...
Process a request header and return an array of values with their qualities
4,705
protected function getPreferredQuality ( array $ qualityParts , $ name ) { $ i = 0 ; $ quality = 0 ; $ selectedName = '' ; foreach ( $ qualityParts as $ accept ) { if ( $ i == 0 ) { $ quality = $ accept [ 'quality' ] ; $ selectedName = $ accept [ $ name ] ; } else { $ acceptQuality = $ accept [ 'quality' ] ; $ preferre...
Process a request header and return the one with preferred quality
4,706
protected function prepareUploadedFiles ( $ files ) { $ fileKeys = [ 'error' , 'name' , 'size' , 'tmp_name' , 'type' ] ; $ reformatFiles = new ReformatUploadedFiles ( $ files ) ; $ output = [ ] ; foreach ( $ reformatFiles as $ key => $ value ) { $ keys = array_keys ( $ value ) ; sort ( $ keys ) ; if ( $ fileKeys == $ k...
Prepare uploaded files
4,707
protected function prepareHeaders ( $ server ) { $ output = [ ] ; if ( ! is_array ( $ server ) ) { return $ output ; } foreach ( $ server as $ key => $ value ) { if ( is_string ( $ key ) && strlen ( $ key ) > 5 && strpos ( $ key , 'HTTP_' ) !== false ) { $ output [ substr ( $ key , 5 ) ] = $ value ; } } return $ output...
Returns the available headers in the request
4,708
protected function prepareParsedBody ( ) { if ( $ this -> method == self :: METHOD_POST && in_array ( $ this -> getMediaType ( ) , [ 'application/x-www-form-urlencoded' , 'multipart/form-data' ] ) ) { return $ _POST ; } else { $ body = ( string ) $ this -> getBody ( ) ; switch ( $ this -> getMediaType ( ) ) { case 'app...
Prepare parsed body
4,709
protected function addPostField ( $ key ) { if ( property_exists ( $ this , $ key ) ) { $ this -> postFields [ $ key ] = $ this -> $ key ; } }
Set a post field to be send to the server ; lookup the value from the key
4,710
protected function detectInvalidJsonFields ( ) { if ( json_encode ( $ this -> postFields ) === false ) { $ invalidFields = array ( ) ; foreach ( $ this -> postFields as $ key => $ value ) { if ( json_encode ( $ value ) === false ) { $ invalidFields [ ] = $ key ; } } throw new EntityException ( 'Invalid data found in fi...
Detect invalid json fields in entity and throw exception when found
4,711
public function setFields ( array $ fields ) { foreach ( $ fields as $ field => $ value ) { if ( property_exists ( $ this , $ field ) ) { $ this -> { $ field } = $ value ; } } if ( isset ( $ fields [ '_embedded' ] ) ) { foreach ( $ fields [ '_embedded' ] as $ embeddedType => $ embeddedValue ) { if ( property_exists ( $...
Set fields from api response
4,712
public function team ( $ identities ) { if ( is_array ( $ identities ) ) { if ( count ( $ identities ) > 10 ) { throw new ListMaxException ( 'This request can only support a list of 10 elements, ' . count ( $ identities ) . ' given.' ) ; } } $ ids = $ this -> extractIds ( $ identities ) ; $ ids = implode ( ',' , $ ids ...
Gets the team information by summoner id or list of summoner ids .
4,713
protected function backupSwitchState ( ) { if ( $ this -> renderingContext -> getViewHelperVariableContainer ( ) -> exists ( \ TYPO3 \ Fluid \ ViewHelpers \ SwitchViewHelper :: class , 'switchExpression' ) ) { $ this -> backupSwitchExpression = $ this -> renderingContext -> getViewHelperVariableContainer ( ) -> get ( \...
Backups switch expression and break state of a possible parent switch ViewHelper to support nesting
4,714
public function createBioVoiceRegistration ( $ recipient , $ language = null , $ webHook = null ) { $ bioVoiceRegistration = $ this -> factory -> createBioVoiceRegistration ( $ recipient , $ language , $ webHook ) ; return $ bioVoiceRegistration ; }
Create bio voice registration for the supplied recipient
4,715
public function createTotp ( $ identifier , $ issuer = null ) { $ totp = $ this -> factory -> createTotp ( $ identifier , $ issuer ) ; return $ totp ; }
Create TOTP secret
4,716
public function createWidgetSession ( array $ allowedTypes = null , $ recipient = null , $ backupCodeIdentifier = null , $ totpIdentifier = null , $ issuer = null ) { $ widgetSession = $ this -> factory -> createWidgetSession ( $ allowedTypes , $ recipient , $ backupCodeIdentifier , $ totpIdentifier , $ issuer ) ; retu...
Create widget session with the supplied data
4,717
public function createWidgetRegisterSession ( array $ allowedTypes = null , $ recipient = null , $ backupCodeIdentifier = null , $ totpIdentifier = null , $ issuer = null ) { $ widgetRegisterSession = $ this -> factory -> createWidgetRegisterSession ( $ allowedTypes , $ recipient , $ backupCodeIdentifier , $ totpIdenti...
Create widget register session with the supplied data
4,718
public function getBackupCode ( $ identifier ) { $ backupCode = $ this -> factory -> createEmptyBackupCode ( ) ; $ backupCode -> populate ( $ identifier ) ; return $ backupCode ; }
Get backup code status for the supplied identifier
4,719
public function getBioVoiceRegistration ( $ registrationId ) { $ bioVoiceRegistration = $ this -> factory -> createEmptyBioVoiceRegistration ( ) ; $ bioVoiceRegistration -> populate ( $ registrationId ) ; return $ bioVoiceRegistration ; }
Get bio voice registration status for the supplied registrationId
4,720
public function getBioVoiceSubscription ( $ recipient ) { $ bioVoiceSubscription = $ this -> factory -> createEmptyBioVoiceSubscription ( ) ; $ bioVoiceSubscription -> populate ( $ recipient ) ; return $ bioVoiceSubscription ; }
Get bio voice subscription status for the supplied recipient
4,721
public static function getInstance ( $ secret , $ apiHost ) { if ( ! isset ( self :: $ instances [ $ secret ] [ $ apiHost ] ) ) { self :: $ instances [ $ secret ] [ $ apiHost ] = new self ( new Entity \ Factory ( new Client \ Curl ( $ secret , $ apiHost ) ) ) ; } return self :: $ instances [ $ secret ] [ $ apiHost ] ; ...
Get a new Twizo instance
4,722
public function getNumberLookup ( $ messageId ) { $ numberLookup = $ this -> factory -> createEmptyNumberLookup ( ) ; $ numberLookup -> populate ( $ messageId ) ; return $ numberLookup ; }
Get number lookup status for the supplied message id
4,723
public function getNumberLookupResults ( ) { $ numberLookupPoll = $ this -> factory -> createNumberLookupPoll ( ) ; $ numberLookupPoll -> send ( ) ; $ resultList = array ( ) ; foreach ( $ numberLookupPoll -> getMessages ( ) as $ message ) { $ resultList [ ] = $ numberLookup = $ this -> factory -> createEmptyNumberLooku...
Get number lookup polling results ; returns only results for messages which have result type polling enabled
4,724
public function getSms ( $ messageId ) { $ sms = $ this -> factory -> createEmptySms ( ) ; $ sms -> populate ( $ messageId ) ; return $ sms ; }
Get sms status for the supplied message id
4,725
public function getSmsResults ( ) { $ smsPoll = $ this -> factory -> createSmsPoll ( ) ; $ smsPoll -> send ( ) ; $ resultList = array ( ) ; foreach ( $ smsPoll -> getMessages ( ) as $ message ) { $ resultList [ ] = $ sms = $ this -> factory -> createEmptySms ( ) ; $ sms -> setFields ( $ message ) ; } $ smsPoll -> delet...
Get sms polling results ; returns only results for messages which have result type polling enabled
4,726
public function getTokenResult ( $ messageId , $ token ) { $ verification = $ this -> factory -> createEmptyVerification ( ) ; $ verification -> verify ( $ token , $ messageId ) ; return $ verification ; }
Verify token and return the verification object when successfully verified ; otherwise return an exception
4,727
public function getTotp ( $ identifier ) { $ totp = $ this -> factory -> createEmptyTotp ( ) ; $ totp -> populate ( $ identifier ) ; return $ totp ; }
Get totp status for the supplied identifier
4,728
public function getVerification ( $ messageId ) { $ verification = $ this -> factory -> createEmptyVerification ( ) ; $ verification -> populate ( $ messageId ) ; return $ verification ; }
Get verification status for the supplied message id
4,729
public function getWidgetSession ( $ sessionToken , $ recipient = null , $ backupCodeIdentifier = null , $ totpIdentifier = null ) { $ widgetSession = $ this -> factory -> createEmptyWidgetSession ( ) ; $ widgetSession -> populate ( $ sessionToken , $ recipient , $ backupCodeIdentifier , $ totpIdentifier ) ; return $ w...
Get widget session status for the supplied session token
4,730
public function getWidgetRegisterSession ( $ sessionToken ) { $ widgetRegisterSession = $ this -> factory -> createEmptyWidgetRegisterSession ( ) ; $ widgetRegisterSession -> populate ( $ sessionToken ) ; return $ widgetRegisterSession ; }
Get widget register session status for the supplied session token
4,731
public function verifyToken ( $ messageId , $ token ) { try { $ verification = $ this -> getTokenResult ( $ messageId , $ token ) ; return ( $ verification -> getStatusCode ( ) === Verification :: STATUS_SUCCESS ) ; } catch ( Exception $ e ) { return false ; } }
Verify token and return true when successful and false when there is an error
4,732
public static function convertToBoolean ( $ value ) { if ( is_bool ( $ value ) ) { return $ value ; } if ( is_numeric ( $ value ) ) { return $ value > 0 ; } if ( is_string ( $ value ) ) { return ( ! empty ( $ value ) && strtolower ( $ value ) !== 'false' ) ; } if ( is_array ( $ value ) || ( is_object ( $ value ) && $ v...
Convert argument strings to their equivalents . Needed to handle strings with a boolean meaning .
4,733
public function evaluateChildNodes ( RenderingContextInterface $ renderingContext ) { $ output = null ; foreach ( $ this -> childNodes as $ subNode ) { if ( $ output === null ) { $ output = $ subNode -> evaluate ( $ renderingContext ) ; } else { if ( is_object ( $ output ) ) { if ( ! method_exists ( $ output , '__toStr...
Evaluate all child nodes and return the evaluated results .
4,734
public static function getEntityValues ( \ Twizo \ Api \ AbstractEntity $ entity ) { $ result = array ( ) ; $ methods = get_class_methods ( $ entity ) ; sort ( $ methods ) ; foreach ( $ methods as $ method ) { if ( substr ( $ method , 0 , 3 ) == 'get' ) { $ result [ $ method ] = $ entity -> $ method ( ) ; } } return $ ...
Retrieve all getter function values from object
4,735
public static function getEntity ( \ Twizo \ Api \ AbstractEntity $ entity ) { $ result = '' ; $ values = self :: getEntityValues ( $ entity ) ; $ result .= str_repeat ( '-' , strlen ( get_class ( $ entity ) ) + 4 ) . PHP_EOL ; $ result .= '| ' . get_class ( $ entity ) . ' |' . PHP_EOL ; $ result .= str_repeat ( '-' , ...
Generate string with entity class name and a list of the entity values
4,736
public function run ( $ command , array $ args = array ( ) ) { $ replacements = array ( ) ; foreach ( $ args as $ key => $ arg ) { $ replacements [ '%' . $ key . '%' ] = ProcessUtils :: escapeArgument ( $ arg ) ; } $ fullCommand = sprintf ( '%s %s --no-ansi -vv' , $ this -> puli , strtr ( $ command , $ replacements ) )...
Runs a Puli command .
4,737
private function loadComposerPackages ( ) { $ repository = $ this -> composer -> getRepositoryManager ( ) -> getLocalRepository ( ) ; $ packages = array ( ) ; foreach ( $ repository -> getPackages ( ) as $ package ) { $ packages [ $ package -> getName ( ) ] = $ package ; } return $ packages ; }
Loads Composer s currently installed packages .
4,738
public function setReferenceTime ( \ DateTimeInterface $ dateTime ) { $ dt = $ dateTime -> format ( DATE_ISO8601 ) ; $ this -> add ( 'reference_time' , $ dt ) ; }
Set the reference time in ISO8601 format
4,739
private function applyPreset ( $ presetAfterUpload , $ file ) { foreach ( $ presetAfterUpload as $ preset ) { $ this -> model -> thumbUrl ( $ this -> attribute , $ preset , $ file ) ; } }
Apply preset for file
4,740
private function generateThumb ( $ attribute , $ preset , $ path ) { $ thumbPath = pathinfo ( $ path , PATHINFO_FILENAME ) ; $ thumbPath = str_replace ( $ thumbPath , $ preset . '_' . $ thumbPath , $ path ) ; $ realPath = $ this -> fileStorage ( $ attribute ) -> path ; if ( ! file_exists ( $ realPath . $ thumbPath ) &&...
Generate a thumb
4,741
private function templatePath ( $ attribute , $ file = null ) { $ value = $ this -> owner -> { $ attribute } ; $ saveFilePath = $ this -> fileOption ( $ attribute , 'saveFilePathInAttribute' ) ; $ isFilledPath = $ saveFilePath && ! empty ( $ value ) ; $ saveFileId = $ this -> fileOption ( $ attribute , 'saveFileIdInAtt...
Generate file path by template
4,742
public function fileOption ( $ attribute , $ option , $ defaultValue = null ) { return ArrayHelper :: getValue ( $ this -> attributes [ $ attribute ] , $ option , $ defaultValue ) ; }
Get file option
4,743
public function fileUrl ( $ attribute , $ file = null ) { $ path = $ this -> templatePath ( $ attribute , $ file ) ; return Yii :: getAlias ( $ this -> fileOption ( $ attribute , 'baseUrl' ) ) . $ path ; }
Get file url
4,744
public function fileExtraFields ( $ attribute ) { $ fields = $ this -> fileBind -> relations ( $ this -> owner , $ attribute ) ; if ( ! $ this -> fileOption ( $ attribute , 'multiple' ) ) { return array_shift ( $ fields ) ; } return $ fields ; }
Get extra fields of file
4,745
public function fileState ( $ attribute ) { $ state = Yii :: $ app -> session -> get ( Yii :: $ app -> fileManager -> sessionName ) ; return ArrayHelper :: getValue ( $ state === null ? [ ] : $ state , $ attribute , [ ] ) ; }
Get file state
4,746
public function filePresetAfterUpload ( $ attribute ) { $ preset = $ this -> fileOption ( $ attribute , 'applyPresetAfterUpload' , [ ] ) ; if ( is_string ( $ preset ) && $ preset === '*' ) { return array_keys ( $ this -> fileOption ( $ attribute , 'preset' , [ ] ) ) ; } return $ preset ; }
Get the presets of the file for apply after upload
4,747
public function thumbUrl ( $ attribute , $ preset , $ file = null ) { $ path = $ this -> templatePath ( $ attribute , $ file ) ; $ thumbPath = $ this -> generateThumb ( $ attribute , $ preset , $ path ) ; return Yii :: getAlias ( $ this -> fileOption ( $ attribute , 'baseUrl' ) ) . $ thumbPath ; }
Create a thumb and return url
4,748
public function thumbPath ( $ attribute , $ preset , $ file = null ) { $ path = $ this -> templatePath ( $ attribute , $ file ) ; $ thumbPath = $ this -> generateThumb ( $ attribute , $ preset , $ path ) ; return $ this -> fileStorage ( $ attribute ) -> path . $ thumbPath ; }
Create a thumb and return full path
4,749
protected function _tokenError ( $ error = 'tokenNotFound' ) { $ subject = $ this -> _subject ( [ 'success' => false ] ) ; $ this -> _trigger ( $ error , $ subject ) ; $ message = $ this -> message ( $ error , compact ( 'token' ) ) ; $ exceptionClass = $ message [ 'class' ] ; throw new $ exceptionClass ( $ message [ 't...
Throw exception if token not found or expired .
4,750
protected function mapInputToCommand ( $ command , $ input ) { if ( is_object ( $ command ) ) { return $ command ; } $ dependencies = [ ] ; $ class = new ReflectionClass ( $ command ) ; foreach ( $ class -> getConstructor ( ) -> getParameters ( ) as $ parameter ) { if ( $ parameter -> getPosition ( ) == 0 && $ paramete...
Map the input to the command
4,751
public function get ( string $ name ) : Closure { if ( ! $ this -> has ( $ name ) ) { throw new DefinitionNotFoundException ( "No breadcrumbs defined for route [{$name}]." ) ; } return $ this -> definitions [ $ name ] ; }
Get a definition for a route name .
4,752
public function set ( string $ name , Closure $ definition ) { if ( $ this -> has ( $ name ) ) { throw new DefinitionAlreadyExistsException ( "Breadcrumbs have already been defined for route [{$name}]." ) ; } $ this -> definitions [ $ name ] = $ definition ; }
Set the registration for a route name .
4,753
public function send ( $ carrier , $ phoneNumber , $ subject , $ message , $ split = FALSE ) { $ carriers = $ this -> getCarriers ( ) ; if ( empty ( $ carriers [ $ carrier ] ) ) { return 0 ; } $ phoneNumber = str_replace ( [ ' ' , '-' ] , '' , $ phoneNumber ) ; list ( $ prefix , $ suffix ) = strpos ( $ carriers [ $ car...
Sends text message
4,754
private function _mail ( $ to , $ subject , $ message ) { if ( ! $ this -> _mailer ) { $ transport = NULL ; if ( strtolower ( $ this -> transportType ) == 'php' ) { $ transport = Swift_MailTransport :: newInstance ( ) ; } elseif ( strtolower ( $ this -> transportType ) == 'smtp' ) { $ transport = \ Swift_SmtpTransport ...
Sends email in order to send text message
4,755
public function splitMessage ( $ message , $ splitLength ) { $ messages = $ this -> wordwrapArray ( $ message , $ splitLength ) ; $ total = count ( $ messages ) ; if ( $ total > 1 ) { $ count = 1 ; foreach ( $ messages as $ key => $ currMsgWrapped ) { $ messages [ $ key ] = "$currMsgWrapped ($count/$total)" ; $ count +...
Splits up messages and add counter at the end
4,756
public function wordwrapArray ( $ string , $ width ) { if ( ( $ len = mb_strlen ( $ string , 'UTF-8' ) ) <= $ width ) { return [ $ string ] ; } $ return = [ ] ; $ last_space = FALSE ; $ i = 0 ; do { if ( mb_substr ( $ string , $ i , 1 , 'UTF-8' ) == ' ' ) { $ last_space = $ i ; } if ( $ i > $ width ) { $ last_space = (...
Wordwrap in UTF - 8 supports return as array
4,757
public function register ( ) { $ this -> registerConfig ( ) ; $ this -> app -> bind ( 'Joselfonseca\LaravelTactician\Locator\LocatorInterface' , config ( 'laravel-tactician.locator' ) ) ; $ this -> app -> bind ( 'League\Tactician\Handler\MethodNameInflector\MethodNameInflector' , config ( 'laravel-tactician.inflector' ...
Do the bindings so any implementation can be swapped
4,758
protected function getFormatter ( $ options = array ( ) ) { $ locale = empty ( $ options [ 'locale' ] ) ? $ this -> locale : $ options [ 'locale' ] ; $ calendar = empty ( $ options [ 'calendar' ] ) ? $ this -> calendar : $ options [ 'calendar' ] ; $ timezone = empty ( $ options [ 'timezone' ] ) ? $ this -> getTimezone ...
Returns an instance of IntlDateFormatter with specified options .
4,759
public function setTimestamp ( $ unixtimestamp ) { $ diff = $ unixtimestamp - $ this -> getTimestamp ( ) ; $ days = floor ( $ diff / 86400 ) ; $ seconds = $ diff - $ days * 86400 ; $ timezone = $ this -> getTimezone ( ) ; $ this -> setTimezone ( 'UTC' ) ; parent :: modify ( "$days days $seconds seconds" ) ; $ this -> s...
Overrides the setTimestamp method to support timestamps out of the integer range .
4,760
public function setDate ( $ year , $ month , $ day ) { $ this -> set ( "$year/$month/$day " . $ this -> format ( 'HH:mm:ss' ) , null , 'yyyy/MM/dd HH:mm:ss' ) ; return $ this ; }
Resets the current date of the object .
4,761
public function setTimezone ( $ timezone ) { if ( ! is_a ( $ timezone , 'DateTimeZone' ) ) $ timezone = new \ DateTimeZone ( $ timezone ) ; parent :: setTimezone ( $ timezone ) ; return $ this ; }
Sets the timezone for the object .
4,762
protected function modifyCallback ( $ matches ) { if ( ! empty ( $ matches [ 1 ] ) ) { parent :: modify ( $ matches [ 1 ] ) ; } list ( $ y , $ m , $ d ) = explode ( '-' , $ this -> format ( 'y-M-d' ) ) ; $ change = strtolower ( $ matches [ 2 ] ) ; $ unit = strtolower ( $ matches [ 3 ] ) ; switch ( $ change ) { case "ne...
Internally used by modify method to calculate calendar - aware modifications
4,763
public function format ( $ pattern , $ timezone = null ) { if ( isset ( $ timezone ) ) { $ tempTimezone = $ this -> getTimezone ( ) ; $ this -> setTimezone ( $ timezone ) ; } $ result = $ this -> getFormatter ( array ( 'timezone' => 'GMT' . ( parent :: format ( 'Z' ) ? parent :: format ( 'P' ) : '' ) , 'pattern' => $ p...
Returns date formatted according to given pattern .
4,764
public function render ( ) { if ( $ breadcrumbs = $ this -> generator -> generate ( ) ) { return $ this -> renderer -> render ( config ( 'breadcrumbs.view' ) , $ breadcrumbs ) ; } }
Render the breadcrumbs as an HTML string .
4,765
public function getRelatedEntries ( ElementInterface $ element , Section $ section , string $ field ) : array { $ query = Entry :: find ( ) ; $ query -> section = $ section ; $ query -> limit = null ; $ query -> status = null ; $ query -> enabledForSite = null ; $ query -> relatedTo = [ 'targetElement' => $ element , '...
Returns related entries from an element limited to a section .
4,766
public function register ( string $ name , Closure $ definition ) { $ this -> registrar -> set ( $ name , $ definition ) ; }
Register a definition with the registrar .
4,767
public function generate ( ) : Collection { if ( $ this -> route -> present ( ) && $ this -> registrar -> has ( $ this -> route -> name ( ) ) ) { $ this -> call ( $ this -> route -> name ( ) , $ this -> route -> parameters ( ) ) ; } return $ this -> breadcrumbs ; }
Generate the collection of breadcrumbs from the given route .
4,768
public function add ( string $ title , string $ url ) { $ this -> breadcrumbs -> push ( new Breadcrumb ( $ title , $ url ) ) ; }
Add a breadcrumb to the collection .
4,769
protected function call ( string $ name , array $ parameters ) { $ definition = $ this -> registrar -> get ( $ name ) ; $ parameters = array_prepend ( array_values ( $ parameters ) , $ this ) ; call_user_func_array ( $ definition , $ parameters ) ; }
Call the breadcrumb definition with the given parameters .
4,770
public function getSettingsHtml ( ) : string { $ allSections = Craft :: $ app -> sections -> getAllSections ( ) ; $ allFields = Craft :: $ app -> fields -> getAllFields ( ) ?? [ ] ; $ elements = [ ] ; foreach ( $ allSections as $ element ) { $ elements [ $ element -> id ] = $ element -> name ; } $ fields = [ ] ; foreac...
Get template for field type settings .
4,771
public function getInputHtml ( $ value , ElementInterface $ element = null ) : string { $ plugin = Plugin :: getInstance ( ) ; $ service = $ plugin -> service ; if ( empty ( $ this -> source ) ) { return Craft :: t ( 'manytomany' , 'To use the {pluginName} plugin you need to set a source.' , [ 'pluginName' => $ plugin ...
Product input HTML for edit pages .
4,772
public function render ( string $ view , Collection $ breadcrumbs ) : HtmlString { return new HtmlString ( $ this -> makeView ( $ view , $ breadcrumbs ) -> render ( ) ) ; }
Render the given breadcrumbs into the given view .
4,773
protected function makeView ( string $ view , Collection $ breadcrumbs ) : View { return $ this -> factory -> make ( $ view , compact ( 'breadcrumbs' ) ) ; }
Get a view instance of the given view file with breadcrumbs .
4,774
public function getPublicUrl ( ) : string { if ( ! empty ( $ this -> _info [ 'prettyUrl' ] ) ) { $ publicUrl = $ this -> _info [ 'prettyUrl' ] ; } else { $ publicUrl = 'https://doodle.com/poll/' . $ this -> getId ( ) ; } return $ publicUrl ; }
Returns the public URL .
4,775
public function getDescription ( ) : string { if ( $ this -> description === null && $ this -> _repository !== null ) { $ this -> _repository -> injectDescription ( $ this ) ; } return $ this -> description ? : '' ; }
Returns the description .
4,776
public function setDescription ( string $ description ) : Poll { $ description = trim ( $ description ) ; $ this -> description = substr ( $ description , 0 , min ( static :: MAX_LENGTH_DESCRIPTION , strlen ( $ description ) ) ) ; return $ this ; }
Sets the description .
4,777
public function getOptions ( ) : array { if ( $ this -> options === null && $ this -> _repository !== null ) { $ this -> _repository -> injectOptions ( $ this ) ; } return $ this -> options ? : [ ] ; }
Returns the options .
4,778
public function getParticipants ( ) : array { if ( $ this -> participants === null && $ this -> _repository !== null ) { $ this -> _repository -> injectParticipants ( $ this ) ; } return $ this -> participants ? : [ ] ; }
Returns the participants .
4,779
public function getLocation ( ) : Location { if ( $ this -> location === false && $ this -> _repository !== null ) { $ this -> _repository -> injectLocation ( $ this ) ; } return $ this -> location ? : null ; }
Returns the location .
4,780
public function createService ( ServiceLocatorInterface $ serviceLocator , $ name = null ) { $ config = $ serviceLocator -> get ( 'Config' ) ; if ( ! $ config [ 'ocra_service_manager' ] [ 'logged_service_manager' ] ) { return $ serviceLocator ; } $ proxyFactory = $ serviceLocator -> get ( 'OcraServiceManager\\ServiceMa...
Create an overloaded service manager
4,781
protected function parseLimit ( SQLSelect $ query ) { $ limit = '' ; $ offset = '0' ; if ( is_array ( $ query -> getLimit ( ) ) ) { $ limitArr = $ query -> getLimit ( ) ; if ( isset ( $ limitArr [ 'limit' ] ) ) { $ limit = $ limitArr [ 'limit' ] ; } if ( isset ( $ limitArr [ 'start' ] ) ) { $ offset = $ limitArr [ 'sta...
Extracts the limit and offset from the limit clause
4,782
public function finish ( ) { if ( ! empty ( $ this -> queue ) ) { $ queue = $ this -> queue ; $ this -> queue = array ( ) ; $ this -> sendChunk ( $ queue ) ; } }
Overrides parent s method
4,783
public function getUrl ( array $ services ) { $ chunks = array ( ) ; foreach ( $ services as $ serviceName => $ details ) { foreach ( $ details [ 'dependencies' ] as $ dependency ) { $ chunks [ ] = '[' . $ serviceName . ']->[' . $ dependency . ']' ; } } return implode ( ',' , $ chunks ) ; }
Retrieves a YUML diagram link
4,784
public function listOnlyDNS ( $ dns ) { $ this -> returnCode = 'no' ; $ listDNS = $ this -> send ( 'v-list-dns-domain' , $ this -> userName , $ dns , 'json' ) ; $ data = json_decode ( $ listDNS , true ) ; return $ data ; }
List Only DNS .
4,785
public function addDNSDomain ( $ domain , $ ip , $ ns1 , $ ns2 , $ ns3 = null , $ ns4 = null ) { return $ this -> send ( 'v-add-dns-domain' , $ this -> userName , $ domain , $ ip , $ ns1 , $ ns2 , $ ns3 , $ ns4 , 'no' ) ; }
Add DNS domain .
4,786
public function listDNSRecords ( $ domain ) { $ this -> returnCode = 'no' ; $ data = $ this -> send ( 'v-list-dns-records' , $ this -> userName , $ domain , 'json' ) ; $ data = json_decode ( $ data , true ) ; return $ data ; }
List DNS record domain .
4,787
public function changeDNSDomainRecord ( $ domain , $ recordId , $ val , $ priority ) { return $ this -> send ( 'v-change-dns-record' , $ this -> userName , $ domain , $ recordId , $ val , $ priority ) ; }
Change DNS domain record .
4,788
public function addDNSRecord ( $ domain , $ rec , $ type , $ val , $ priority ) { $ this -> send ( 'v-add-dns-record' , $ this -> userName , $ domain , $ rec , $ type , $ val , $ priority ) ; }
Add DNS record .
4,789
private function createInstantiationListener ( EventManagerInterface $ eventManager ) { return function ( $ proxy , $ instance , $ method , $ params , $ returnValue ) use ( $ eventManager ) { $ eventName = ( 'create' === $ method ) ? ServiceManagerEvent :: EVENT_SERVICEMANAGER_CREATE : ServiceManagerEvent :: EVENT_SERV...
Bulds a listener closure responsible for triggering events on service instantiation
4,790
public function logout ( ) { $ this -> user = null ; return $ this -> jwt -> isHealthy ( ) ? $ this -> jwt -> invalidateToken ( ) : null ; }
Invalidate token for a user .
4,791
public function indexAction ( ) { $ config = $ this -> getServiceLocator ( ) -> get ( 'Config' ) ; if ( ! $ config [ 'ocra_service_manager' ] [ 'logged_service_manager' ] || ! isset ( $ config [ 'zenddevelopertools' ] [ 'toolbar' ] [ 'enabled' ] ) || ! $ config [ 'zenddevelopertools' ] [ 'toolbar' ] [ 'enabled' ] ) { t...
Redirects the user to a YUML graph drawn with the provided dsl_text
4,792
public function getDecoded ( ) { if ( is_null ( $ this -> token ) ) return null ; if ( is_null ( $ this -> decoded ) ) { try { $ this -> decoded = JWT :: decode ( $ this -> token , $ this -> key , [ 'HS512' ] ) ; } catch ( \ Exception $ e ) { } catch ( \ DomainException $ e ) { } } return $ this -> decoded ; }
Get decoded token .
4,793
public function getId ( ) { $ decoded = $ this -> getDecoded ( ) ; return ! is_null ( $ decoded ) ? $ decoded -> data -> { $ this -> id_field } : null ; }
Get value stored in token id field
4,794
public function buildMSSQLIndexName ( $ tableName , $ indexName , $ prefix = 'ix' ) { $ tableName = str_replace ( '\\' , '_' , $ tableName ) ; $ indexName = str_replace ( '\\' , '_' , $ indexName ) ; return "{$prefix}_{$tableName}_{$indexName}" ; }
Builds the internal MS SQL Server index name given the silverstripe table and index name
4,795
public function waitUntilIndexingFinished ( $ maxWaitingTime = 15 ) { if ( ! $ this -> database -> fullTextEnabled ( ) ) { return ; } $ this -> query ( "EXEC sp_fulltext_catalog 'ftCatalog', 'Rebuild';" ) ; $ start = time ( ) ; while ( time ( ) - $ start < $ maxWaitingTime ) { $ status = $ this -> query ( "EXEC sp_help...
Sleep until the catalog has been fully rebuilt . This is a busy wait designed for situations when you need to be sure the index is up to date - for example in unit tests .
4,796
public function fulltextIndexExists ( $ tableName ) { if ( ! $ this -> database -> fullTextEnabled ( ) ) { return null ; } return ( bool ) $ this -> preparedQuery ( " SELECT 1 FROM sys.fulltext_indexes i JOIN sys.objects o ON i.object_id = o.object_id WHERE o.name = ?" , array ( $ tableName ) ) -> value ( ) ; }
Check if a fulltext index exists on a particular table name .
4,797
public function getPrimaryKey ( $ tableName ) { $ indexes = $ this -> query ( "EXEC sp_helpindex '$tableName';" ) ; $ indexName = '' ; foreach ( $ indexes as $ index ) { if ( $ index [ 'index_keys' ] == 'ID' ) { $ indexName = $ index [ 'index_name' ] ; break ; } } return $ indexName ; }
MSSQL stores the primary key column with an internal identifier so a lookup needs to be done to determine it .
4,798
public function alterTable ( $ tableName , $ newFields = null , $ newIndexes = null , $ alteredFields = null , $ alteredIndexes = null , $ alteredOptions = null , $ advancedOptions = null ) { $ alterList = array ( ) ; if ( $ this -> fulltextIndexExists ( $ tableName ) ) { $ alterList [ ] = "\nDROP FULLTEXT INDEX ON \"$...
Alter a table s schema .
4,799
public function getConstraintCheckClause ( $ tableName , $ columnName ) { if ( isset ( self :: $ cached_checks [ $ tableName ] ) ) { if ( ! isset ( self :: $ cached_checks [ $ tableName ] [ $ columnName ] ) ) { return null ; } return self :: $ cached_checks [ $ tableName ] [ $ columnName ] ; } $ checks = array ( ) ; fo...
Given a table and column name return a check constraint clause for that column in the table .