Commit fff2daa3 authored by mondrake's avatar mondrake
Browse files

Issue #3318251 by erikaagp, PrasadDeole, Arturo1007: Fix phpcs coding standard

parent 4fdb5286
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -313,7 +313,10 @@ class ImagemagickEventSubscriber implements EventSubscriberInterface {
    $this->doEnsureDestinationLocalPath($arguments);

    // Coalesce Animated GIFs, if required.
    if (empty($arguments->find('/^\-coalesce/')) && (bool) $this->imagemagickSettings->get('advanced.coalesce') && in_array($arguments->getSourceFormat(), ['GIF', 'GIF87'])) {
    if (empty($arguments->find('/^\-coalesce/')) && (bool) $this->imagemagickSettings->get('advanced.coalesce') && in_array($arguments->getSourceFormat(), [
        'GIF',
        'GIF87',
      ])) {
      $file_md = $this->fileMetadataManager->uri($arguments->getSource());
      if ($file_md && $file_md->getMetadata(ImagemagickToolkit::FILE_METADATA_PLUGIN_ID, 'frames_count') > 1) {
        $arguments->add("-coalesce", ImagemagickExecArguments::POST_SOURCE, 0);
+8 −2
Original line number Diff line number Diff line
@@ -165,11 +165,17 @@ class ImagemagickExecManager implements ImagemagickExecManagerInterface {
    if (!empty($path)) {
      // Check whether the given file exists.
      if (!is_file($executable)) {
        $status['errors'][] = $this->t('The @suite executable %file does not exist.', ['@suite' => $this->getPackageLabel($package), '%file' => $executable]);
        $status['errors'][] = $this->t('The @suite executable %file does not exist.', [
          '@suite' => $this->getPackageLabel($package),
          '%file' => $executable,
        ]);
      }
      // If it exists, check whether we can execute it.
      elseif (!is_executable($executable)) {
        $status['errors'][] = $this->t('The @suite file %file is not executable.', ['@suite' => $this->getPackageLabel($package), '%file' => $executable]);
        $status['errors'][] = $this->t('The @suite file %file is not executable.', [
          '@suite' => $this->getPackageLabel($package),
          '%file' => $executable,
        ]);
      }
    }

+2 −2
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ class ImagemagickFormatMapper implements ImagemagickFormatMapperInterface {
    $schema_errors = $this->checkConfigSchema($this->typedConfig, 'imagemagick.settings', $data);
    if ($schema_errors !== TRUE) {
      foreach ($schema_errors as $key => $value) {
        list(, $path) = explode(':', $key);
        [, $path] = explode(':', $key);
        $components = explode('.', $path);
        if ($components[0] === 'image_formats') {
          if (isset($components[2])) {
@@ -144,7 +144,7 @@ class ImagemagickFormatMapper implements ImagemagickFormatMapperInterface {
  public function getFormatFromExtension(string $extension) {
    $extension = mb_strtolower($extension);
    $enabled_extensions = $this->resolveEnabledExtensions();
    return $extension ? (isset($enabled_extensions[$extension]) ? $enabled_extensions[$extension] : NULL) : NULL;
    return $extension ? ($enabled_extensions[$extension] ?? NULL) : NULL;
  }

  /**
+3 −3
Original line number Diff line number Diff line
@@ -145,13 +145,13 @@ class ImagemagickIdentify extends FileMetadataPluginBase {
      $this->validateKey($key, __FUNCTION__);
      switch ($key) {
        case 'source_local_path':
          return isset($this->metadata['source_local_path']) ? $this->metadata['source_local_path'] : NULL;
          return $this->metadata['source_local_path'] ?? NULL;

        case 'frames_count':
          return isset($this->metadata['frames']) ? count($this->metadata['frames']) : 0;

        default:
          return isset($this->metadata['frames'][0][$key]) ? $this->metadata['frames'][0][$key] : NULL;
          return $this->metadata['frames'][0][$key] ?? NULL;

      }
    }
@@ -262,7 +262,7 @@ class ImagemagickIdentify extends FileMetadataPluginBase {
      foreach ($frames_tmp as $i => $frame) {
        $info = explode('|', $frame);
        foreach ($info as $item) {
          list($key, $value) = explode(':', $item);
          [$key, $value] = explode(':', $item);
          if (trim($key) === 'profiles') {
            $profiles_tmp = empty($value) ? [] : explode(',', $value);
            $frames[$i][trim($key)] = $profiles_tmp;
+1 −2
Original line number Diff line number Diff line
@@ -779,7 +779,6 @@ class ImagemagickToolkit extends ImageToolkitBase {
   *   TRUE if the file could be converted, FALSE otherwise.
   */
  protected function convert(): bool {
    $config = $this->configFactory->get('imagemagick.settings');

    // Ensure sourceLocalPath is prepared.
    $this->ensureSourceLocalPath();
@@ -854,7 +853,7 @@ class ImagemagickToolkit extends ImageToolkitBase {
    $requirements = [
      'imagemagick' => [
        'title' => $this->t('ImageMagick'),
        'value' => isset($value) ? $value : NULL,
        'value' => $value ?? NULL,
        'description' => [
          '#markup' => implode('<br />', $reported_info),
        ],
Loading