idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
37,000 | public function isGitCommandAvailable ( $ command = 'git' ) { exec ( 'where ' . $ command . ' 2>&1' , $ output , $ returnValue ) ; if ( ( new OsHelper ( ) ) -> isWindows ( ) === false ) { exec ( 'which ' . $ command . ' 2>&1' , $ output , $ returnValue ) ; } return $ returnValue === 0 ; } | Is the Git command available? |
37,001 | public function createArchive ( ) { if ( $ this -> hasHead ( ) ) { $ command = 'git archive -o ' . $ this -> getFilename ( ) . ' HEAD 2>&1' ; exec ( $ command , $ output , $ returnValue ) ; return $ returnValue === 0 ; } throw new GitHeadNotAvailable ( 'No Git HEAD present to create an archive from.' ) ; } | Create a Git archive from the current HEAD . |
37,002 | public function compareArchive ( array $ unexpectedArtifacts ) { $ foundUnexpectedArtifacts = [ ] ; $ archive = new PharData ( $ this -> getFilename ( ) ) ; $ hasLicenseFile = false ; foreach ( $ archive as $ archiveFile ) { if ( $ archiveFile instanceof \ SplFileInfo ) { if ( $ archiveFile -> isDir ( ) ) { $ file = basename ( $ archiveFile ) . '/' ; if ( in_array ( $ file , $ unexpectedArtifacts ) ) { $ foundUnexpectedArtifacts [ ] = $ file ; } continue ; } $ file = basename ( $ archiveFile ) ; if ( $ this -> validateLicenseFilePresence ( ) ) { if ( preg_match ( '/(License.*)/i' , $ file ) ) { $ hasLicenseFile = true ; } } if ( in_array ( $ file , $ unexpectedArtifacts ) ) { $ foundUnexpectedArtifacts [ ] = $ file ; } } } if ( $ this -> validateLicenseFilePresence ( ) && $ hasLicenseFile === false ) { throw new NoLicenseFilePresent ( 'No license file present in archive.' ) ; } sort ( $ foundUnexpectedArtifacts , SORT_STRING | SORT_FLAG_CASE ) ; return $ foundUnexpectedArtifacts ; } | Compare archive against unexpected artifacts . |
37,003 | public function getUnexpectedArchiveArtifacts ( array $ unexpectedArtifacts ) { $ this -> createArchive ( ) ; $ this -> foundUnexpectedArtifacts = $ this -> compareArchive ( $ unexpectedArtifacts ) ; $ this -> removeArchive ( ) ; return $ this -> foundUnexpectedArtifacts ; } | Delegator for temporary archive creation and comparison against a set of unexpected artifacts . |
37,004 | public function ratio ( ) { $ w = $ this -> width ( ) ; $ h = $ this -> height ( ) ; if ( $ w > $ h ) { return $ w / $ h ; } else { return $ h / $ w ; } } | Gets the image resource ratio . |
37,005 | public function save ( $ filename , $ image_type = null , $ quality = null ) { $ quality = ( int ) $ quality ; if ( empty ( $ quality ) ) { $ quality = 100 ; } if ( null === $ image_type ) { $ image_type = $ this -> image_type ; } switch ( $ image_type ) { case 'gif' : case IMAGETYPE_GIF : $ success = imagegif ( $ this -> image , $ filename ) ; break ; case 'png' : case IMAGETYPE_PNG : $ quality = 9 - round ( ( $ quality / 100 ) * 9 ) ; $ success = imagepng ( $ this -> image , $ filename , $ quality ) ; break ; case 'jpeg' : case 'jpg' : case IMAGETYPE_JPEG : default : $ success = imagejpeg ( $ this -> image , $ filename , $ quality ) ; break ; } return $ success ; } | Saves the image to the given location at the given quality . |
37,006 | public function view ( UserPolicy $ user , Blog $ blog ) { if ( $ user -> canDo ( 'blog.blog.view' ) && $ user -> isAdmin ( ) ) { return true ; } return $ blog -> user_id == user_id ( ) && $ blog -> user_type == user_type ( ) ; } | Determine if the given user can view the blog . |
37,007 | public function destroy ( UserPolicy $ user , Blog $ blog ) { return $ blog -> user_id == user_id ( ) && $ blog -> user_type == user_type ( ) ; } | Determine if the given user can delete the given blog . |
37,008 | public static function fromEdge ( EdgeInterface $ edge ) : EncapsulatedEdge { $ encapsulated = new EncapsulatedEdge ( ) ; $ encapsulated -> id = $ edge -> id ( ) ; $ encapsulated -> object = $ edge ; $ encapsulated -> classes = $ encapsulated -> findClasses ( get_class ( $ edge ) ) ; return $ encapsulated ; } | Creates a new capsule from an edge . |
37,009 | protected function getMiddlewareHandlers ( \ Owl \ Http \ Request $ request ) { if ( ! $ this -> middleware_handlers ) { return [ ] ; } $ request_path = $ this -> getRequestPath ( $ request ) ; $ result = [ ] ; foreach ( $ this -> middleware_handlers as $ path => $ handlers ) { if ( strpos ( $ request_path , $ path ) === 0 ) { $ result = array_merge ( $ result , $ handlers ) ; } } return $ result ; } | get middleware handlers by request path . |
37,010 | public function intersect ( $ collection ) { $ intersect = new static ; $ dictionary = $ this -> getDictionary ( $ collection ) ; foreach ( $ this -> items as $ item ) { if ( isset ( $ dictionary [ $ item -> getKey ( ) ] ) ) { $ intersect -> add ( $ item ) ; } } return $ intersect ; } | Intersect the collection with the given items . |
37,011 | private function installParsers ( IngestParsersEvent $ event ) { $ fs = new Filesystem ( ) ; $ finder = new Finder ( ) ; try { $ pluginsDir = __DIR__ . '/../../../' ; $ namespaces = array ( ) ; $ iterator = $ finder -> ignoreUnreadableDirs ( ) -> files ( ) -> name ( '*Parser.php' ) -> notName ( 'AbstractParser.php' ) -> in ( __DIR__ . '/../Parsers/' ) ; try { $ iterator = $ iterator -> in ( $ pluginsDir . '*/*/Parsers/IngestAdapters/' ) ; } catch ( \ Exception $ e ) { } foreach ( $ iterator as $ file ) { $ classNamespace = str_replace ( realpath ( $ pluginsDir ) , '' , substr ( $ file -> getRealPath ( ) , 0 , - 4 ) ) ; $ namespace = str_replace ( '/' , '\\' , $ classNamespace ) ; $ namespaces [ ] = ( string ) $ namespace ; $ parserName = substr ( $ file -> getFilename ( ) , 0 , - 4 ) ; $ parser = $ this -> em -> getRepository ( 'Newscoop\IngestPluginBundle\Entity\Parser' ) -> findOneByNamespace ( $ namespace ) ; $ event -> registerParser ( $ parserName , array ( 'class' => $ namespace , ) ) ; if ( ! $ parser ) { $ parser = new Parser ( ) ; } $ parser -> setName ( $ namespace :: getParserName ( ) ) -> setDescription ( $ namespace :: getParserDescription ( ) ) -> setDomain ( $ namespace :: getParserDomain ( ) ) -> setRequiresUrl ( $ namespace :: getRequiresUrl ( ) ) -> setSectionHandling ( $ namespace :: getHandlesSection ( ) ) -> setNamespace ( $ namespace ) ; $ this -> em -> persist ( $ parser ) ; } $ parsersToRemove = $ this -> em -> createQuery ( ' DELETE FROM Newscoop\IngestPluginBundle\Entity\Parser AS p WHERE p.namespace NOT IN (:namespaces) ' ) -> setParameter ( 'namespaces' , $ namespaces ) -> getResult ( ) ; $ this -> em -> flush ( ) ; } catch ( \ Exception $ e ) { throw new \ Exception ( $ e -> getMessage ( ) ) ; } } | Install external parsers |
37,012 | private function requestToken ( ) { $ tokenResponse = $ this -> client -> request ( 'GET' , $ this -> config -> getAuthUrl ( ) , $ this -> config -> getAuthHeader ( ) ) ; $ this -> token = $ tokenResponse -> getBody ( ) -> getContents ( ) ; $ this -> tokenExpireTime -> modify ( sprintf ( '+%s seconds' , 3600 ) ) ; } | Make request to Watson Auth API for the new token |
37,013 | private function getAuthToken ( ) { if ( ! $ this -> token || new \ DateTime ( ) > $ this -> tokenExpireTime ) { $ this -> requestToken ( ) ; } return $ this -> token ; } | Get token for Watson |
37,014 | public function request ( Config $ config , ContentItems $ contentItems ) { $ this -> config = $ config ; $ options = [ 'headers' => [ 'X-Watson-Authorization-Token' => $ this -> getAuthToken ( ) , 'X-Watson-Learning-Opt-Out' => $ this -> config -> optOutOfLogging , 'Content-Type' => 'application/json' , 'Accept' => 'application/json' , 'Accept-Language' => 'en' ] , 'body' => $ contentItems -> getContentItemsContainerJson ( ) ] ; $ response = $ this -> client -> request ( 'POST' , $ config -> getApiUrl ( ) , $ options ) ; return json_decode ( $ response -> getBody ( ) ) ; } | Makes a request to Personality Insights |
37,015 | public function register ( $ check , $ tags = [ ] ) { $ check = [ 'check' => $ check , 'tags' => [ ] ] ; if ( ! empty ( $ tags ) ) { $ check [ 'tags' ] = $ tags ; } $ this -> registeredChecks [ ] = $ check ; } | Register checks to be run with the check registry . |
37,016 | public function runChecks ( $ tags = [ ] ) { $ errors = [ ] ; $ checks = $ this -> getChecks ( ) ; if ( ! empty ( $ tags ) ) { $ taggedChecks = [ ] ; foreach ( $ checks as $ check ) { if ( array_intersect ( $ check [ 'tags' ] , $ tags ) ) { $ taggedChecks [ ] = $ check ; } } $ checks = $ taggedChecks ; } foreach ( $ checks as $ check ) { $ functionName = '' ; if ( is_array ( $ check [ 'check' ] ) ) { if ( count ( $ check [ 'check' ] ) > 1 ) { $ obj = reset ( $ check [ 'check' ] ) ; $ method = end ( $ check [ 'check' ] ) ; $ functionName = get_class ( $ obj ) . '::' . $ method ; } else { $ functionName = reset ( $ check [ 'check' ] ) ; } } $ errors = array_merge ( $ errors , call_user_func ( $ check [ 'check' ] ) ) ; assert ( is_array ( $ errors ) , sprintf ( 'The function %s did not return a list. All functions registered ". "with the checks registry must return a list.' , $ functionName ) ) ; } return $ errors ; } | Run all registered checks and return list of Errors and Warnings . |
37,017 | public function annotate ( ) { $ args = static :: formatConditions ( __METHOD__ , func_get_args ( ) ) ; $ names = $ this -> _fields ; if ( is_null ( $ this -> _fields ) ) { $ names = [ ] ; foreach ( $ this -> model -> getMeta ( ) -> getFields ( ) as $ field ) { $ names [ ] = $ field -> getName ( ) ; } } $ clone = $ this -> _clone ( ) ; foreach ( $ args as $ alias => $ arg ) { if ( in_array ( $ alias , $ names ) ) { throw new ValueError ( sprintf ( "The annotation '%s' conflicts with a field on the model." , $ alias ) ) ; } $ clone -> query -> addAnnotation ( [ 'annotation' => $ arg , 'alias' => $ alias , 'isSummary' => false ] ) ; } foreach ( $ clone -> query -> annotations as $ alias => $ annotation ) { if ( $ annotation -> containsAggregates ( ) && array_key_exists ( $ alias , $ args ) ) { if ( is_null ( $ clone -> _fields ) ) { $ clone -> query -> groupBy = true ; } else { $ clone -> query -> setGroupBy ( ) ; } } } return $ clone ; } | Return a query set in which the returned objects have been annotated with extra data or aggregations . |
37,018 | public function size ( ) { if ( $ this -> _resultsCache ) { return count ( $ this -> _resultsCache ) ; } return $ this -> query -> getCount ( $ this -> connection ) ; } | Returns the number of rows affected by the last DELETE INSERT or UPDATE statement executed by the corresponding object . |
37,019 | public static function formatConditions ( $ methondname , $ conditions ) { if ( count ( $ conditions ) > 1 ) { throw new InvalidArgumentException ( sprintf ( "Method '%s' supports a single array input" , $ methondname ) ) ; } if ( 1 == count ( $ conditions ) ) { if ( $ conditions [ 0 ] instanceof Node ) { return $ conditions ; } } $ conditions = ( empty ( $ conditions ) ) ? [ [ ] ] : $ conditions ; return call_user_func_array ( 'array_merge' , $ conditions ) ; } | Ensure the conditions passed in are ready to used to perform query operations . |
37,020 | public function asArray ( $ fields = [ ] , $ valuesOnly = false , $ flat = false ) { if ( $ flat && 1 != count ( $ fields ) ) { throw new TypeError ( "'flat' is valid when asArray is called" . ' with exactly one field.' ) ; } if ( $ flat && ! $ valuesOnly ) { throw new TypeError ( "'flat' is valid when asArray " . 'is called with valuesOnly=true.' ) ; } $ clone = $ this -> _clone ( ) ; $ clone -> _fields = $ fields ; $ clone -> query -> setValueSelect ( $ fields ) ; $ clone -> resultMapper = ( $ valuesOnly ) ? ArrayValueMapper :: class : ArrayMapper :: class ; if ( $ flat ) { $ clone -> resultMapper = ArrayFlatValueMapper :: class ; } return $ clone ; } | Returns the results as an array of associative array that represents a record in the database . |
37,021 | public function _prepareAsFilterValue ( ) { if ( is_null ( $ this -> _fields ) ) { $ queryset = $ this -> asArray ( [ 'pk' ] ) ; } else { if ( count ( $ this -> _fields ) > 1 ) { throw new TypeError ( 'Cannot use multi-field values as a filter value.' ) ; } $ queryset = $ this -> _clone ( ) ; } return $ queryset -> query -> toSubQuery ( $ queryset -> connection ) ; } | Ready this instance for use as argument in filter . |
37,022 | public static function createMessages ( $ dbMessages ) { if ( ! is_array ( $ dbMessages ) ) { $ dbMessages = [ $ dbMessages ] ; } $ result = [ ] ; foreach ( $ dbMessages as $ dbMessage ) { $ attributes = $ dbMessage -> getAttributes ( ) ; $ attributes [ 'subscriber_id' ] = $ dbMessage -> subscription_id === null ? null : $ dbMessage -> subscription -> subscriber_id ; unset ( $ attributes [ 'queue_id' ] ) ; unset ( $ attributes [ 'subscription_id' ] ) ; unset ( $ attributes [ 'mimetype' ] ) ; $ message = new components \ Message ( ) ; $ message -> setAttributes ( $ attributes ) ; $ result [ ] = $ message ; } return $ result ; } | Creates an array of Message objects from DbMessage objects . |
37,023 | public static function UseMicroData ( $ links , $ home = 2 ) { if ( empty ( $ links ) ) { return [ ] ; } foreach ( $ links as $ key => & $ link ) { if ( is_array ( $ link ) ) { $ link [ 'template' ] = self :: getTemplate ( $ link [ 'label' ] , $ link [ 'url' ] , $ key + $ home ) ; } } return $ links ; } | Returns an array of breadcrumbs microdata |
37,024 | public static function getHome ( $ label , $ url ) { $ home = [ 'label' => $ label , 'url' => $ url , 'template' => self :: getTemplate ( $ label , $ url , 1 ) ] ; return $ home ; } | Returns a template with microdata for the home page |
37,025 | public function permalink ( $ type , $ content = null ) { $ format = $ this -> app [ 'config' ] -> get ( "orchestra/story::permalink.{$type}" ) ; if ( is_null ( $ format ) || ! ( $ content instanceof Content ) ) { return handles ( 'orchestra/story::/' ) ; } if ( is_null ( $ published = $ content -> getAttribute ( 'published_at' ) ) ) { $ published = Carbon :: now ( ) ; } $ permalinks = [ 'id' => $ content -> getAttribute ( 'id' ) , 'slug' => str_replace ( [ '_post_/' , '_page_/' ] , '' , $ content -> getAttribute ( 'slug' ) ) , 'type' => $ content -> getAttribute ( 'type' ) , 'date' => $ published -> format ( 'Y-m-d' ) , 'year' => $ published -> format ( 'Y' ) , 'month' => $ published -> format ( 'm' ) , 'day' => $ published -> format ( 'd' ) , ] ; foreach ( $ permalinks as $ key => $ value ) { $ format = str_replace ( '{' . $ key . '}' , $ value , $ format ) ; } return handles ( "orchestra/story::{$format}" ) ; } | Generate URL by content . |
37,026 | public function createM2MIntermediaryModel ( $ field , $ model ) { $ modelName = $ model -> getMeta ( ) -> getNSModelName ( ) ; if ( is_string ( $ field -> relation -> toModel ) ) { $ toModelName = Tools :: resolveRelation ( $ model , $ field -> relation -> toModel ) ; $ ref = new \ ReflectionClass ( $ toModelName ) ; $ toModelName = $ ref -> getShortName ( ) ; $ toNamespacedModelName = $ ref -> getName ( ) ; } else { $ toModelName = $ field -> relation -> toModel -> getMeta ( ) -> getModelName ( ) ; $ toNamespacedModelName = $ field -> relation -> toModel -> getMeta ( ) -> getNSModelName ( ) ; } $ className = sprintf ( '%s_%s_autogen' , $ model -> getMeta ( ) -> getModelName ( ) , $ field -> getName ( ) ) ; $ from = strtolower ( $ model -> getMeta ( ) -> getModelName ( ) ) ; $ to = strtolower ( $ toModelName ) ; if ( $ from == $ to ) { $ to = sprintf ( 'to_%s' , $ to ) ; $ from = sprintf ( 'from_%s' , $ from ) ; } $ fields = [ $ from => ForeignKey :: createObject ( [ 'to' => $ modelName , 'relatedName' => sprintf ( '%s+' , $ className ) , 'dbConstraint' => $ field -> relation -> dbConstraint , 'onDelete' => Delete :: CASCADE , ] ) , $ to => ForeignKey :: createObject ( [ 'to' => $ toNamespacedModelName , 'relatedName' => sprintf ( '%s+' , $ className ) , 'dbConstraint' => $ field -> relation -> dbConstraint , 'onDelete' => Delete :: CASCADE , ] ) , ] ; $ intermediaryClass = FormatFileContent :: modelFileTemplate ( $ model -> getMeta ( ) -> getModelNamespace ( ) , $ className , Model :: class ) ; $ fullname = sprintf ( "%s\%s" , $ model -> getMeta ( ) -> getModelNamespace ( ) , $ className ) ; if ( ! class_exists ( $ fullname , false ) ) { eval ( $ intermediaryClass -> toString ( ) ) ; } $ obj = new $ fullname ( [ 'registry' => $ model -> getMeta ( ) -> getRegistry ( ) ] ) ; $ obj -> setupClassInfo ( $ fields , [ 'meta' => [ 'appName' => $ model -> getMeta ( ) -> getAppName ( ) , 'dbTable' => $ field -> getM2MDbTable ( $ model -> getMeta ( ) ) , 'verboseName' => sprintf ( '%s-%s relationship' , $ from , $ to ) , 'uniqueTogether' => [ $ from , $ to ] , 'autoCreated' => true , ] , 'registry' => $ model -> getMeta ( ) -> getRegistry ( ) , ] ) ; return $ obj ; } | Creates an intermediary model . |
37,027 | private function getM2MDbTable ( $ meta ) { if ( null !== $ this -> relation -> through ) { return $ this -> relation -> through -> getMeta ( ) -> getDbTable ( ) ; } elseif ( $ this -> dbTable ) { return $ this -> dbTable ; } else { return StringHelper :: truncate ( sprintf ( '%s_%s' , $ meta -> getDbTable ( ) , $ this -> getName ( ) ) , 30 , null , null , $ meta -> getRegistry ( ) -> getOrm ( ) -> getCharset ( ) ) ; } } | provides the m2m table name for this relation . |
37,028 | protected function reportBackgroundProcess ( $ process_id ) { if ( empty ( $ this -> queue ) || empty ( $ this -> queue_id ) ) { throw new LogicException ( 'Background process can be reported only for enqueued jobs' ) ; } if ( ! is_int ( $ process_id ) || $ process_id < 1 ) { throw new InvalidArgumentException ( 'Process ID is required' ) ; } $ this -> queue -> reportBackgroundProcess ( $ this , $ process_id ) ; return new ProcessLaunched ( $ process_id ) ; } | Report that this job has launched a background process . |
37,029 | public function setColumns ( array $ columns ) : self { foreach ( $ columns as $ column => list ( $ type , $ size ) ) { list ( $ type , $ size ) = $ this -> validateColumn ( $ type , $ size ) ; $ columns [ $ column ] = [ $ type , $ size ] ; } $ this -> columns = $ columns ; return $ this ; } | Set memory table columns struct |
37,030 | public function create ( ) : bool { if ( $ this -> isCreate ( ) ) { throw new Exception \ RuntimeException ( 'Memory table have been created, cannot recreated' ) ; } $ table = new SwooleTable ( $ this -> getSize ( ) ) ; $ this -> setTable ( $ table ) ; foreach ( $ this -> columns as $ field => $ fieldValue ) { $ args = array_merge ( [ $ field ] , $ fieldValue ) ; $ this -> table -> column ( ... $ args ) ; } $ result = $ table -> create ( ) ; $ this -> setCreate ( true ) ; return $ result ; } | Create table by columes |
37,031 | public function get ( string $ key , $ field = null ) { return null !== $ field ? $ this -> getTable ( ) -> get ( $ key , $ field ) : $ this -> getTable ( ) -> get ( $ key ) ; } | Get data by key and field |
37,032 | private function getDefaultPluginOptions ( ) { $ options = [ 'namePlaceholder' => $ this -> getPlaceholderForName ( ) , 'deleteAlert' => Yii :: t ( 'voskobovich/nestedsets' , 'The nobe will be removed together with the children. Are you sure?' ) , 'newNodeTitle' => Yii :: t ( 'voskobovich/nestedsets' , 'Enter the new node name' ) , ] ; $ controller = Yii :: $ app -> controller ; if ( $ controller ) { $ options [ 'moveUrl' ] = Url :: to ( [ "{$controller->id}/moveNode" ] ) ; $ options [ 'createUrl' ] = Url :: to ( [ "{$controller->id}/createNode" ] ) ; $ options [ 'updateUrl' ] = Url :: to ( [ "{$controller->id}/updateNode" ] ) ; $ options [ 'deleteUrl' ] = Url :: to ( [ "{$controller->id}/deleteNode" ] ) ; } if ( $ this -> moveUrl ) { $ this -> pluginOptions [ 'moveUrl' ] = $ this -> moveUrl ; } if ( $ this -> createUrl ) { $ this -> pluginOptions [ 'createUrl' ] = $ this -> createUrl ; } if ( $ this -> updateUrl ) { $ this -> pluginOptions [ 'updateUrl' ] = $ this -> updateUrl ; } if ( $ this -> deleteUrl ) { $ this -> pluginOptions [ 'deleteUrl' ] = $ this -> deleteUrl ; } return $ options ; } | Generate default plugin options |
37,033 | public function getCatchline ( ) { $ catchLine = $ this -> xml -> xpath ( '//NewsLines/NewsLine/NewsLineType[@FormalName="CatchLine"]' ) ; return empty ( $ catchLine ) ? '' : $ this -> getString ( array_shift ( $ catchLine ) -> xpath ( 'following::NewsLineText' ) ) ; } | Get catch line |
37,034 | public function getLiftEmbargo ( ) { $ datetime = array_shift ( $ this -> xml -> xpath ( '//StatusWillChange/DateAndTime' ) ) ; if ( ( string ) $ datetime !== '' ) { return new \ DateTime ( ( string ) $ datetime ) ; } } | Get lift embargo |
37,035 | protected function printResult ( $ successful , $ path ) { return parent :: printResult ( $ successful , dirname ( $ path ) . '/' . $ this -> generator -> date . '_' . basename ( $ path ) ) ; } | Same as base method but adds the date to the file name |
37,036 | protected function getGroupByRoleName ( string $ name ) : ? EntityInterface { $ result = TableRegistry :: get ( 'Groups.Groups' ) -> find ( ) -> enableHydration ( true ) -> where ( [ 'name' => $ name ] ) -> first ( ) ; Assert :: nullOrIsInstanceOf ( $ result , EntityInterface :: class ) ; return $ result ; } | Fetch group entity based on role name |
37,037 | public function rss ( ) { $ posts = Content :: post ( ) -> latestPublish ( ) -> limit ( config ( 'orchestra/story::per_page' , 10 ) ) -> get ( ) ; return Response :: view ( 'orchestra/story::atom' , [ 'posts' => $ posts ] , 200 , [ 'Content-Type' => 'application/rss+xml; charset=UTF-8' , ] ) ; } | Show RSS . |
37,038 | public function posts ( ) { $ posts = Content :: post ( ) -> latestPublish ( ) -> paginate ( config ( 'orchestra/story::per_page' , 10 ) ) ; return Facile :: view ( 'orchestra/story::posts' ) -> with ( [ 'posts' => $ posts ] ) -> render ( ) ; } | Show posts . |
37,039 | protected function page ( $ slug ) { $ page = Content :: page ( ) -> publish ( ) -> where ( 'slug' , '=' , $ slug ) -> firstOrFail ( ) ; $ slug = preg_replace ( '/^_page_\//' , '' , $ slug ) ; if ( ! View :: exists ( $ view = "orchestra/story::pages.{$slug}" ) ) { $ view = 'orchestra/story::page' ; } return Facile :: view ( $ view ) -> with ( [ 'page' => $ page ] ) -> render ( ) ; } | Show default page . |
37,040 | public static function generate ( EntityInterface $ entity ) : ID { $ headers = static :: header ( $ entity ) ; return new ID ( sprintf ( "%x%x%s" , $ headers [ 0 ] , $ headers [ 1 ] , bin2hex ( random_bytes ( 15 ) ) ) ) ; } | Generates a cryptographically secure random ID for internal use . |
37,041 | public static function fromString ( string $ id ) : ID { $ uuid_format = '/^[0-9A-F]{32}$/i' ; if ( ! preg_match ( $ uuid_format , $ id ) ) { throw new Exceptions \ MalformedIDException ( $ id ) ; } return new ID ( $ id ) ; } | Loads a Pho ID with the given string |
37,042 | protected function index ( ) { $ comments = $ this -> repository -> pushCriteria ( app ( 'Litepie\Repository\Criteria\RequestCriteria' ) ) -> scopeQuery ( function ( $ query ) { return $ query -> orderBy ( 'id' , 'DESC' ) ; } ) -> paginate ( ) ; return $ this -> response -> title ( trans ( 'blog::comment.names' ) ) -> view ( 'blog::public.comment.index' ) -> data ( compact ( 'comments' ) ) -> output ( ) ; } | Show comment s list . |
37,043 | protected function show ( $ slug ) { $ comment = $ this -> repository -> scopeQuery ( function ( $ query ) use ( $ slug ) { return $ query -> orderBy ( 'id' , 'DESC' ) -> where ( 'slug' , $ slug ) ; } ) -> first ( [ '*' ] ) ; return $ this -> response -> title ( $ $ comment -> name . trans ( 'blog::comment.name' ) ) -> view ( 'blog::public.comment.show' ) -> data ( compact ( 'comment' ) ) -> output ( ) ; } | Show comment . |
37,044 | public function linkAsset ( $ url , $ title = null , $ attributes = array ( ) , $ secure = null ) { $ url = $ this -> url -> asset ( $ url , $ secure ) ; return $ this -> link ( $ url , $ title ? : $ url , $ attributes , $ secure ) ; } | Generate a HTML link to an asset . |
37,045 | public function linkSecureAsset ( $ url , $ title = null , $ attributes = array ( ) ) { return $ this -> linkAsset ( $ url , $ title , $ attributes , true ) ; } | Generate a HTTPS HTML link to an asset . |
37,046 | protected function registerReminderRepository ( ) { $ this -> app -> bindShared ( 'auth.reminder.repository' , function ( $ app ) { $ connection = $ app [ 'db' ] -> connection ( ) ; $ table = $ app [ 'config' ] [ 'auth.reminder.table' ] ; $ key = $ app [ 'config' ] [ 'app.key' ] ; $ expire = $ app [ 'config' ] -> get ( 'auth.reminder.expire' , 60 ) ; return new DbRepository ( $ connection , $ table , $ key , $ expire ) ; } ) ; } | Register the reminder repository implementation . |
37,047 | protected function registerCommands ( ) { $ this -> app -> bindShared ( 'command.auth.reminders' , function ( $ app ) { return new RemindersTableCommand ( $ app [ 'files' ] ) ; } ) ; $ this -> app -> bindShared ( 'command.auth.reminders.clear' , function ( $ app ) { return new ClearRemindersCommand ; } ) ; $ this -> app -> bindShared ( 'command.auth.reminders.controller' , function ( $ app ) { return new RemindersControllerCommand ( $ app [ 'files' ] ) ; } ) ; $ this -> commands ( 'command.auth.reminders' , 'command.auth.reminders.clear' , 'command.auth.reminders.controller' ) ; } | Register the auth related console commands . |
37,048 | public function prepare ( string $ method , array $ parameters ) { $ parameters = $ this -> deleteEmptyKeys ( $ parameters ) ; $ parameters [ 'apiKey' ] = $ this -> flow -> getCredentials ( ) -> apiKey ; ksort ( $ parameters ) ; switch ( $ method ) { case 'get' : return $ this -> prepareGet ( $ parameters ) ; case 'post' : return $ this -> preparePost ( $ parameters ) ; default : return null ; } } | Prepare the data |
37,049 | protected function prepareGet ( array $ parameters ) { $ signable = http_build_query ( $ parameters , null , '&' ) ; return '?' . $ signable . '&s=' . $ this -> makeSignature ( $ signable ) ; } | Prepares a GET Request parameters |
37,050 | protected function preparePost ( array $ parameters ) { extract ( $ this -> parseValues ( $ parameters ) ) ; $ parameters [ 's' ] = $ this -> makeSignature ( $ signable ) ; return $ parameters ; } | Prepares a POST Request data |
37,051 | protected function parseValues ( array $ parameters ) { $ signable = [ ] ; foreach ( $ parameters as $ key => & $ parameter ) { $ parameter = $ this -> arrayToJson ( $ parameter ) ; $ parameter = $ this -> appendSecretToWebhook ( $ key , $ parameter ) ; $ signable [ ] = $ key . '=' . ( string ) $ parameter ; } $ signable = implode ( '&' , $ signable ) ; return compact ( 'parameters' , 'signable' ) ; } | Parse the Attributes values |
37,052 | protected function appendSecretToWebhook ( $ key , $ value ) { if ( ( $ webhook = $ this -> flow -> getWebhookSecret ( ) ) && in_array ( $ key , [ 'urlConfirmation' , 'urlCallBack' , 'urlCallback' ] ) && ! strpos ( $ value , 'secret=' ) ) { return $ value . ( strpos ( $ value , '?' ) ? '&' : '?' ) . 'secret=' . $ webhook ; } return $ value ; } | Append a secret to the Webhook URL |
37,053 | public function getUrl ( ) { return $ this -> url && $ this -> token ? $ this -> url . '?token=' . $ this -> token : null ; } | Returns a fully functional string |
37,054 | public function handleBigstockHelp ( Event $ event , Queue $ queue ) { $ messages = [ 'Usage: bigstock queryString' , 'queryString - the search query (all words are assumed to be part of message)' , 'Searches Bigstock for an image based on the provided query string.' , ] ; foreach ( $ messages as $ message ) { $ queue -> ircPrivmsg ( $ event -> getSource ( ) , $ message ) ; } } | Bigstock Command Help |
37,055 | public function emitShorteningEvents ( $ url ) { $ host = Url :: extractHost ( $ url ) ; list ( $ privateDeferred , $ userFacingPromise ) = $ this -> preparePromises ( ) ; $ eventName = 'url.shorten.' ; if ( count ( $ this -> emitter -> listeners ( $ eventName . $ host ) ) > 0 ) { $ eventName .= $ host ; $ this -> getLogger ( ) -> info ( '[Bigstock] emitting: ' . $ eventName ) ; $ this -> emitter -> emit ( $ eventName , [ $ url , $ privateDeferred ] ) ; } elseif ( count ( $ this -> emitter -> listeners ( $ eventName . 'all' ) ) > 0 ) { $ eventName .= 'all' ; $ this -> getLogger ( ) -> info ( '[Bigstock] emitting: ' . $ eventName ) ; $ this -> emitter -> emit ( $ eventName , [ $ url , $ privateDeferred ] ) ; } else { $ this -> getLoop ( ) -> addTimer ( 0.1 , function ( ) use ( $ privateDeferred ) { $ privateDeferred -> reject ( ) ; } ) ; } return $ userFacingPromise ; } | Emit URL shortening events |
37,056 | public function handleAction ( $ action , $ params , $ raw = false ) { $ this -> setupTemplate ( $ this -> className , $ action ) ; $ output = parent :: handleAction ( $ action , $ params , true ) ; if ( empty ( $ output ) && empty ( $ this -> template ) ) { throw new \ Exception ( 'No output or template for ' . $ this -> className . '.' . $ action ) ; } if ( empty ( $ output ) && ! empty ( $ this -> view ) ) { $ output = $ this -> view -> render ( ) ; } if ( ! empty ( $ output ) && $ this -> response -> hasLayout ( ) ) { $ this -> template -> output = $ output ; } if ( ! empty ( $ output ) && ! $ this -> response -> hasLayout ( ) ) { return $ output ; } $ this -> template -> set ( 'title' , $ this -> title ) ; $ this -> template -> set ( 'subtitle' , $ this -> subtitle ) ; $ this -> template -> set ( 'breadcrumb' , $ this -> breadcrumb ) ; $ this -> response -> setContent ( $ this -> template -> render ( ) ) ; return $ this -> response ; } | Handle the requested action |
37,057 | public function successMessage ( $ message , $ afterRedirect = false ) { if ( $ afterRedirect ) { $ _SESSION [ 'GlobalMessage' ] [ 'success' ] = $ message ; } if ( ! empty ( $ this -> template ) ) { $ this -> template -> globalSuccessMessage = $ message ; } } | Display a success message |
37,058 | public function errorMessage ( $ message , $ afterRedirect = false ) { if ( $ afterRedirect ) { $ _SESSION [ 'GlobalMessage' ] [ 'error' ] = $ message ; } if ( ! empty ( $ this -> template ) ) { $ this -> template -> globalErrorMessage = $ message ; } } | Display an error message |
37,059 | public function infoMessage ( $ message , $ afterRedirect = false ) { if ( $ afterRedirect ) { $ _SESSION [ 'GlobalMessage' ] [ 'info' ] = $ message ; } if ( ! empty ( $ this -> template ) ) { $ this -> template -> globalInfoMessage = $ message ; } } | Display an info message |
37,060 | public function setTitle ( $ title , $ subtitle = null ) { $ this -> title = $ title ; $ this -> subtitle = $ subtitle ; } | Set the title to display |
37,061 | public static function getClass ( $ controller ) { $ config = Config :: getInstance ( ) ; $ siteModules = array_reverse ( $ config -> get ( 'ModuleManager' ) -> getEnabled ( ) ) ; foreach ( $ siteModules as $ namespace => $ modules ) { foreach ( $ modules as $ module ) { $ class = "\\{$namespace}\\{$module}\\Admin\\Controller\\{$controller}Controller" ; if ( class_exists ( $ class ) ) { return $ class ; } } } return null ; } | Get the controller s class |
37,062 | protected static function writeUpdateToken ( $ tokenFile , $ tokenLine ) { $ sys = eZSys :: instance ( ) ; $ updateViewLogPath = $ sys -> varDirectory ( ) . "/" . eZPerfLoggerINI :: variable ( 'FileSettings' , 'LogDir' , 'site.ini' ) . "/" . $ tokenFile ; $ dt = new eZDateTime ( ) ; if ( ! file_put_contents ( $ updateViewLogPath , "# Finished at " . $ dt -> toString ( ) . "\n" . "# Last updated entry:" . "\n" . $ tokenLine . "\n" ) ) { eZPerfLoggerDebug :: writeError ( "Could not store last date of perf-log file parsing in $updateViewLogPath, double-counting might occur" , __METHOD__ ) ; } } | Writes a token file This is useful whenever there are log files which get parse based on cronjobs and we have to remember the last line which has been found |
37,063 | protected static function readUpdateToken ( $ tokenFile ) { $ sys = eZSys :: instance ( ) ; $ updateViewLogPath = $ sys -> varDirectory ( ) . "/" . eZPerfLoggerINI :: variable ( 'FileSettings' , 'LogDir' , 'site.ini' ) . "/" . $ tokenFile ; if ( is_file ( $ updateViewLogPath ) ) { $ lines = file ( $ updateViewLogPath , FILE_SKIP_EMPTY_LINES ) ; return isset ( $ lines [ 2 ] ) ? $ lines [ 2 ] : false ; } return false ; } | Reads the data previously saved in the token file |
37,064 | protected function getResourcePrefix ( $ name ) { $ segments = explode ( '/' , $ name ) ; $ prefix = implode ( '/' , array_slice ( $ segments , 0 , - 1 ) ) ; return array ( $ segments [ count ( $ segments ) - 1 ] , $ prefix ) ; } | Extract the resource and prefix from a resource name . |
37,065 | protected function addResourceStore ( $ name , $ base , $ controller , $ options ) { $ action = $ this -> getResourceAction ( $ name , $ controller , 'store' , $ options ) ; return $ this -> post ( $ this -> getResourceUri ( $ name ) , $ action ) ; } | Add the store method for a resourceful route . |
37,066 | protected function getClassClosure ( $ controller ) { $ me = $ this ; $ d = $ this -> getControllerDispatcher ( ) ; return function ( ) use ( $ me , $ d , $ controller ) { $ route = $ me -> current ( ) ; $ request = $ me -> getCurrentRequest ( ) ; list ( $ class , $ method ) = explode ( '@' , $ controller ) ; return $ d -> dispatch ( $ route , $ request , $ class , $ method ) ; } ; } | Get the Closure for a controller based action . |
37,067 | protected function addGlobalFilter ( $ filter , $ callback ) { $ this -> events -> listen ( 'router.' . $ filter , $ this -> parseFilter ( $ callback ) ) ; } | Register a new global filter with the router . |
37,068 | public function filter ( $ name , $ callback ) { $ this -> events -> listen ( 'router.filter: ' . $ name , $ this -> parseFilter ( $ callback ) ) ; } | Register a new filter with the router . |
37,069 | public function when ( $ pattern , $ name , $ methods = null ) { if ( ! is_null ( $ methods ) ) $ methods = array_map ( 'strtoupper' , ( array ) $ methods ) ; $ this -> patternFilters [ $ pattern ] [ ] = compact ( 'name' , 'methods' ) ; } | Register a pattern - based filter with the router . |
37,070 | public function whenRegex ( $ pattern , $ name , $ methods = null ) { if ( ! is_null ( $ methods ) ) $ methods = array_map ( 'strtoupper' , ( array ) $ methods ) ; $ this -> regexFilters [ $ pattern ] [ ] = compact ( 'name' , 'methods' ) ; } | Register a regular expression based filter with the router . |
37,071 | protected function callPatternFilters ( $ route , $ request ) { foreach ( $ this -> findPatternFilters ( $ request ) as $ filter => $ parameters ) { $ response = $ this -> callRouteFilter ( $ filter , $ parameters , $ route , $ request ) ; if ( ! is_null ( $ response ) ) return $ response ; } } | Call the pattern based filters for the request . |
37,072 | public function findPatternFilters ( $ request ) { $ results = array ( ) ; list ( $ path , $ method ) = array ( $ request -> path ( ) , $ request -> getMethod ( ) ) ; foreach ( $ this -> patternFilters as $ pattern => $ filters ) { if ( str_is ( $ pattern , $ path ) ) { $ merge = $ this -> patternsByMethod ( $ method , $ filters ) ; $ results = array_merge ( $ results , $ merge ) ; } } foreach ( $ this -> regexFilters as $ pattern => $ filters ) { if ( preg_match ( $ pattern , $ path ) ) { $ merge = $ this -> patternsByMethod ( $ method , $ filters ) ; $ results = array_merge ( $ results , $ merge ) ; } } return $ results ; } | Find the patterned filters matching a request . |
37,073 | protected function patternsByMethod ( $ method , $ filters ) { $ results = array ( ) ; foreach ( $ filters as $ filter ) { if ( $ this -> filterSupportsMethod ( $ filter , $ method ) ) { $ parsed = Route :: parseFilters ( $ filter [ 'name' ] ) ; $ results = array_merge ( $ results , $ parsed ) ; } } return $ results ; } | Filter pattern filters that don t apply to the request verb . |
37,074 | public function getControllerDispatcher ( ) { if ( is_null ( $ this -> controllerDispatcher ) ) { $ this -> controllerDispatcher = new ControllerDispatcher ( $ this , $ this -> container ) ; } return $ this -> controllerDispatcher ; } | Get the controller dispatcher instance . |
37,075 | public function handle ( SymfonyRequest $ request , $ type = HttpKernelInterface :: MASTER_REQUEST , $ catch = true ) { return $ this -> dispatch ( Request :: createFromBase ( $ request ) ) ; } | Get the response for a given request . |
37,076 | public function read ( ) { if ( ! $ this -> exists ( ) ) { throw new FileException ( sprintf ( 'File does not exist: %s' , $ this -> getFilename ( ) ) ) ; } if ( ! $ this -> isReadable ( ) ) { throw new FileException ( sprintf ( 'You don\'t have permissions to access %s file' , $ this -> getFilename ( ) ) ) ; } return file_get_contents ( $ this -> pathname ) ; } | Reads contents from the file |
37,077 | public function touch ( $ created = null , $ lastAccessed = null ) { $ created = $ created instanceof DateTime ? $ created -> getTimestamp ( ) : ( $ created === null ? time ( ) : $ created ) ; $ lastAccessed = $ lastAccessed instanceof DateTime ? $ lastAccessed -> getTimestamp ( ) : ( $ lastAccessed === null ? time ( ) : $ lastAccessed ) ; if ( ! @ touch ( $ this -> pathname , $ created , $ lastAccessed ) ) { throw new FileException ( sprintf ( 'Failed to touch file at %s' , $ this -> pathname ) ) ; } } | Touches the file |
37,078 | protected function calculateCurrentAndLastPages ( ) { $ this -> lastPage = ( int ) ceil ( $ this -> total / $ this -> perPage ) ; $ this -> currentPage = $ this -> calculateCurrentPage ( $ this -> lastPage ) ; } | Calculate the current and last pages for this instance . |
37,079 | protected function calculateItemRanges ( ) { $ this -> from = $ this -> total ? ( $ this -> currentPage - 1 ) * $ this -> perPage + 1 : 0 ; $ this -> to = min ( $ this -> total , $ this -> currentPage * $ this -> perPage ) ; } | Calculate the first and last item number for this instance . |
37,080 | public static function getInstance ( string $ model_class , $ where ) { $ database = $ model_class :: getDatabase ( ) ; $ primary_key = $ database -> get ( $ model_class :: TABLE , $ model_class :: PRIMARY_KEY , $ model_class :: processWhere ( $ where ) ) ; if ( $ primary_key ) { $ path = array_merge ( [ $ model_class ] , $ primary_key ) ; $ get_model = Utils \ Utils :: arrayPathGet ( self :: $ models , $ path ) ; if ( $ get_model === null ) { return new $ model_class ( $ primary_key ) ; } return $ get_model ; } } | Creates a new Model Instancer |
37,081 | public static function import ( Model $ model ) { Utils \ Utils :: arrayPathSet ( self :: $ models , self :: getPath ( $ model ) , $ model ) ; } | Imports a Model into the Manager |
37,082 | public static function remove ( $ var ) { $ path = ( $ var instanceof Model ) ? self :: getPath ( $ var ) : $ var ; Utils \ Utils :: arrayPathUnset ( self :: $ models , $ path ) ; } | Removes a Model from the Manager |
37,083 | public function request ( $ controlUrl , $ service = null , $ method = null , $ arguments = [ ] ) { $ controlUrl = ltrim ( $ controlUrl , '/' ) ; $ url = 'http://' . $ this -> ip . '/' . $ controlUrl ; $ action = $ service . '#' . $ method ; $ xmlHeader = '<?xml version="1.0" encoding="utf-8"?> <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <s:Body> <u:' . $ method . ' xmlns:u="' . $ service . '">' ; $ xmlFooter = '</u:' . $ method . '></s:Body></s:Envelope>' ; $ xmlBody = '' ; foreach ( $ arguments as $ key => $ value ) { $ xmlBody .= '<' . $ key . '>' . $ value . '</' . $ key . '>' ; } $ xml = $ xmlHeader . $ xmlBody . $ xmlFooter ; try { $ options = [ CURLOPT_URL => $ url , CURLOPT_POST => true , CURLOPT_PORT => $ this -> port , CURLOPT_POSTFIELDS => $ xml , CURLOPT_RETURNTRANSFER => true , CURLOPT_VERBOSE => WS :: config ( ) -> get ( 'debug' , false ) , CURLOPT_HTTPHEADER => [ 'Content-Type:text/xml' , 'SOAPACTION:"' . $ action . '"' ] ] ; $ ch = curl_init ( ) ; curl_setopt_array ( $ ch , $ options ) ; $ response = curl_exec ( $ ch ) ; } catch ( \ Exception $ e ) { throw $ e ; } return $ this -> formatResponse ( $ response ) ; } | Makes requests to devices . |
37,084 | public function image ( $ url , $ name = null , $ attributes = array ( ) ) { $ attributes [ 'src' ] = $ this -> url -> asset ( $ url ) ; return $ this -> input ( 'image' , $ name , null , $ attributes ) ; } | Create a HTML image input element . |
37,085 | public function connect ( ) { if ( ! ( $ this -> connection = ssh2_connect ( $ this -> host , $ this -> port ) ) ) { throw new \ Exception ( 'Cannot connect to server' ) ; } if ( ! ssh2_auth_pubkey_file ( $ this -> connection , $ this -> authUser , $ this -> authPub , $ this -> authPriv , $ this -> authPass ) ) { throw new \ Exception ( 'Autentication rejected by server' ) ; } } | Init the connection |
37,086 | public function exec ( $ cmd ) { if ( $ this -> jumphost ) { $ cmd = "ssh " . $ this -> jumphost . " " . $ cmd ; } if ( ! ( $ stream = ssh2_exec ( $ this -> connection , $ cmd ) ) ) { throw new \ Exception ( 'SSH command failed' ) ; } stream_set_blocking ( $ stream , true ) ; $ data = "" ; while ( $ buf = fread ( $ stream , 4096 ) ) { $ data .= $ buf ; } fclose ( $ stream ) ; return $ data ; } | Execute a command on the server or pass it trough the jump server |
37,087 | protected function compileExtends ( $ value ) { if ( strpos ( $ value , '@extends' ) !== 0 ) { return $ value ; } $ lines = preg_split ( "/(\r?\n)/" , $ value ) ; $ lines = $ this -> compileLayoutExtends ( $ lines ) ; return implode ( "\r\n" , array_slice ( $ lines , 1 ) ) ; } | Compile Sword template extensions into valid PHP . |
37,088 | protected function compileLayoutExtends ( $ lines ) { $ pattern = $ this -> createMatcher ( 'extends' ) ; $ lines [ ] = preg_replace ( $ pattern , '$1@include$2' , $ lines [ 0 ] ) ; return $ lines ; } | Compile the proper template inheritance for the lines . |
37,089 | protected function compileIncludes ( $ value ) { $ pattern = $ this -> createOpenMatcher ( 'include' ) ; $ replace = '$1<?php echo $__env->make$2, array_except(get_defined_vars(), array(\'__data\', \'__path\')))->render(); ?>' ; return preg_replace ( $ pattern , $ replace , $ value ) ; } | Compile Sword include statements into valid PHP . |
37,090 | protected function compileLanguage ( $ value ) { $ pattern = $ this -> createMatcher ( 'lang' ) ; $ value = preg_replace ( $ pattern , '$1<?php echo \Fly\Support\Facades\Lang::get$2; ?>' , $ value ) ; $ pattern = $ this -> createMatcher ( 'choice' ) ; return preg_replace ( $ pattern , '$1<?php echo \Fly\Support\Facades\Lang::choice$2; ?>' , $ value ) ; } | Compile Sword language and language choice statements into valid PHP . |
37,091 | protected function compileSectionStop ( $ value ) { $ pattern = $ this -> createPlainMatcher ( 'stop' ) ; $ value = preg_replace ( $ pattern , '$1<?php $__env->stopSection(); ?>$2' , $ value ) ; $ pattern = $ this -> createPlainMatcher ( 'endsection' ) ; return preg_replace ( $ pattern , '$1<?php $__env->stopSection(); ?>$2' , $ value ) ; } | Compile Sword section stop statements into valid PHP . |
37,092 | public static function get ( $ icao ) { $ url = self :: getUri ( 'airports' , [ $ icao ] ) ; $ response = self :: request ( 'GET' , $ url ) ; if ( isset ( $ response -> data ) ) { return $ response -> data ; } } | Get the Airport information from the vaCentral API |
37,093 | protected function registerHandler ( ) { $ this -> app [ 'exception' ] = $ this -> app -> share ( function ( $ app ) { return new Handler ( $ app , $ app [ 'exception.plain' ] , $ app [ 'exception.debug' ] ) ; } ) ; } | Register the exception handler instance . |
37,094 | protected function registerPlainDisplayer ( ) { $ this -> app [ 'exception.plain' ] = $ this -> app -> share ( function ( $ app ) { if ( $ app -> runningInConsole ( ) ) { return $ app [ 'exception.debug' ] ; } else { return new PlainDisplayer ; } } ) ; } | Register the plain exception displayer . |
37,095 | protected function registerDebugDisplayer ( ) { $ this -> registerWhoops ( ) ; $ this -> app [ 'exception.debug' ] = $ this -> app -> share ( function ( $ app ) { return new WhoopsDisplayer ( $ app [ 'whoops' ] , $ app -> runningInConsole ( ) ) ; } ) ; } | Register the Whoops exception displayer . |
37,096 | protected function registerWhoops ( ) { $ this -> registerWhoopsHandler ( ) ; $ this -> app [ 'whoops' ] = $ this -> app -> share ( function ( $ app ) { with ( $ whoops = new Run ) -> allowQuit ( false ) ; $ whoops -> writeToOutput ( false ) ; return $ whoops -> pushHandler ( $ app [ 'whoops.handler' ] ) ; } ) ; } | Register the Whoops error display service . |
37,097 | protected function registerWhoopsHandler ( ) { if ( $ this -> shouldReturnJson ( ) ) { $ this -> app [ 'whoops.handler' ] = $ this -> app -> share ( function ( ) { return new JsonResponseHandler ; } ) ; } else { $ this -> registerPrettyWhoopsHandler ( ) ; } } | Register the Whoops handler for the request . |
37,098 | protected function registerPrettyWhoopsHandler ( ) { $ me = $ this ; $ this -> app [ 'whoops.handler' ] = $ this -> app -> share ( function ( ) use ( $ me ) { with ( $ handler = new PrettyPageHandler ) -> setEditor ( 'sublime' ) ; if ( ! is_null ( $ path = $ me -> resourcePath ( ) ) ) { $ handler -> setResourcesPath ( $ path ) ; } return $ handler ; } ) ; } | Register the pretty Whoops handler . |
37,099 | public function cancel ( $ atPeriodEnd = false ) { if ( $ this -> exists ( ) && $ cancelled = $ this -> service -> cancel ( $ this -> getId ( ) , $ atPeriodEnd ) ) { $ this -> setAttributes ( $ cancelled -> toArray ( ) ) ; return true ; } return false ; } | Cancels the Subscription |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.