当前位置: 首页>>代码示例>>PHP>>正文


PHP Carbon::createFromTimeStampUTC方法代码示例

本文整理汇总了PHP中Carbon\Carbon::createFromTimeStampUTC方法的典型用法代码示例。如果您正苦于以下问题:PHP Carbon::createFromTimeStampUTC方法的具体用法?PHP Carbon::createFromTimeStampUTC怎么用?PHP Carbon::createFromTimeStampUTC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Carbon\Carbon的用法示例。


在下文中一共展示了Carbon::createFromTimeStampUTC方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 public function setUp()
 {
     Carbon::setTestNow(Carbon::createFromTimeStampUTC(123));
     $this->claimFactory = Mockery::mock('Tymon\\JWTAuth\\Claims\\Factory');
     $this->validator = Mockery::mock('Tymon\\JWTAuth\\Validators\\PayloadValidator');
     $this->factory = new PayloadFactory($this->claimFactory, Request::create('/foo', 'GET'), $this->validator);
 }
开发者ID:w0rd-driven,项目名称:jwt-auth,代码行数:7,代码来源:PayloadFactoryTest.php

示例2: setUp

 public function setUp()
 {
     Carbon::setTestNow(Carbon::createFromTimeStampUTC(123));
     $claims = [new Subject(1), new Issuer('http://example.com'), new Expiration(123 + 3600), new NotBefore(123), new IssuedAt(123), new JwtId('foo')];
     $this->validator = Mockery::mock('Tymon\\JWTAuth\\Validators\\PayloadValidator');
     $this->validator->shouldReceive('setRefreshFlow->check');
     $this->payload = new Payload($claims, $this->validator);
 }
开发者ID:w0rd-driven,项目名称:jwt-auth,代码行数:8,代码来源:PayloadTest.php

示例3: setUp

 public function setUp()
 {
     Carbon::setTestNow(Carbon::createFromTimeStampUTC(123));
     $this->storage = Mockery::mock('Tymon\\JWTAuth\\Contracts\\Providers\\Storage');
     $this->blacklist = new Blacklist($this->storage);
     $this->validator = Mockery::mock('Tymon\\JWTAuth\\Validators\\PayloadValidator');
     $this->validator->shouldReceive('setRefreshFlow->check');
 }
开发者ID:levieraf,项目名称:jwt-auth,代码行数:8,代码来源:BlacklistTest.php

示例4: getToken

 public static function getToken($jwt)
 {
     $key = config('jwt.secret');
     $notBefore = config('jwt.nbf');
     $expire = config('jwt.exp') / 60;
     $assets = JWT::decode($jwt, $key, true);
     $issuedAt = Carbon::createFromTimeStampUTC($assets->iat)->toDateTimeString();
     // $assets->iat->diffForHumans();
     if (time() < $assets->nbf) {
         throw new Exception("The Token will begin to be valid {$notBefore} seconds after being issued at {$issuedAt}.");
     }
     if ($assets->exp < time()) {
         throw new Exception("The Token was expired. This token was create at {$issuedAt}, and will be expired after {$expire} minutes.");
     }
     return $assets->data;
 }
开发者ID:antho-firuze,项目名称:_g.ene.sys_prototype1_,代码行数:16,代码来源:JWT.php

示例5: setUp

 public function setUp()
 {
     Carbon::setTestNow(Carbon::createFromTimeStampUTC(123));
     $this->jws = Mockery::mock('Namshi\\JOSE\\JWS');
     $this->provider = new NamshiAdapter('secret', 'HS256', $this->jws);
 }
开发者ID:w0rd-driven,项目名称:jwt-auth,代码行数:6,代码来源:NamshiAdapterTest.php

示例6: setUp

 public function setUp()
 {
     Carbon::setTestNow(Carbon::createFromTimeStampUTC(123));
     $this->validator = new PayloadValidator();
 }
开发者ID:ratan203,项目名称:jwt-auth,代码行数:5,代码来源:PayloadValidatorTest.php

示例7: function

<?php

use Carbon\Carbon;
add_shortcode('post-parent-title', function ($atts) {
    $parent_id = get_post_meta(get_the_ID(), '_wpcf_belongs_publisher_id', true);
    $post = get_post($parent_id);
    return $post->post_title;
});
add_shortcode('post-parent-url', function ($atts) {
    $parent_id = get_post_meta(get_the_ID(), '_wpcf_belongs_publisher_id', true);
    return get_permalink($parent_id);
});
add_shortcode('child-count', function ($atts) {
    $args = array('posts_per_page' => 5, 'post_type' => 'episode', 'meta_query' => array(array('key' => '_wpcf_belongs_publisher_id', 'value' => get_the_ID())));
    $myquery = new WP_Query($args);
    return $myquery->found_posts;
});
add_shortcode('ago', function ($atts) {
    $dt = get_post_meta(get_the_ID(), 'wpcf-episode-publish-date', true);
    $dt = Carbon::createFromTimeStampUTC($dt);
    return $dt->toFormattedDateString();
});
开发者ID:benallfree,项目名称:wprss,代码行数:22,代码来源:shortcodes.php

示例8: timestamp

 /**
  * Get the Carbon instance for the timestamp.
  *
  * @param  int  $timestamp
  * @return \Carbon\Carbon
  */
 public static function timestamp($timestamp)
 {
     return Carbon::createFromTimeStampUTC($timestamp);
 }
开发者ID:lucasmichot,项目名称:jwt-auth,代码行数:10,代码来源:Utils.php

示例9:

 function publish_date()
 {
     $dt = Carbon::createFromTimeStampUTC($this->_meta('publish_date'));
     return $dt;
 }
开发者ID:benallfree,项目名称:recast,代码行数:5,代码来源:Episode.php

示例10: handle

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function handle()
 {
     pcntl_signal(SIGINT, [$this, 'handleInterrupt']);
     $mlpmaPath = Config::get('ponyfm.files_directory') . '/mlpma';
     $tmpPath = Config::get('ponyfm.files_directory') . '/tmp';
     if (!File::exists($tmpPath)) {
         File::makeDirectory($tmpPath);
     }
     $UNKNOWN_GENRE = Genre::firstOrCreate(['name' => 'Unknown', 'slug' => 'unknown']);
     $this->comment('Enumerating MLP Music Archive source files...');
     $files = File::allFiles($mlpmaPath);
     $this->info(sizeof($files) . ' files found!');
     $this->comment('Enumerating artists...');
     $artists = File::directories($mlpmaPath);
     $this->info(sizeof($artists) . ' artists found!');
     $this->comment('Importing tracks...');
     $totalFiles = sizeof($files);
     $fileToStartAt = (int) $this->option('startAt') - 1;
     $this->comment("Skipping {$fileToStartAt} files..." . PHP_EOL);
     $files = array_slice($files, $fileToStartAt);
     $this->currentFile = $fileToStartAt;
     foreach ($files as $file) {
         $this->currentFile++;
         pcntl_signal_dispatch();
         if ($this->isInterrupted) {
             break;
         }
         $this->comment('[' . $this->currentFile . '/' . $totalFiles . '] Importing track [' . $file->getFilename() . ']...');
         if (in_array($file->getExtension(), $this->ignoredExtensions)) {
             $this->comment('This is not an audio file! Skipping...' . PHP_EOL);
             continue;
         }
         // Has this track already been imported?
         $importedTrack = DB::table('mlpma_tracks')->where('filename', '=', $file->getFilename())->first();
         if ($importedTrack) {
             $this->comment('This track has already been imported! Skipping...' . PHP_EOL);
             continue;
         }
         //==========================================================================================================
         // Extract the original tags.
         //==========================================================================================================
         $getId3 = new getID3();
         // all tags read by getID3, including the cover art
         $allTags = $getId3->analyze($file->getPathname());
         // tags specific to a file format (ID3 or Atom), pre-normalization but with cover art removed
         $rawTags = [];
         // normalized tags used by Pony.fm
         $parsedTags = [];
         if (Str::lower($file->getExtension()) === 'mp3') {
             list($parsedTags, $rawTags) = $this->getId3Tags($allTags);
         } elseif (Str::lower($file->getExtension()) === 'm4a') {
             list($parsedTags, $rawTags) = $this->getAtomTags($allTags);
         } elseif (Str::lower($file->getExtension()) === 'ogg') {
             list($parsedTags, $rawTags) = $this->getVorbisTags($allTags);
         } elseif (Str::lower($file->getExtension()) === 'flac') {
             list($parsedTags, $rawTags) = $this->getVorbisTags($allTags);
         } elseif (Str::lower($file->getExtension()) === 'wav') {
             list($parsedTags, $rawTags) = $this->getAtomTags($allTags);
         }
         //==========================================================================================================
         // Determine the release date.
         //==========================================================================================================
         $modifiedDate = Carbon::createFromTimeStampUTC(File::lastModified($file->getPathname()));
         $taggedYear = $parsedTags['year'];
         $this->info('Modification year: ' . $modifiedDate->year);
         $this->info('Tagged year: ' . $taggedYear);
         if ($taggedYear !== null && $modifiedDate->year === $taggedYear) {
             $releasedAt = $modifiedDate;
         } elseif ($taggedYear !== null && Str::length((string) $taggedYear) !== 4) {
             $this->error('This track\'s tagged year makes no sense! Using the track\'s last modified date...');
             $releasedAt = $modifiedDate;
         } elseif ($taggedYear !== null && $modifiedDate->year !== $taggedYear) {
             $this->error('Release years don\'t match! Using the tagged year...');
             $releasedAt = Carbon::create($taggedYear);
         } else {
             // $taggedYear is null
             $this->error('This track isn\'t tagged with its release year! Using the track\'s last modified date...');
             $releasedAt = $modifiedDate;
         }
         // This is later used by the classification/publishing script to determine the publication date.
         $parsedTags['released_at'] = $releasedAt->toDateTimeString();
         //==========================================================================================================
         // Does this track have vocals?
         //==========================================================================================================
         $isVocal = $parsedTags['lyrics'] !== null;
         //==========================================================================================================
         // Fill in the title tag if it's missing.
         //==========================================================================================================
         if (!$parsedTags['title']) {
             $parsedTags['title'] = $file->getBasename('.' . $file->getExtension());
         }
         //==========================================================================================================
         // Determine the genre.
         //==========================================================================================================
         $genreName = $parsedTags['genre'];
//.........这里部分代码省略.........
开发者ID:nsystem1,项目名称:Pony.fm,代码行数:101,代码来源:ImportMLPMA.php


注:本文中的Carbon\Carbon::createFromTimeStampUTC方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。