idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
9,600 | public function handlePostDefault ( Request $ request , $ model ) { $ values = $ this -> parseRequestContent ( $ request -> content , $ model -> getResourceType ( ) ) ; $ this -> validateModelData ( $ model , $ values ) ; $ model -> fill ( $ values ) ; if ( ! $ model -> save ( ) ) { throw new Exception ( 'An unknown er... | Default handling of POST request . Must be called explicitly in handlePost function . |
9,601 | public function handlePutDefault ( Request $ request , $ model ) { if ( empty ( $ request -> id ) ) { throw new Exception ( 'No ID provided' , static :: ERROR_SCOPE | static :: ERROR_NO_ID , BaseResponse :: HTTP_BAD_REQUEST ) ; } $ updates = $ this -> parseRequestContent ( $ request -> content , $ model -> getResourceT... | Default handling of PUT request . Must be called explicitly in handlePut function . |
9,602 | public function handleDeleteDefault ( Request $ request , $ model ) { if ( empty ( $ request -> id ) ) { throw new Exception ( 'No ID provided' , static :: ERROR_SCOPE | static :: ERROR_NO_ID , BaseResponse :: HTTP_BAD_REQUEST ) ; } $ model = $ model :: find ( $ request -> id ) ; if ( is_null ( $ model ) ) { return nul... | Default handling of DELETE request . Must be called explicitly in handleDelete function . |
9,603 | public function on ( $ icon , array $ classes = array ( ) , $ style = 'fas' ) { if ( is_string ( $ icon ) === false ) { throw new \ InvalidArgumentException ( 'Icon label must be a string.' ) ; } if ( is_string ( $ style ) === false ) { throw new \ InvalidArgumentException ( 'The style label must be a string.' ) ; } if... | Finishes the stack after created by the main FontAwesome class stack method creates the stack object . |
9,604 | protected function parse ( ) { $ content = $ this -> comment ; $ content = preg_replace ( '/\r\n/' , "\n" , $ content ) ; $ content = preg_replace ( '/\t/' , ' ' , $ content ) ; $ content = preg_replace ( '/^\s*/m' , '' , $ content ) ; $ content = preg_replace ( '/\s*\/\*\*#?@?\+?\s*/m' , '' , $ content ) ; $ conten... | Parses the docblock |
9,605 | public function getDescription ( ) { $ description = $ this -> getShortDescription ( ) ; if ( $ this -> hasLongDescription ( ) ) { $ description .= "\n\n" . $ this -> getLongDescription ( ) ; } return $ description ; } | Gets the short and long description in the comment |
9,606 | public static function factory ( array $ config = [ ] ) { $ required = [ 'base_uri' ] ; if ( $ missing = array_diff ( $ required , array_keys ( $ config ) ) ) { throw new \ InvalidArgumentException ( 'Config is missing the following keys: ' . implode ( ', ' , $ missing ) ) ; } $ serviceConfig = json_decode ( file_get_c... | Factory method to create a new Swagger Docs client . |
9,607 | public function register ( ) { $ this -> config = $ this -> app -> make ( 'config' ) ; $ this -> packages = $ this -> config -> get ( 'domains.user-binding' ) ; $ files = \ File :: allFiles ( config_path ( 'domains' ) ) ; foreach ( $ files as $ file ) { if ( $ bindings = $ this -> config -> get ( 'domains.' . basename ... | Register the API doc commands . |
9,608 | private function provideRepositories ( array $ repositories ) { foreach ( $ repositories as $ name => $ provider ) { $ this -> app -> bind ( $ name , $ provider ) ; } } | Provide repositories from packages . |
9,609 | public function process ( PluginInterface $ plugin , Bot $ bot ) { if ( $ plugin instanceof EventEmitterAwareInterface ) { $ plugin -> setEventEmitter ( $ bot -> getClient ( ) ) ; } } | Injects the bot s event emitter into the plugin if it implements \ Phergie \ Irc \ Bot \ React \ EventEmitterAwareInterface . |
9,610 | protected function getAppNamespace ( ) { $ composer = json_decode ( file_get_contents ( base_path ( ) . '/composer.json' ) , true ) ; foreach ( ( array ) data_get ( $ composer , 'autoload.psr-4' ) as $ namespace => $ path ) { foreach ( ( array ) $ path as $ pathChoice ) { if ( realpath ( app_path ( ) ) == realpath ( ba... | Returns App namespace . |
9,611 | public function escapeParam ( $ string ) { foreach ( [ "\r\n" , "\r" , "\n" ] as $ badBytes ) { if ( false !== strpos ( $ string , $ badBytes ) ) { $ string = str_replace ( $ badBytes , " " , $ string ) ; } } if ( false !== strpos ( $ string , "\0" ) ) { $ string = str_replace ( "\0" , "" , $ string ) ; } return $ stri... | Replaces bytes in a string that might cause it to be truncated or otherwise misinterpreted by the server . |
9,612 | protected function getParameterInfo ( ) { $ params = array ( ) ; $ parameters = $ this -> reflection -> getParameters ( ) ; foreach ( $ parameters as $ parameter ) { $ params [ $ parameter -> getName ( ) ] = array ( 'name' => $ parameter -> getName ( ) , 'hint_type' => $ parameter -> getOriginalTypeHint ( ) , 'type' =>... | Gets an array of simplified information about the parameters of this method |
9,613 | protected function getParameters ( ) { $ strings = array ( ) ; foreach ( $ this -> getParameterInfo ( ) as $ name => $ parameter ) { if ( $ parameter [ 'type' ] ) { $ strings [ ] = ':type $' . $ name . ': ' . $ parameter [ 'type' ] ; } $ string = ':param $' . $ name . ':' ; if ( isset ( $ parameter [ 'comment' ] ) && $... | Gets an array of parameter information in ReST format |
9,614 | protected function getReturnValue ( ) { $ annotations = array_filter ( $ this -> getParser ( ) -> getAnnotations ( ) , function ( $ v ) { $ e = explode ( ' ' , $ v ) ; return isset ( $ e [ 0 ] ) && $ e [ 0 ] == '@return' ; } ) ; foreach ( $ annotations as $ parameter ) { $ parts = explode ( ' ' , $ parameter ) ; if ( c... | Gets the return value ReST notation |
9,615 | public static function findByTypeAndPattern ( $ type = '' , $ pattern = '' ) { $ where = '1 = 1' ; $ where_type = '' ; $ where_like = '' ; $ where_rlike = '' ; $ placeholder = [ ] ; if ( $ type === 'payload' ) { $ pattern = filter_var ( $ pattern , FILTER_VALIDATE_EMAIL ) ? 'user_email' : $ pattern ; $ pattern = is_pho... | Get node by node type and pattern |
9,616 | public function setAnswersAttribute ( $ value ) { if ( is_array ( $ value ) ) { $ value = giga_array_filter ( $ value ) ; $ this -> attributes [ 'answers' ] = json_encode ( $ value , JSON_UNESCAPED_UNICODE ) ; } else { $ this -> attributes [ 'answers' ] = $ value ; } } | Auto json encode the answers attribute |
9,617 | protected function skipEmptyUpdate ( FormBuilderInterface $ formBuilder , $ fieldDefinitionIdentifier ) { $ options = array ( 'mapped' => false , 'data' => 'yes' , ) ; $ formBuilder -> add ( "ezforms_skip_empty_update_{$fieldDefinitionIdentifier}" , HiddenType :: class , $ options ) ; } | Adds a hidden field to the from indicating that empty value passed for update should be ignored . |
9,618 | public static function process ( $ event ) { if ( $ event -> account_linking -> status === 'linked' ) { $ authorization_code = $ event -> account_linking -> authorization_code ; $ user_id = str_replace ( 'user_id:' , '' , $ authorization_code ) ; return self :: linkWithExistingUser ( $ event -> sender -> id , $ user_id... | Process the account linking |
9,619 | public function detect ( $ request ) { $ this -> driver = new Facebook ; foreach ( $ this -> drivers as $ driver_class ) { if ( ( new $ driver_class ) -> expectedFormat ( $ request ) ) { $ this -> driver = new $ driver_class ; break ; } } } | Detect driver based on incoming request |
9,620 | public function run ( & $ request ) { $ this -> detect ( $ request ) ; $ request = $ this -> driver -> formatIncomingRequest ( $ request ) ; } | Detect the driver and format the request to Facebook format |
9,621 | public function validateArray ( Array $ values ) { if ( count ( $ this -> getValidationRules ( ) ) ) { $ validator = Validator :: make ( $ values , $ this -> getValidationRules ( ) ) ; if ( $ validator -> fails ( ) ) { return $ validator -> errors ( ) ; } } return True ; } | Validate passed values |
9,622 | public function toArray ( ) { $ relations = [ ] ; $ arrayableRelations = [ ] ; foreach ( $ this -> exposedRelations as $ relation ) { if ( in_array ( $ relation , $ this -> relationsFromMethod ) ) { if ( ! isset ( $ this -> $ relation ) ) { $ this -> $ relation = $ this -> $ relation ( ) ; } $ arrayableRelations [ $ re... | Convert the model instance to an array . This method overrides that of Eloquent to prevent relations to be serialize into output array . |
9,623 | protected function setRelatedEntityColumnInfo ( array & $ association , array $ fields ) { $ mdataName = implode ( '.' , $ fields ) ; $ lastField = Container :: camelize ( array_pop ( $ fields ) ) ; $ joinName = $ this -> tableName ; $ entityName = '' ; $ columnName = '' ; $ metadata = $ this -> metadata ; while ( $ fi... | Parse a dotted - notation column format from the mData and sets association information |
9,624 | protected function setSingleFieldColumnInfo ( array & $ association , $ fieldName ) { $ fieldName = Container :: camelize ( $ fieldName ) ; if ( ! $ this -> metadata -> hasField ( lcfirst ( $ fieldName ) ) ) { throw new Exception ( "Field '$fieldName' not found.)" , '404' ) ; } $ association [ 'fieldName' ] = $ fieldNa... | Configures association information for a single field request from the main entity |
9,625 | protected function getJoinName ( ClassMetadata $ metadata , $ tableName , $ entityName ) { $ joinName = $ tableName ; if ( $ metadata -> getName ( ) == $ this -> metadata -> getName ( ) ) { $ joinName .= "_$entityName" ; } return $ joinName ; } | Based on association information and metadata construct the join name |
9,626 | public function setDefaultJoinType ( $ joinType ) { if ( defined ( 'self::JOIN_' . strtoupper ( $ joinType ) ) ) { $ this -> defaultJoinType = constant ( 'self::JOIN_' . strtoupper ( $ joinType ) ) ; } return $ this ; } | Set the default join type to use for associations . Defaults to JOIN_INNER |
9,627 | public function setLimit ( QueryBuilder $ qb ) { if ( isset ( $ this -> offset ) && $ this -> amount != '-1' ) { $ qb -> setFirstResult ( $ this -> offset ) -> setMaxResults ( $ this -> amount ) ; } } | Set the scope of the result set |
9,628 | public function setOrderBy ( QueryBuilder $ qb ) { if ( isset ( $ this -> request [ 'iSortCol_0' ] ) ) { for ( $ i = 0 ; $ i < intval ( $ this -> request [ 'iSortingCols' ] ) ; $ i ++ ) { if ( $ this -> request [ 'bSortable_' . intval ( $ this -> request [ 'iSortCol_' . $ i ] ) ] == "true" ) { $ qb -> addOrderBy ( $ th... | Set any column ordering that has been requested |
9,629 | public function setWhere ( QueryBuilder $ qb ) { if ( $ this -> search != '' ) { $ orExpr = $ qb -> expr ( ) -> orX ( ) ; for ( $ i = 0 ; $ i < count ( $ this -> parameters ) ; $ i ++ ) { if ( isset ( $ this -> request [ 'bSearchable_' . $ i ] ) && $ this -> request [ 'bSearchable_' . $ i ] == "true" ) { $ qbParam = "s... | Configure the WHERE clause for the Doctrine QueryBuilder if any searches are specified |
9,630 | public function setAssociations ( QueryBuilder $ qb ) { foreach ( $ this -> assignedJoins as $ joinName => $ joinInfo ) { $ joinType = isset ( $ this -> joinTypes [ $ joinInfo [ 'mdataColumn' ] ] ) ? $ this -> joinTypes [ $ joinInfo [ 'mdataColumn' ] ] : $ this -> defaultJoinType ; call_user_func_array ( array ( $ qb ,... | Configure joins for entity associations |
9,631 | public function setSelect ( QueryBuilder $ qb ) { $ columns = array ( ) ; $ partials = array ( ) ; foreach ( array_keys ( $ this -> assignedJoins ) as $ joinName ) { $ columns [ $ joinName ] = array ( ) ; } foreach ( $ this -> associations as $ column ) { $ parts = explode ( '.' , $ column [ 'fullName' ] ) ; $ columns ... | Configure the specific columns to select for the query |
9,632 | public function executeSearch ( ) { $ output = array ( "aaData" => array ( ) ) ; $ query = $ this -> qb -> getQuery ( ) -> setHydrationMode ( Query :: HYDRATE_ARRAY ) ; $ items = $ this -> useDoctrinePaginator ? new Paginator ( $ query , $ this -> doesQueryContainCollections ( ) ) : $ query -> execute ( ) ; foreach ( $... | Execute the QueryBuilder object parse and save the results |
9,633 | public function setDefaultResultType ( $ resultType ) { if ( defined ( 'self::RESULT_' . strtoupper ( $ resultType ) ) ) { $ this -> defaultResultType = constant ( 'self::RESULT_' . strtoupper ( $ resultType ) ) ; } return $ this ; } | Set the default result type to use when calling getSearchResults |
9,634 | public function getSearchResults ( $ resultType = '' ) { if ( empty ( $ resultType ) || ! defined ( 'self::RESULT_' . strtoupper ( $ resultType ) ) ) { $ resultType = $ this -> defaultResultType ; } else { $ resultType = constant ( 'self::RESULT_' . strtoupper ( $ resultType ) ) ; } $ this -> makeSearch ( ) ; $ this ->... | Creates and executes the DataTables search returns data in the requested format |
9,635 | protected function getClassName ( $ className ) { if ( strpos ( $ className , ':' ) !== false ) { list ( $ namespaceAlias , $ simpleClassName ) = explode ( ':' , $ className ) ; $ className = $ this -> doctrine -> getManager ( ) -> getConfiguration ( ) -> getEntityNamespace ( $ namespaceAlias ) . '\\' . $ simpleClassNa... | Given an entity class name or possible alias convert it to the full class name |
9,636 | private function addNode ( $ answers , $ node_type , $ ask = '' , array $ attributes = [ ] ) { $ node = Node :: where ( [ 'type' => $ node_type , 'pattern' => $ ask ] ) -> first ( ) ; if ( is_null ( $ node ) ) { $ node = Node :: create ( array_merge ( [ 'type' => $ node_type , 'pattern' => $ ask , 'answers' => $ answer... | Add Answer to the database |
9,637 | public function queryParameter ( $ key ) { $ keys = array_pluck ( $ this -> queryParameters , 'key' ) ; $ queryParameters = array_combine ( $ keys , $ this -> queryParameters ) ; return $ queryParameters [ $ key ] ; } | Gets the respective parameter |
9,638 | public function whereParameters ( ) { return array_filter ( $ this -> queryParameters , function ( $ queryParameter ) { $ key = $ queryParameter [ 'key' ] ; return ( ! in_array ( $ key , $ this -> predefinedParams ) ) ; } ) ; } | Gets the WHERE parameters |
9,639 | private function setQueryParameters ( $ query ) { $ query = addslashes ( $ query ) ; $ queryParameters = array_filter ( explode ( '&' , $ query ) ) ; array_map ( [ $ this , 'appendQueryParameter' ] , $ queryParameters ) ; } | Sets the query parameters |
9,640 | private function appendQueryParameter ( $ parameter ) { preg_match ( $ this -> pattern , $ parameter , $ matches ) ; if ( empty ( $ matches ) ) { return ; } $ operator = $ matches [ 0 ] ; list ( $ key , $ value ) = explode ( $ operator , $ parameter ) ; if ( strlen ( $ value ) == 0 ) { return ; } if ( ( ! $ this -> isP... | Appends one parameter to the builder |
9,641 | public function compare ( $ priority1 , $ priority2 ) { if ( ! $ priority1 instanceof EventQueuePriority || ! $ priority2 instanceof EventQueuePriority ) { return parent :: compare ( $ priority1 , $ priority2 ) ; } $ priority = $ priority1 -> value - $ priority2 -> value ; if ( ! $ priority ) { $ priority = $ priority2... | Overrides native default comparison logic to assign higher priority to events inserted earlier . |
9,642 | public function hasPermission ( $ permission ) { return ( is_array ( $ this -> permissions ) && isset ( $ this -> permissions [ $ permission ] ) && $ this -> permissions [ $ permission ] == true ) || ( isset ( $ this -> permissions [ 'administrator' ] ) && $ this -> permissions [ 'administrator' ] == true ) ; } | Check if group has specified permission |
9,643 | public static function updateMessengerProfile ( ) { $ update = [ ] ; $ delete = [ ] ; $ irregular = [ 'get_started' => 'get_started_button_payload' , ] ; $ resource = self :: getResourceUrl ( ) ; foreach ( self :: $ fields as $ field_name ) { if ( ! isset ( $ irregular [ $ field_name ] ) ) { $ field_value = Instance ::... | Update all fields |
9,644 | public static function updateField ( $ field_name ) { $ irregular = [ 'get_started' => 'get_started_button_payload' , 'greeting' => 'greeting_text' ] ; if ( ! isset ( $ irregular [ $ field_name ] ) ) { $ field_value = Instance :: get ( $ field_name ) ; } else { $ field_value = Instance :: get ( $ irregular [ $ field_na... | Update each fields separately |
9,645 | function _getCachedIPN ( ) { $ om = $ this -> objectManager ; if ( ! ( $ cache = $ om -> getRepository ( $ this -> clsIpnLog ) -> findOneBy ( array ( 'listenerName' => 'IPN' , 'transactionType' => 'cache' ) ) ) ) { return FALSE ; } else { return unserialize ( $ cache -> getDetail ( ) ) ; } } | Retrieve the cached IPN record if there is one false if there isn t |
9,646 | protected function ensureBuildDir ( $ path , OutputInterface $ output ) { $ parts = explode ( DIRECTORY_SEPARATOR , $ this -> getPath ( ) ) ; foreach ( $ parts as $ part ) { if ( ! $ part ) continue ; $ path .= DIRECTORY_SEPARATOR . $ part ; if ( ! file_exists ( $ path ) ) { $ output -> writeln ( sprintf ( '<info>Creat... | Ensures the build directory is in place |
9,647 | public function buildClasses ( $ basedir , OutputInterface $ output ) { $ target = $ this -> ensureBuildDir ( $ basedir , $ output ) ; foreach ( $ this -> getClasses ( ) as $ element ) { $ element -> build ( $ target , $ output ) ; } } | Builds the class information |
9,648 | public function buildIndex ( $ basedir , OutputInterface $ output , array $ options = array ( ) ) { $ target = $ this -> ensureBuildDir ( $ basedir , $ output ) ; $ built_iterator = new DirectoryIterator ( $ target ) ; $ index = $ target . DIRECTORY_SEPARATOR . 'index.rst' ; $ title = str_replace ( '\\' , '\\\\' , $ th... | Builds the index file |
9,649 | public function getMeuBoletim ( $ year , $ term ) { $ url = $ this -> endpoint . 'minhas-informacoes/boletim/' . $ year . '/' . $ term . '/' ; return $ this -> doGetRequest ( $ url ) ; } | Pega o boletim do aluno autenticado . |
9,650 | private function doGetRequest ( $ url ) { $ response = $ this -> client -> request ( 'GET' , $ url , [ 'headers' => [ 'Authorization' => 'JWT ' . $ this -> token , ] , ] ) ; $ data = false ; if ( $ response -> getStatusCode ( ) == 200 ) { $ data = json_decode ( $ response -> getBody ( ) , true ) ; } return $ data ; } | Faz um request GET para um endpoint definido . |
9,651 | public function inGroup ( $ slug ) { return $ this -> groups -> contains ( function ( $ group ) use ( $ slug ) { return $ group -> slug === $ slug || $ group -> id === $ slug ; } ) ; } | Check if current user in group by id or slug |
9,652 | public function getFacebookPages ( ) { if ( $ this -> isConnectedToFacebook ( ) !== true ) { return null ; } $ response = Facebook :: load ( ) -> get ( '/me/accounts' , $ this -> data ( 'access_token' ) ) ; $ chunks = [ ] ; $ edges = [ ] ; for ( $ i = 0 ; $ i <= 100 ; $ i ++ ) { if ( $ i === 0 ) { $ edges [ 0 ] = $ res... | Get Facebook Pages of current user if connected to Facebook |
9,653 | public function process ( PluginInterface $ plugin , Bot $ bot ) { if ( $ plugin instanceof LoggerAwareInterface ) { $ plugin -> setLogger ( $ bot -> getLogger ( ) ) ; } } | Injects the bot s logger into the plugin if it implements \ Psr \ Log \ LoggerAwareInterface . |
9,654 | public function get ( $ key , $ defaultValue = null ) { $ rawValue = $ this -> getEnvironmentVariable ( $ key ) ; return $ this -> getValue ( $ rawValue , $ defaultValue ) ; } | Get value from environment . |
9,655 | public function createFromBuilder ( Builder $ builder ) { $ this -> model = $ builder -> getModel ( ) ; $ this -> query = $ builder ; $ this -> build ( ) ; return $ this ; } | Create the Query from an existing builder |
9,656 | public function createFromModel ( Model $ model ) { $ this -> model = $ model ; $ this -> query = $ this -> model -> newQuery ( ) ; return $ this ; } | Create the query from an empty model |
9,657 | protected function setIcon ( $ icon ) { if ( is_string ( $ icon ) === false ) { throw new \ InvalidArgumentException ( 'The icon label must be a string.' ) ; } $ this -> icon = $ icon ; return $ this ; } | Sets icon label |
9,658 | protected function setMask ( $ icon , $ style = 'fas' ) { if ( is_string ( $ icon ) === false ) { throw new \ InvalidArgumentException ( 'The mask icon label must be a string.' ) ; } if ( is_string ( $ style ) === false ) { throw new \ InvalidArgumentException ( 'The mask style label must be a string.' ) ; } if ( ! in_... | Sets mask label |
9,659 | protected function setStyle ( $ style ) { if ( is_string ( $ style ) === false ) { throw new \ InvalidArgumentException ( 'The style label must be a string.' ) ; } if ( ! in_array ( $ style , $ this -> STYLES ) ) { throw new \ InvalidArgumentException ( 'Invalid style.' ) ; } $ this -> style = $ style ; return $ this ;... | Sets style label |
9,660 | public function addAttr ( $ attr , $ val ) { if ( is_string ( $ attr ) === false ) { throw new \ InvalidArgumentException ; } $ this -> attributes [ $ attr ] = $ val ; return $ this ; } | Adds an attribute to the icon useful for title or id |
9,661 | public function addAttrs ( array $ attrs ) { foreach ( $ attrs as $ attr => $ val ) { $ this -> addAttr ( $ attr , $ val ) ; } return $ this ; } | Batch adds an attributes to the icon |
9,662 | public function createDirectories ( ) { if ( ! file_exists ( $ this -> getDomainPath ( ) ) ) { mkdir ( $ this -> getDomainPath ( ) , 0777 ) ; } if ( ! file_exists ( $ this -> getInfrastructurePath ( ) ) ) { mkdir ( $ this -> getInfrastructurePath ( ) , 0777 ) ; } if ( ! file_exists ( $ this -> getTestPath ( ) ) ) { mkd... | Prepare directories . |
9,663 | public function copyDomain ( $ name ) { file_put_contents ( $ this -> getDomainPath ( "/Contracts/{$name}Interface.php" ) , $ this -> prepare ( file_get_contents ( $ this -> domainInterfaceContract ) ) ) ; file_put_contents ( $ this -> getDomainPath ( "/Contracts/{$name}RepositoryInterface.php" ) , $ this -> prepare ( ... | Copy domains . |
9,664 | public static function css ( $ pro = false ) { if ( $ pro ) { $ url = 'pro.fontawesome.com' ; $ integrity = 'sha384-Bx4pytHkyTDy3aJKjGkGoHPt3tvv6zlwwjc3iqN7ktaiEMLDPqLSZYts2OjKcBx1' ; } else { $ url = 'use.fontawesome.com' ; $ integrity = 'sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf' ; } ret... | HTML link to the FontAwesome CSS file through the FontAwesome CDN |
9,665 | public static function js ( $ pro = false ) { if ( $ pro ) { $ url = 'pro.fontawesome.com' ; $ integrity = 'sha384-GBwm0s/0wYcqnK/JmrCoRqWYIWzFiGEucsfFqkB76Ouii5+d4R31vWHPQtfhv55b' ; } else { $ url = 'use.fontawesome.com' ; $ integrity = 'sha384-g5uSoOSBd7KkhAMlnQILrecXvzst9TdC09/VM+pjDTCM+1il8RHz5fKANTFFb+gQ' ; } retu... | HTML link to the FontAwesome JS file through the FontAwesome CDN |
9,666 | protected function output ( ) { $ attrs = '' ; $ classes = $ this -> style . ' fa-' . $ this -> icon ; $ transforms = '' ; $ mask = '' ; if ( ! empty ( $ this -> classes ) && count ( $ this -> classes ) > 0 ) { $ classes .= ' ' . implode ( ' ' , $ this -> classes ) ; } if ( ! empty ( $ this -> attributes ) && count ( $... | Builds the icon from the template |
9,667 | public function ul ( $ iconsOrItems , $ listItems = array ( ) ) { $ has_string_keys = function ( array $ array ) { return count ( array_filter ( array_keys ( $ array ) , 'is_string' ) ) > 0 ; } ; if ( is_string ( $ iconsOrItems ) === false && is_array ( $ iconsOrItems ) === false ) { throw new IncompleteListException (... | Begins building an unordered list with icons |
9,668 | public function stack ( $ icon , array $ classes = array ( ) ) { if ( is_string ( $ icon ) === false ) { throw new \ InvalidArgumentException ( 'Icon label must be a string.' ) ; } return new FontAwesomeStack ( $ icon , $ classes ) ; } | Sets the top icon to be used in a stack |
9,669 | public function store ( $ label ) { if ( $ this -> icon === null ) { throw new CollectionIconException ( 'There was no icon defined to store.' ) ; } if ( is_string ( $ label ) === false || empty ( $ label ) === true ) { throw new \ InvalidArgumentException ( 'Collection icon label must be a non-empty string.' ) ; } $ t... | Stores icon to be rendered later and resets |
9,670 | public function collection ( $ label ) { if ( is_string ( $ label ) === false ) { throw new \ InvalidArgumentException ( 'Collection icon label must be a string.' ) ; } if ( isset ( $ this -> collection [ $ label ] ) === false ) { throw new CollectionIconException ( 'Collection icon "' . $ label . '" does not exist.' )... | Retrieve icon from collection |
9,671 | private function resetAndOutput ( $ htmlOutput ) { $ this -> icon = null ; $ this -> classes = null ; $ this -> attributes = null ; $ this -> mask = null ; $ this -> style = self :: DEFAULT_STYLE ; return ( string ) $ htmlOutput ; } | Outputs the current contents to the page . |
9,672 | static public function create ( $ width , $ height ) { $ image = imagecreatetruecolor ( $ width , $ height ) ; imagealphablending ( $ image , false ) ; imagesavealpha ( $ image , true ) ; return new self ( $ image ) ; } | Creates an instance with specified size |
9,673 | public function copyFrom ( Imagery $ source ) { imagecopyresampled ( $ this -> _image , $ source -> resource , 0 , 0 , 0 , 0 , $ this -> width , $ this -> height , $ source -> width , $ source -> height ) ; return $ this ; } | Copies an image fron another instance with zoom |
9,674 | public function flip ( $ horizontal = true ) { if ( function_exists ( 'imageflip' ) ) { imageflip ( $ this -> _image , $ horizontal ? IMG_FLIP_HORIZONTAL : IMG_FLIP_VERTICAL ) ; } else { $ image = imagecreatetruecolor ( $ this -> width , $ this -> height ) ; imagealphablending ( $ image , false ) ; imagesavealpha ( $ i... | Flips an image . |
9,675 | public function filter ( $ filter ) { if ( ! in_array ( $ filter , array ( self :: FILTER_NEGATE , self :: FILTER_GRAYSCALE ) ) ) return false ; imagefilter ( $ this -> resource , $ filter ) ; return $ this ; } | Applies a filter to image |
9,676 | public function changeBrightness ( $ newValue ) { $ newValue = max ( - 255 , min ( 255 , $ newValue ) ) ; imagefilter ( $ this -> resource , IMG_FILTER_BRIGHTNESS , $ newValue ) ; return $ this ; } | Changes brightness of image |
9,677 | public function colorize ( $ red , $ green , $ blue , $ alpha = 127 ) { $ normalizer = function ( $ value ) { return max ( - 255 , min ( 255 , $ value ) ) ; } ; $ red = $ normalizer ( $ red ) ; $ green = $ normalizer ( $ green ) ; $ blue = $ normalizer ( $ blue ) ; $ alpha = min ( 127 , max ( 0 , $ alpha ) ) ; imagefil... | Changes colors of image |
9,678 | public function blur ( $ method = self :: GAUSSIAN_BLUR ) { if ( ! in_array ( $ method , array ( self :: GAUSSIAN_BLUR , self :: SELECTIVE_BLUR ) ) ) return false ; imagefilter ( $ this -> resource , $ method ) ; return $ this ; } | Blurs an image |
9,679 | public function smooth ( $ level = 1 ) { $ level = max ( 1 , min ( 8 , $ level ) ) ; if ( $ level == 8 ) $ level = 9 ; imagefilter ( $ this -> resource , IMG_FILTER_SMOOTH , - $ level ) ; return $ this ; } | Smooths an image |
9,680 | public function pixelate ( $ blockSize = 5 , $ useModernEffect = true ) { imagefilter ( $ this -> resource , IMG_FILTER_PIXELATE , $ blockSize , $ useModernEffect ) ; return $ this ; } | Pixelates an image |
9,681 | public static function send ( BroadcastModel $ broadcast ) { $ broadcastProperties = [ 'message_creative_id' => $ broadcast -> message_creative_id , 'notification_type' => $ broadcast -> notification_type , 'tag' => $ broadcast -> tags ] ; $ receivers = $ broadcast -> getReceivers ( ) ; $ receivers = $ receivers !== nu... | Send Broadcast to Facebook and let they do the rest |
9,682 | public static function createMessageCreative ( BroadcastModel $ broadcast ) { if ( is_numeric ( $ broadcast -> content ) ) { $ template = Node :: find ( $ broadcast -> content ) -> answers ; } else { $ model = new Model ; $ template = $ model -> parse ( json_decode ( $ broadcast -> content , true ) ) ; } $ messages = [... | Because each message creative can only attach to 1 broadcast so we ll create message creative each time we send |
9,683 | public function verbose ( $ resource ) { $ this -> logger -> pushHandler ( new StreamHandler ( $ resource , Logger :: DEBUG ) ) ; return $ this ; } | Enable debug logging to show build progress |
9,684 | private function setInitValue ( $ key , $ value ) { if ( $ this -> serviceDescription !== null ) { throw new \ RuntimeException ( 'Too late to set "' . $ key . '"' ) ; } $ this -> init [ $ key ] = $ value ; return $ this ; } | Set an initial value to be passed to ServiceDescription constructor . |
9,685 | public function getServiceDescription ( ) { if ( $ this -> serviceDescription === null ) { $ this -> serviceDescription = new Description ( $ this -> init ) ; } return $ this -> serviceDescription ; } | Get compiled Guzzle service description |
9,686 | public function registerResponseClass ( $ name , $ class ) { $ this -> responseClasses [ $ name ] = $ class ; if ( $ this -> serviceDescription !== null && $ this -> hasOperation ( $ name ) === true ) { throw new \ LogicException ( "Too late to add new response class, {$name} operation has already been defined. " . 'If... | Apply a bespoke responseClass to a given method |
9,687 | public function build ( $ baseUri ) { $ this -> serviceDescription = null ; $ client = SwaggerClient :: factory ( [ 'base_uri' => $ baseUri ] ) ; $ this -> debug ( 'Fetching resource listing from %s' , $ baseUri ) ; $ listing = $ client -> getResources ( ) ; if ( ! $ listing -> isSwagger ( ) ) { throw new \ RuntimeExce... | Build from a live endpoint |
9,688 | private function createModel ( array $ model , $ location ) { $ name = null ; if ( isset ( $ model [ 'id' ] ) === true ) { $ name = trim ( $ model [ 'id' ] ) ; } elseif ( isset ( $ model [ 'nickname' ] , $ this -> responseClasses [ $ model [ 'nickname' ] ] ) ) { $ name = $ model [ 'nickname' ] ; } elseif ( isset ( $ mo... | Create a Swagger model definition |
9,689 | public function addModel ( array $ modelData ) { $ model = $ this -> createModel ( $ modelData , $ this -> responseType ) ; $ modelData = $ model -> toArray ( ) ; if ( $ modelData [ 'type' ] === 'array' && isset ( $ modelData [ 'name' ] ) ) { unset ( $ modelData [ 'name' ] ) ; } $ this -> debug ( '+ adding model %s' , ... | Add a response model |
9,690 | private function transformParams ( array $ params ) { $ locations = [ ] ; $ namespace = [ ] ; foreach ( $ params as $ name => $ param ) { if ( isset ( $ param [ 'name' ] ) ) { $ name = $ param [ 'name' ] ; } else { $ param [ 'name' ] = $ name ; } $ param = $ this -> transformSchema ( $ param ) ; $ location = isset ( $ ... | Transform a swagger parameter to a Guzzle one |
9,691 | private function transformLocation ( $ paramType ) { static $ valid = [ 'uri' => 1 , 'xml' => 1 , 'json' => 1 , 'body' => 1 , 'query' => 1 , 'header' => 1 , 'formParam' => 1 , ] ; if ( isset ( $ valid [ $ paramType ] ) ) { return $ paramType ; } static $ aliases = [ 'path' => 'uri' , 'body' => 'body' , 'form' => 'formP... | Transform a Swagger request paramType to a Guzzle location . Note that Guzzle has response locations too . |
9,692 | private function transformArray ( array $ swagger , array $ common , array $ trans ) { $ guzzle = array_intersect_key ( $ swagger , $ common ) ; foreach ( $ trans as $ source => $ target ) { if ( isset ( $ swagger [ $ source ] ) ) { $ guzzle [ $ target ] = $ swagger [ $ source ] ; } } return $ guzzle ; } | Utility transform an array based on similarities and differences between the two formats . |
9,693 | private static function mergeUrl ( $ uri , $ baseUrl ) { $ href = parse_url ( $ uri ) ; $ base = parse_url ( $ baseUrl ) ; $ full = $ href + $ base + parse_url ( 'http://localhost/' ) ; return $ full [ 'scheme' ] . '://' . $ full [ 'host' ] . $ full [ 'path' ] ; } | Utility for merging any URI into a fully qualified one |
9,694 | public function toArray ( ) { $ result = [ 'name' => $ this -> init [ 'name' ] , 'apiVersion' => $ this -> init [ 'apiVersion' ] , 'baseUri' => isset ( $ this -> init [ 'baseUri' ] ) ? $ this -> init [ 'baseUri' ] : '' , 'description' => $ this -> init [ 'description' ] , ] ; $ result [ 'operations' ] = $ this -> opera... | Export service description to JSON |
9,695 | public function leadsCount ( ) { if ( isset ( $ this -> to_lead ) && is_array ( $ this -> to_lead ) ) { return count ( $ this -> to_lead ) ; } return count ( Subscription :: getSubscribers ( $ this -> to_channel ) ) ; } | Get total leads of a channel |
9,696 | public function scopeStillActive ( $ query ) { $ query -> where ( function ( $ query ) { return $ query -> where ( 'start_at' , '<=' , Carbon :: now ( ) ) -> orWhereNull ( 'start_at' ) ; } ) -> where ( function ( $ query ) { return $ query -> where ( 'end_at' , '>=' , Carbon :: now ( ) ) -> orWhereNull ( 'end_at' ) ; }... | Get active broadcast |
9,697 | public function answer ( $ ask , $ answers = null , $ attributes = [ ] ) { return $ this -> answers ( $ ask , $ answers , $ attributes ) ; } | Response user question with answers |
9,698 | public function answers ( $ asks , $ answers = null , $ attributes = [ ] ) { $ this -> model -> addNode ( $ asks , $ answers , $ attributes ) ; return $ this ; } | Format answer from short hand to proper form . |
9,699 | public function says ( $ messages , $ attributes = [ ] , $ lead_ids = null ) { $ messages = $ this -> model -> parse ( $ messages ) ; if ( ! is_null ( $ lead_ids ) ) { $ lead_ids = ( array ) $ lead_ids ; $ leads = Lead :: withTrashed ( ) -> whereIn ( 'user_id' , $ lead_ids ) -> get ( ) ; if ( empty ( $ leads ) || $ lea... | Send message to user . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.