idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
50,500
private function checkMessageId ( $ id ) { if ( ! is_int ( $ id ) ) { throw new ImapClientException ( '$id must be an integer!' ) ; } ; if ( $ id <= 0 ) { throw new ImapClientException ( '$id must be greater then 0!' ) ; } ; if ( $ id > $ this -> countMessages ( ) ) { throw new ImapClientException ( '$id does not exist...
Check message id
50,501
public static function getById ( $ paymentId , $ apiContext = null ) { if ( isset ( $ apiContext ) ) { return Payment :: get ( $ paymentId , $ apiContext ) ; } return Payment :: get ( $ paymentId ) ; }
grape payment details using the paymentId
50,502
public static function getAll ( $ param , $ apiContext = null ) { if ( isset ( $ apiContext ) ) { return Payment :: all ( $ param , $ apiContext ) ; } return Payment :: all ( $ param ) ; }
grape all payment details
50,503
protected function hasInvalidCascadingRelationships ( ) { return array_filter ( $ this -> getCascadingDeletes ( ) , function ( $ relationship ) { return ! method_exists ( $ this , $ relationship ) || ! $ this -> { $ relationship } ( ) instanceof Relation ; } ) ; }
Determine if the current model has any invalid cascading relationships defined .
50,504
public static function debugLog ( string $ name , array $ arguments ) { $ logger = Config :: getLogger ( ) ; if ( $ logger ) { $ logger -> debug ( $ name , $ arguments ) ; } }
Log a debug message .
50,505
private static function unwrap ( array $ result ) : array { array_walk_recursive ( $ result , function ( & $ value ) { if ( $ value instanceof Image ) { $ value = $ value -> image ; } } ) ; return $ result ; }
Unwrap an array of stuff ready to pass down to the vips_ layer . We swap instances of the Image for the plain resource .
50,506
private static function errorVips ( ) { $ message = vips_error_buffer ( ) ; $ exception = new Exception ( $ message ) ; Utils :: errorLog ( $ message , $ exception ) ; throw $ exception ; }
Throw a vips error as an exception .
50,507
private static function runCmplx ( $ func , Image $ image ) : Image { $ original_format = $ image -> format ; if ( $ image -> format != 'complex' && $ image -> format != 'dpcomplex' ) { if ( $ image -> bands % 2 != 0 ) { throw new Exception ( 'not an even number of bands' ) ; } if ( $ image -> format != 'float' && $ im...
Run a function expecting a complex image . If the image is not in complex format try to make it complex by joining adjacant bands as real and imaginary .
50,508
public static function newFromFile ( string $ filename , array $ options = [ ] ) : Image { Utils :: debugLog ( 'newFromFile' , [ 'instance' => null , 'arguments' => [ $ filename , $ options ] ] ) ; $ options = self :: unwrap ( $ options ) ; $ result = vips_image_new_from_file ( $ filename , $ options ) ; self :: errorI...
Create a new Image from a file on disc .
50,509
public static function newFromBuffer ( string $ buffer , string $ option_string = '' , array $ options = [ ] ) : Image { Utils :: debugLog ( 'newFromBuffer' , [ 'instance' => null , 'arguments' => [ $ buffer , $ option_string , $ options ] ] ) ; $ options = self :: unwrap ( $ options ) ; $ result = vips_image_new_from_...
Create a new Image from a compressed image held as a string .
50,510
public static function newFromArray ( array $ array , float $ scale = 1.0 , float $ offset = 0.0 ) : Image { Utils :: debugLog ( 'newFromArray' , [ 'instance' => null , 'arguments' => [ $ array , $ scale , $ offset ] ] ) ; $ result = vips_image_new_from_array ( $ array , $ scale , $ offset ) ; if ( $ result === - 1 ) {...
Create a new Image from a php array .
50,511
public static function newFromMemory ( string $ data , int $ width , int $ height , int $ bands , string $ format ) : Image { Utils :: debugLog ( 'newFromMemory' , [ 'instance' => null , 'arguments' => [ $ data , $ width , $ height , $ bands , $ format ] ] ) ; $ result = vips_image_new_from_memory ( $ data , $ width , ...
Wraps an Image around an area of memory containing a C - style array .
50,512
public function newFromImage ( $ value ) : Image { Utils :: debugLog ( 'newFromImage' , [ 'instance' => $ this , 'arguments' => [ $ value ] ] ) ; $ pixel = self :: black ( 1 , 1 ) -> add ( $ value ) -> cast ( $ this -> format ) ; $ image = $ pixel -> embed ( 0 , 0 , $ this -> width , $ this -> height , [ 'extend' => Ex...
Create a new image from a constant .
50,513
public function writeToFile ( string $ filename , array $ options = [ ] ) { Utils :: debugLog ( 'writeToFile' , [ 'instance' => $ this , 'arguments' => [ $ filename , $ options ] ] ) ; $ options = self :: unwrap ( $ options ) ; $ result = vips_image_write_to_file ( $ this -> image , $ filename , $ options ) ; if ( $ re...
Write an image to a file .
50,514
public function writeToBuffer ( string $ suffix , array $ options = [ ] ) : string { Utils :: debugLog ( 'writeToBuffer' , [ 'instance' => $ this , 'arguments' => [ $ suffix , $ options ] ] ) ; $ options = self :: unwrap ( $ options ) ; $ result = vips_image_write_to_buffer ( $ this -> image , $ suffix , $ options ) ; ...
Write an image to a formatted string .
50,515
public function writeToMemory ( ) : string { Utils :: debugLog ( 'writeToMemory' , [ 'instance' => $ this , 'arguments' => [ ] ] ) ; $ result = vips_image_write_to_memory ( $ this -> image ) ; if ( $ result === - 1 ) { self :: errorVips ( ) ; } Utils :: debugLog ( 'writeToMemory' , [ 'result' => $ result ] ) ; return $...
Write an image to a large memory array .
50,516
public function copyMemory ( ) : Image { Utils :: debugLog ( 'copyMemory' , [ 'instance' => $ this , 'arguments' => [ ] ] ) ; $ result = vips_image_copy_memory ( $ this -> image ) ; if ( $ result === - 1 ) { self :: errorVips ( ) ; } $ result = self :: wrapResult ( $ result ) ; Utils :: debugLog ( 'copyMemory' , [ 'res...
Copy to memory .
50,517
public function get ( string $ name ) { $ result = vips_image_get ( $ this -> image , $ name ) ; self :: errorIsArray ( $ result ) ; return self :: wrapResult ( $ result ) ; }
Get any property from the underlying image .
50,518
public function set ( string $ name , $ value ) { $ result = vips_image_set ( $ this -> image , $ name , $ value ) ; if ( $ result === - 1 ) { self :: errorVips ( ) ; } }
Set any property on the underlying image .
50,519
public function remove ( string $ name ) { $ result = vips_image_remove ( $ this -> image , $ name ) ; if ( $ result === - 1 ) { self :: errorVips ( ) ; } }
Remove a field from the underlying image .
50,520
public function hasAlpha ( ) : bool { return $ this -> bands === 2 || ( $ this -> bands === 4 && $ this -> interpretation !== Interpretation :: CMYK ) || $ this -> bands > 4 ; }
Does this image have an alpha channel?
50,521
public function offsetGet ( $ offset ) : Image { return $ this -> offsetExists ( $ offset ) ? $ this -> extract_band ( $ offset ) : null ; }
Get band from image .
50,522
public function offsetSet ( $ offset , $ value ) { if ( $ offset === null ) { $ offset = $ this -> bands ; } if ( ! is_int ( $ offset ) ) { throw new \ BadMethodCallException ( 'Image::offsetSet: offset is not integer or null' ) ; } $ n_left = min ( $ this -> bands , max ( 0 , $ offset ) ) ; $ n_right = min ( $ this ->...
Set a band .
50,523
public function offsetUnset ( $ offset ) { if ( is_int ( $ offset ) && $ offset >= 0 && $ offset < $ this -> bands ) { if ( $ this -> bands === 1 ) { throw new \ BadMethodCallException ( 'Image::offsetUnset: cannot delete final band' ) ; } $ components = [ ] ; if ( $ offset > 0 ) { $ components [ ] = $ this -> extract_...
Remove a band from an image .
50,524
public function bandrank ( $ other , array $ options = [ ] ) : Image { if ( $ other instanceof Image ) { $ other = [ $ other ] ; } else { $ other = ( array ) $ other ; } return self :: call ( 'bandrank' , $ this , $ other , $ options ) ; }
For each band element sort the array of input images and pick the median . Use the index option to pick something else .
50,525
public function polar ( ) : Image { return self :: runCmplx ( function ( $ image ) { return $ image -> complex ( OperationComplex :: POLAR ) ; } , $ this ) ; }
Return an image converted to polar coordinates .
50,526
public function rect ( ) : Image { return self :: runCmplx ( function ( $ image ) { return $ image -> complex ( OperationComplex :: RECT ) ; } , $ this ) ; }
Return an image converted to rectangular coordinates .
50,527
public function create ( ClientInterface $ client , $ wsdl , array $ options = [ ] ) { if ( $ this -> isHttpUrl ( $ wsdl ) ) { $ httpBindingPromise = $ client -> requestAsync ( 'GET' , $ wsdl ) -> then ( function ( ResponseInterface $ response ) use ( $ options ) { $ wsdl = $ response -> getBody ( ) -> __toString ( ) ;...
Create an instance of SoapClientInterface .
50,528
public static function minifyString ( $ string ) { $ string = str_replace ( PHP_EOL , ' ' , $ string ) ; $ string = preg_replace ( '/[\r\n]+/' , "\n" , $ string ) ; return preg_replace ( '/[ \t]+/' , ' ' , $ string ) ; }
Remove all whitesapces line - breaks and tabs from string for better regex recognition
50,529
public function writeLine ( $ s ) { $ message = $ this -> cleanMessage ( $ s ) ; if ( ! empty ( $ message ) ) { $ this -> bag [ ] = array ( self :: LINE , $ message ) ; } }
Add a simple message
50,530
public function writeInfo ( $ s ) { $ message = $ this -> cleanMessage ( $ s ) ; if ( ! empty ( $ message ) ) { $ this -> bag [ ] = array ( self :: INFO , $ message ) ; } }
Add an info message
50,531
public function writeComment ( $ s ) { $ message = $ this -> cleanMessage ( $ s ) ; if ( ! empty ( $ message ) ) { $ this -> bag [ ] = array ( self :: COMMENT , $ message ) ; } }
Add a comment message
50,532
public function writeQuestion ( $ s ) { $ message = $ this -> cleanMessage ( $ s ) ; if ( ! empty ( $ message ) ) { $ this -> bag [ ] = array ( self :: QUESTION , $ message ) ; } }
Add a question message
50,533
protected function logInFile ( $ txt = '' , $ logFile = '/tmp/llh.log' ) { if ( ! is_string ( $ txt ) ) { $ txt = print_r ( $ txt , true ) ; } $ txt = '==> ' . date ( 'Y/m/d H:i:s' ) . ' ==> ' . $ txt . "\n" ; if ( self :: $ logInFileFirst === true ) { file_put_contents ( $ logFile , $ txt ) ; self :: $ logInFileFirst ...
Log in a file for debug purpose only
50,534
public function getPath ( $ path ) { if ( ! is_array ( $ path ) ) { $ path = [ $ path ] ; } $ search_for = [ '%BASE' , '%STORAGE' , ] ; $ replace_by = [ base_path ( ) , storage_path ( ) , ] ; if ( function_exists ( 'app_path' ) ) { $ search_for [ ] = '%APP' ; $ replace_by [ ] = app_path ( ) ; } if ( function_exists ( '...
Return an absolute path without predefined variables
50,535
public function getFilesWithExtension ( $ path , $ ext = 'php' ) { if ( is_dir ( $ path ) ) { return new RegexIterator ( new RecursiveIteratorIterator ( new RecursiveDirectoryIterator ( $ path , RecursiveDirectoryIterator :: SKIP_DOTS ) , RecursiveIteratorIterator :: SELF_FIRST , RecursiveIteratorIterator :: CATCH_GET_...
Return an iterator of files with specific extension in the provided paths and subpaths
50,536
public function extractTranslationFromPhpFile ( $ path , $ trans_methods ) { $ result = [ ] ; $ string = Tools :: minifyString ( file_get_contents ( $ path ) ) ; foreach ( array_flatten ( $ trans_methods ) as $ method ) { preg_match_all ( $ method , $ string , $ matches ) ; foreach ( $ matches [ 1 ] as $ k => $ v ) { i...
Extract all translations from the provided file
50,537
public function extractTranslationsFromFolders ( $ folders , $ trans_methods , $ php_file_extension = 'php' ) { $ lemmas = [ ] ; foreach ( $ folders as $ path ) { foreach ( $ this -> getFilesWithExtension ( $ path , $ php_file_extension ) as $ php_file_path => $ dumb ) { $ lemma = [ ] ; foreach ( $ this -> extractTrans...
Extract all translations from the provided folders
50,538
public function deleteBackupFiles ( $ lang_folder_path , $ days = 0 , $ dryRun = false , $ ext = 'php' ) { if ( $ days < 0 ) { return false ; } try { $ dir_lang = $ this -> getLangPath ( $ lang_folder_path ) ; } catch ( Exception $ e ) { switch ( $ e -> getCode ( ) ) { case self :: NO_LANG_FOLDER_FOUND_IN_THESE_PATHS :...
Delete backup files
50,539
private function evalString ( $ str ) { $ a = false ; if ( class_exists ( 'ParseError' ) ) { try { $ a = eval ( "return $str;" ) ; } catch ( ParseError $ e ) { } } else { $ a = @ eval ( "return $str;" ) ; } return $ a ; }
Eval a PHP string and catch PHP Parse Error syntax
50,540
public function findLemma ( $ lemma , $ folders , $ trans_methods , $ regex = false , $ shortOutput = false , $ ext = 'php' ) { $ files = [ ] ; foreach ( $ folders as $ path ) { foreach ( $ this -> getFilesWithExtension ( $ path , $ ext ) as $ php_file_path => $ dumb ) { foreach ( $ this -> extractTranslationFromPhpFil...
Get the list of PHP code files where a lemma is defined
50,541
private function getBackupFileDate ( $ file , $ ext = 'php' ) { $ matches = [ ] ; if ( preg_match ( '@^(.*)([0-9]{8}_[0-9]{6})\\.' . $ ext . '$@' , $ file , $ matches ) === 1 ) { return \ DateTime :: createFromFormat ( self :: BACKUP_DATE_FORMAT , $ matches [ 2 ] ) ; } else { return null ; } }
Return the date of a backup file
50,542
public function check ( string $ listId , string $ email ) : bool { $ result = $ this -> status ( $ listId , $ email ) ; return in_array ( $ result , [ 'subscribed' , 'pending' ] ) ; }
Checks to see if an email address is subscribed to a list
50,543
public function subscribe ( string $ listId , string $ email , array $ mergeFields = [ ] , bool $ confirm = true ) { if ( $ this -> status ( $ listId , $ email ) == 'subscribed' ) { $ confirm = false ; } $ this -> api -> addUpdate ( $ listId , $ email , $ mergeFields , $ confirm ) ; }
Ensures that existing subscribers are not asked to reconfirm
50,544
public function api ( string $ method , string $ endpoint , array $ data = [ ] ) : array { $ endpoint = '/' . ltrim ( $ endpoint , '/' ) ; return $ this -> api -> call ( $ method , $ endpoint , $ data ) ; }
Make an API call directly
50,545
public function status ( string $ status ) : Member { if ( ! in_array ( $ status , [ 'subscribed' , 'unsubscribed' , 'cleaned' , 'pending' ] ) ) { throw new \ InvalidArgumentException ( 'Status must be subscribed, unsubscribed, cleaned or pending' ) ; } $ this -> parameters [ 'status' ] = $ status ; return $ this ; }
Note this doesn t affect status_if_new therefore it s not possible to add a new member as unsubscribed or cleaned
50,546
public function end ( ) { if ( $ this -> capturing === false ) { throw new InvalidTagException ( "Markdown capturing have not been started." ) ; } $ this -> capturing = false ; $ text = ob_get_clean ( ) ; return $ this -> parse ( $ text ) ; }
Stop capturing output parse the string from markdown to HTML and return it . Throws an exception if outpout capturing hasn t been started yet .
50,547
public function boot ( ) { $ this -> publishes ( [ __DIR__ . '/../config/markdown.php' => config_path ( 'markdown.php' ) , ] ) ; Blade :: directive ( 'markdown' , function ( $ markdown ) { if ( $ markdown ) { return "<?php echo app('Indal\Markdown\Parser')->parse($markdown); ?>" ; } return "<?php app('Indal\Markdown\Pa...
Bootstrap the Markdown Blade directives and publish the config file .
50,548
public function register ( ) { $ this -> app -> singleton ( Parser :: class , function ( $ app ) { return new Parser ( new ParsedownDriver ( config ( 'markdown' ) ?? [ ] ) ) ; } ) ; $ this -> app -> bind ( 'markdown' , Parser :: class ) ; }
Bind the Markdown facade and the parser class to the container .
50,549
public function getResults ( $ query ) { $ searchResults = [ ] ; if ( $ query == '' ) { return $ searchResults ; } if ( $ this -> searchEngineId == '' ) { throw new \ Exception ( 'You must specify a searchEngineId' ) ; } $ client = new Client ( ) ; $ result = $ client -> get ( 'http://www.google.com/cse' , [ 'query' =>...
Get results from a Google Custom Search Engine .
50,550
public function getPageMapProperty ( $ item , $ type , $ attribute ) { $ propertyArray = $ item -> PageMap -> xpath ( 'DataObject[@type="' . $ type . '"]/Attribute[@name="' . $ attribute . '"]/@value' ) ; if ( ! count ( $ propertyArray ) ) { return '' ; } return ( string ) $ propertyArray [ 0 ] ; }
Get a the value Pagemap property with the given name of the given type of the given item .
50,551
public function get ( $ key , $ default_value = null ) { if ( strpos ( $ key , '.' ) !== false ) { $ setting = $ this -> getSubValue ( $ key ) ; } else { if ( $ this -> hasByKey ( $ key ) ) { $ setting = $ this -> getByKey ( $ key ) ; } else { $ setting = $ default_value ; } } $ this -> resetLang ( ) ; if ( is_null ( $...
Return setting value or default value by key .
50,552
public function set ( $ key , $ value ) { if ( strpos ( $ key , '.' ) !== false ) { $ this -> setSubValue ( $ key , $ value ) ; } else { $ this -> setByKey ( $ key , $ value ) ; } $ this -> resetLang ( ) ; }
Set the setting by key and value .
50,553
public function forget ( $ key ) { if ( strpos ( $ key , '.' ) !== false ) { $ this -> forgetSubKey ( $ key ) ; } else { $ this -> forgetByKey ( $ key ) ; } $ this -> resetLang ( ) ; }
Delete a setting .
50,554
public function lang ( $ language ) { if ( empty ( $ language ) ) { $ this -> resetLang ( ) ; } else { $ this -> lang = $ language ; } return $ this ; }
Set the language to work with other functions .
50,555
protected function resetLang ( $ force = false ) { if ( $ this -> autoResetLang || $ force ) { $ this -> lang = null ; } return $ this ; }
Reset the language so we could switch to other local .
50,556
private function getProvider ( ) { $ app = $ this -> app ; $ version = intval ( $ app :: VERSION ) ; switch ( $ version ) { case 4 : return new ServiceProviderLaravel4 ( $ app ) ; case 5 : return new ServiceProviderLaravel5 ( $ app ) ; default : throw new RuntimeException ( 'Your version of Laravel is not supported' ) ...
Return the service provider for the particular Laravel version .
50,557
protected function getSwaggerDocumentation ( ) : Swagger { if ( ! $ this -> cache instanceof Cache ) { return \ Swagger \ scan ( $ this -> scanDir , $ this -> scanOptions ) ; } return $ this -> cache -> getOrSet ( $ this -> cacheKey , function ( ) { return \ Swagger \ scan ( $ this -> scanDir , $ this -> scanOptions ) ...
Scan the filesystem for swagger annotations and build swagger - documentation .
50,558
public function validate ( $ configuration , $ required ) { $ missing = '' ; foreach ( $ configuration as $ key => $ value ) { if ( in_array ( $ key , $ required ) && ( empty ( $ value ) || $ value == null || $ value == '' ) ) { $ missing .= ' ' . $ key ; } } if ( $ missing ) { throw new MissingConfigurationException (...
Checks for any required configuration is missed .
50,559
private function generateUrl ( $ path , $ prepend = '' ) { if ( isset ( $ this -> configurations [ 'bypass' ] ) && $ this -> configurations [ 'bypass' ] ) { return Request :: root ( ) . '/' . $ path ; } if ( ! isset ( $ path ) ) { throw new EmptyPathException ( 'Path does not exist.' ) ; } $ clean_path = $ prepend . $ ...
check if package is surpassed or not then prepare the path before generating the url .
50,560
private function init ( ) { $ this -> configurations = $ this -> helper -> getConfigurations ( ) ; $ this -> provider = $ this -> provider_factory -> create ( $ this -> configurations ) ; }
Read the configuration file and pass it to the provider factory to return an object of the default provider specified in the config file .
50,561
public function upload ( $ assets ) { $ connected = $ this -> connect ( ) ; if ( ! $ connected ) { return false ; } $ this -> console -> writeln ( '<fg=yellow>Comparing local files and bucket...</fg=yellow>' ) ; $ assets = $ this -> getFilesAlreadyOnBucket ( $ assets ) ; if ( count ( $ assets ) > 0 ) { $ this -> consol...
Upload assets .
50,562
public function emptyBucket ( ) { $ connected = $ this -> connect ( ) ; if ( ! $ connected ) { return false ; } $ this -> console -> writeln ( '<fg=yellow>Emptying in progress...</fg=yellow>' ) ; try { $ contents = $ this -> s3_client -> listObjects ( [ 'Bucket' => $ this -> getBucket ( ) , 'Key' => '' , ] ) ; if ( ! $...
Empty bucket .
50,563
public function init ( $ configurations = array ( ) ) { $ this -> parseAndFillConfiguration ( $ configurations ) ; $ this -> included_directories = $ this -> default_include [ 'directories' ] ; $ this -> included_extensions = $ this -> default_include [ 'extensions' ] ; $ this -> included_patterns = $ this -> default_i...
build a Asset object that contains the assets related configurations .
50,564
private function parseAndFillConfiguration ( $ configurations ) { $ this -> default_include = isset ( $ configurations [ 'include' ] ) ? array_merge ( $ this -> default_include , $ configurations [ 'include' ] ) : $ this -> default_include ; $ this -> default_exclude = isset ( $ configurations [ 'exclude' ] ) ? array_m...
Check if the config file has any missed attribute and if any attribute is missed will be overridden by a default attribute defined in this class .
50,565
private function includeThis ( AssetInterface $ asset_holder ) { $ this -> in ( $ asset_holder -> getIncludedDirectories ( ) ) ; foreach ( $ asset_holder -> getIncludedExtensions ( ) as $ extension ) { $ this -> name ( '*' . $ extension ) ; } foreach ( $ asset_holder -> getIncludedPatterns ( ) as $ pattern ) { $ this -...
Add the included directories and files .
50,566
private function excludeThis ( AssetInterface $ asset_holder ) { $ this -> ignoreDotFiles ( $ asset_holder -> getExcludeHidden ( ) ) ; foreach ( $ asset_holder -> getExcludedFiles ( ) as $ name ) { $ this -> notName ( $ name ) ; } $ excluded_extensions = $ asset_holder -> getExcludedExtensions ( ) ; if ( ! empty ( $ ex...
exclude the ignored directories and files .
50,567
public function create ( $ configurations = array ( ) ) { $ provider = isset ( $ configurations [ 'default' ] ) ? $ configurations [ 'default' ] : null ; if ( ! $ provider ) { throw new MissingConfigurationException ( 'Missing Configurations: Default Provider' ) ; } $ driver_class = self :: DRIVERS_NAMESPACE . ucwords ...
Create and return an instance of the corresponding Provider concrete according to the configuration .
50,568
public function open ( array $ options = [ ] ) { $ options [ 'role' ] = 'form' ; if ( ! array_key_exists ( 'class' , $ options ) ) { $ options [ 'class' ] = $ this -> getType ( ) ; } if ( array_key_exists ( 'left_column_class' , $ options ) ) { $ this -> setLeftColumnClass ( $ options [ 'left_column_class' ] ) ; } if (...
Open a form while passing a model and the routes for storing or updating the model . This will set the correct route along with the correct method .
50,569
public function close ( ) { $ this -> type = null ; $ this -> leftColumnClass = $ this -> rightColumnClass = null ; return $ this -> form -> close ( ) ; }
Reset and close the form .
50,570
protected function model ( $ options ) { $ model = $ options [ 'model' ] ; if ( isset ( $ options [ 'url' ] ) ) { array_forget ( $ options , [ 'model' , 'update' , 'store' ] ) ; $ options [ 'method' ] = isset ( $ options [ 'method' ] ) ? $ options [ 'method' ] : 'GET' ; return $ this -> form -> model ( $ model , $ opti...
Open a form configured for model binding .
50,571
public function staticField ( $ name , $ label = null , $ value = null , array $ options = [ ] ) { $ options = array_merge ( [ 'class' => 'form-control-static' ] , $ options ) ; if ( is_array ( $ value ) and isset ( $ value [ 'html' ] ) ) { $ value = $ value [ 'html' ] ; } else { $ value = e ( $ value ) ; } $ label = $...
Create a Bootstrap static field .
50,572
public function checkbox ( $ name , $ label = null , $ value = 1 , $ checked = null , array $ options = [ ] ) { $ inputElement = $ this -> checkboxElement ( $ name , $ label , $ value , $ checked , false , $ options ) ; $ wrapperOptions = $ this -> isHorizontal ( ) ? [ 'class' => implode ( ' ' , [ $ this -> getLeftColu...
Create a Bootstrap checkbox input .
50,573
public function checkboxElement ( $ name , $ label = null , $ value = 1 , $ checked = null , $ inline = false , array $ options = [ ] ) { $ label = $ label === false ? null : $ this -> getLabelTitle ( $ label , $ name ) ; $ labelOptions = $ inline ? [ 'class' => 'checkbox-inline' ] : [ ] ; $ inputElement = $ this -> fo...
Create a single Bootstrap checkbox element .
50,574
public function checkboxes ( $ name , $ label = null , $ choices = [ ] , $ checkedValues = [ ] , $ inline = false , array $ options = [ ] ) { $ elements = '' ; foreach ( $ choices as $ value => $ choiceLabel ) { $ checked = in_array ( $ value , ( array ) $ checkedValues ) ; $ elements .= $ this -> checkboxElement ( $ n...
Create a collection of Bootstrap checkboxes .
50,575
public function radio ( $ name , $ label = null , $ value = null , $ checked = null , array $ options = [ ] ) { $ inputElement = $ this -> radioElement ( $ name , $ label , $ value , $ checked , false , $ options ) ; $ wrapperOptions = $ this -> isHorizontal ( ) ? [ 'class' => implode ( ' ' , [ $ this -> getLeftColumnO...
Create a Bootstrap radio input .
50,576
public function radioElement ( $ name , $ label = null , $ value = null , $ checked = null , $ inline = false , array $ options = [ ] ) { $ label = $ label === false ? null : $ this -> getLabelTitle ( $ label , $ name ) ; $ value = is_null ( $ value ) ? $ label : $ value ; $ labelOptions = $ inline ? [ 'class' => 'radi...
Create a single Bootstrap radio input .
50,577
public function radios ( $ name , $ label = null , $ choices = [ ] , $ checkedValue = null , $ inline = false , array $ options = [ ] ) { $ elements = '' ; foreach ( $ choices as $ value => $ choiceLabel ) { $ checked = $ value === $ checkedValue ; $ elements .= $ this -> radioElement ( $ name , $ choiceLabel , $ value...
Create a collection of Bootstrap radio inputs .
50,578
public function label ( $ name , $ value = null , array $ options = [ ] ) { $ options = $ this -> getLabelOptions ( $ options ) ; $ escapeHtml = false ; if ( is_array ( $ value ) and isset ( $ value [ 'html' ] ) ) { $ value = $ value [ 'html' ] ; } elseif ( $ value instanceof HtmlString ) { $ value = $ value -> toHtml ...
Create a Bootstrap label .
50,579
public function button ( $ value = null , array $ options = [ ] ) { $ options = array_merge ( [ 'class' => 'btn btn-primary' ] , $ options ) ; $ inputElement = $ this -> form -> button ( $ value , $ options ) ; $ wrapperOptions = $ this -> isHorizontal ( ) ? [ 'class' => implode ( ' ' , [ $ this -> getLeftColumnOffsetC...
Create a Boostrap button .
50,580
public function file ( $ name , $ label = null , array $ options = [ ] ) { $ label = $ this -> getLabelTitle ( $ label , $ name ) ; $ options = array_merge ( [ 'class' => 'filestyle' , 'data-buttonBefore' => 'true' ] , $ options ) ; $ options = $ this -> getFieldOptions ( $ options , $ name ) ; $ inputElement = $ this ...
Create a Boostrap file upload button .
50,581
public function input ( $ type , $ name , $ label = null , $ value = null , array $ options = [ ] ) { $ label = $ this -> getLabelTitle ( $ label , $ name ) ; $ optionsField = $ this -> getFieldOptions ( array_except ( $ options , [ 'suffix' , 'prefix' ] ) , $ name ) ; $ inputElement = '' ; if ( isset ( $ options [ 'pr...
Create the input group for an element with the correct classes for errors .
50,582
public function addonButton ( $ label , $ options = [ ] ) { $ attributes = array_merge ( [ 'class' => 'btn' , 'type' => 'button' ] , $ options ) ; if ( isset ( $ options [ 'class' ] ) ) { $ attributes [ 'class' ] .= ' btn' ; } return '<div class="input-group-btn"><button ' . $ this -> html -> attributes ( $ attributes ...
Create an addon button element .
50,583
public function addonIcon ( $ icon , $ options = [ ] ) { $ prefix = array_get ( $ options , 'prefix' , $ this -> getIconPrefix ( ) ) ; return '<div class="input-group-addon"><span ' . $ this -> html -> attributes ( $ options ) . '><i class="' . $ prefix . $ icon . '"></i></span></div>' ; }
Create an addon icon element .
50,584
public function hidden ( $ name , $ value = null , $ options = [ ] ) { return $ this -> form -> hidden ( $ name , $ value , $ options ) ; }
Create a hidden field .
50,585
protected function getLabelTitle ( $ label , $ name ) { if ( $ label === false ) { return null ; } if ( is_null ( $ label ) && Lang :: has ( "forms.{$name}" ) ) { return Lang :: get ( "forms.{$name}" ) ; } return $ label ? : str_replace ( '_' , ' ' , Str :: title ( $ name ) ) ; }
Get the label title for a form field first by using the provided one or titleizing the field name .
50,586
protected function getFormGroupWithoutLabel ( $ name , $ element ) { $ options = $ this -> getFormGroupOptions ( $ name ) ; return $ this -> toHtmlString ( '<div' . $ this -> html -> attributes ( $ options ) . '>' . $ element . '</div>' ) ; }
Get a form group comprised of a form element and errors .
50,587
protected function getFormGroupWithLabel ( $ name , $ value , $ element ) { $ options = $ this -> getFormGroupOptions ( $ name ) ; return $ this -> toHtmlString ( '<div' . $ this -> html -> attributes ( $ options ) . '>' . $ this -> label ( $ name , $ value ) . $ element . '</div>' ) ; }
Get a form group comprised of a label form element and errors .
50,588
public function getFormGroup ( $ name = null , $ label = null , $ wrapperElement ) { if ( is_null ( $ label ) ) { return $ this -> getFormGroupWithoutLabel ( $ name , $ wrapperElement ) ; } return $ this -> getFormGroupWithLabel ( $ name , $ label , $ wrapperElement ) ; }
Get a form group with or without a label .
50,589
protected function getFormGroupOptions ( $ name = null , array $ options = [ ] ) { $ class = 'form-group' ; if ( $ name ) { $ class .= ' ' . $ this -> getFieldErrorClass ( $ name ) ; } return array_merge ( [ 'class' => $ class ] , $ options ) ; }
Merge the options provided for a form group with the default options required for Bootstrap styling .
50,590
protected function getFieldOptions ( array $ options = [ ] , $ name = null ) { $ options [ 'class' ] = trim ( 'form-control ' . $ this -> getFieldOptionsClass ( $ options ) ) ; if ( $ name && ! array_key_exists ( 'id' , $ options ) ) { $ options [ 'id' ] = $ name ; } return $ options ; }
Merge the options provided for a field with the default options required for Bootstrap styling .
50,591
public function getFollowers ( ) { $ followers = array ( ) ; $ sections = $ this -> getSections ( ) ; if ( $ sections != null ) { foreach ( $ sections as $ section ) { $ users = $ section -> getUsers ( ) ; if ( $ users != null ) { foreach ( $ users as $ user ) { $ followers [ ] = $ user ; } } } } return $ followers ; }
Get Followers by iterating over all Sections
50,592
public function setProxy ( $ proxy , $ username = null , $ password = null ) { $ this -> proxy = $ proxy ; if ( $ username != null && $ password != null ) { $ this -> proxyCredentials = $ username . ":" . $ password ; } }
Set the HTTP Proxy to be used for Instagram API Requests
50,593
public function setupAsNewDevice ( ) { $ guidId = Uuid :: uuid4 ( ) -> toString ( ) ; $ phoneId = Uuid :: uuid4 ( ) -> toString ( ) ; $ rankToken = Uuid :: uuid4 ( ) -> toString ( ) ; $ googleAdId = Uuid :: uuid4 ( ) -> toString ( ) ; $ this -> setGuid ( $ guidId ) ; $ this -> setUuid ( $ guidId ) ; $ this -> setPhoneI...
Setup this instance with a fresh GUID UUID and Phone ID .
50,594
public function searchByQuery ( $ query ) { if ( $ query != null ) { $ this -> addParam ( "query" , $ query ) ; $ this -> addParam ( "rank_token" , $ this -> instagram -> getUserRankToken ( ) ) ; } }
Search Places by Query
50,595
public function searchByLocation ( $ lat , $ long ) { if ( $ lat != null && $ long != null ) { $ this -> addParam ( "lat" , $ lat ) ; $ this -> addParam ( "lng" , $ long ) ; } }
Search Places by Location
50,596
protected function cleanResponse ( ) { if ( ! $ this -> options [ 'strip_bad_chars' ] ) { return ; } $ count = 0 ; $ this -> __last_response = preg_replace ( '/(?!&#x0?(9|A|D))(&#x[0-1]?[0-9A-F];)/' , ' ' , $ this -> __last_response , - 1 , $ count ) ; if ( $ this -> options [ 'warn_on_bad_chars' ] && $ count > 0 ) { t...
Cleans the response body by stripping bad characters if instructed to .
50,597
protected function curlOptions ( $ action , $ request ) { $ options = $ this -> options [ 'curlopts' ] + array ( CURLOPT_SSL_VERIFYPEER => true , CURLOPT_RETURNTRANSFER => true , CURLOPT_HTTPHEADER => $ this -> buildHeaders ( $ action ) , CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 , CURLOPT_HTTPAUTH => CURLAUTH_BASI...
Builds an array of curl options for the request
50,598
public function parseResponse ( $ response ) { $ info = curl_getinfo ( $ this -> ch ) ; $ this -> __last_response_headers = substr ( $ response , 0 , $ info [ 'header_size' ] ) ; $ this -> __last_response = substr ( $ response , $ info [ 'header_size' ] ) ; }
Pareses the response from a successful request .
50,599
protected function getTerminalWidth ( ) { if ( isset ( $ _SERVER [ 'COLUMNS' ] ) ) return ( int ) $ _SERVER [ 'COLUMNS' ] ; $ process = proc_open ( 'tput cols' , array ( 1 => array ( 'pipe' , 'w' ) , 2 => array ( 'pipe' , 'w' ) , ) , $ pipes ) ; $ width = ( int ) stream_get_contents ( $ pipes [ 1 ] ) ; proc_close ( $ p...
Tries to figure out the width of the terminal