getCTime example

continue;
      }

      // If we don't already know it, grab the change time on the .info.yml file       // itself. Note: we need to use the ctime, not the mtime (modification       // time) since many (all?) tar implementations will go out of their way to       // set the mtime on the files it creates to the timestamps recorded in the       // tarball. We want to see the last time the file was changed on disk,       // which is left alone by tar and correctly set to the time the .info.yml       // file was unpacked.       if (!isset($file->info['_info_file_ctime'])) {
        $file->info['_info_file_ctime'] = $file->getFileInfo()->getCTime();
      }

      if (!isset($file->info['datestamp'])) {
        $file->info['datestamp'] = 0;
      }

      $project_name = $file->info['project'];

      // Figure out what project type we're going to use to display this module       // or theme. If the project name is 'drupal', we don't want it to show up       // under the usual "Modules" section, we put it at a special "Drupal Core"

        parent::__construct('SplFileInfo');

        $this->path = $fileInfo->getPathname();

        try {
            if (\strlen($this->path) && $fileInfo->getRealPath()) {
                $this->perms = $fileInfo->getPerms();
                $this->size = $fileInfo->getSize();
                $this->owner = $fileInfo->getOwner();
                $this->group = $fileInfo->getGroup();
                $this->ctime = $fileInfo->getCTime();
                $this->mtime = $fileInfo->getMTime();
                $this->realpath = $fileInfo->getRealPath();
            }

            $this->is_dir = $fileInfo->isDir();
            $this->is_file = $fileInfo->isFile();
            $this->is_link = $fileInfo->isLink();

            if ($this->is_link) {
                $this->linktarget = $fileInfo->getLinkTarget();
            }
        }
if ($a->isDir() && $b->isFile()) {
                    return -$order;
                } elseif ($a->isFile() && $b->isDir()) {
                    return $order;
                }

                return $order * strcmp($a->getRealPath() ?: $a->getPathname()$b->getRealPath() ?: $b->getPathname());
            };
        } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
            $this->sort = static fn (\SplFileInfo $a, \SplFileInfo $b) => $order * ($a->getATime() - $b->getATime());
        } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
            $this->sort = static fn (\SplFileInfo $a, \SplFileInfo $b) => $order * ($a->getCTime() - $b->getCTime());
        } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
            $this->sort = static fn (\SplFileInfo $a, \SplFileInfo $b) => $order * ($a->getMTime() - $b->getMTime());
        } elseif (self::SORT_BY_EXTENSION === $sort) {
            $this->sort = static fn (\SplFileInfo $a, \SplFileInfo $b) => $order * strnatcmp($a->getExtension()$b->getExtension());
        } elseif (self::SORT_BY_SIZE === $sort) {
            $this->sort = static fn (\SplFileInfo $a, \SplFileInfo $b) => $order * ($a->getSize() - $b->getSize());
        } elseif (self::SORT_BY_NONE === $sort) {
            $this->sort = $order;
        } elseif (\is_callable($sort)) {
            $this->sort = $reverseOrder ? static fn (\SplFileInfo $a, \SplFileInfo $b) => -$sort($a$b) : $sort(...);
        } else {
            

class LegacyExtensionTest extends UnitTestCase {

  /** * @covers ::__call */
  public function testDeprecatedCall() {
    $extension = new Extension($this->root, 'theme', 'core/themes/stark/stark.info.yml', 'stark.theme');
    $file = $extension->getFileInfo();
    $this->expectDeprecation('Drupal\Core\Extension\Extension::__call(\'getCTime\') is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Extension\Extension::getFileInfo() instead. See https://www.drupal.org/node/3322608');
    $this->assertSame($file->getCTime()$extension->getCTime());
    $this->expectDeprecation('Drupal\Core\Extension\Extension::__call(\'getMTime\') is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Extension\Extension::getFileInfo() instead. See https://www.drupal.org/node/3322608');
    $this->assertSame($file->getMTime()$extension->getMTime());
  }

}
Home | Imprint | This part of the site doesn't use cookies.