code: public function extractEnvironmentId(array $data): string
      {
          // Space resource
          if (isset($data['sys']['type']) && 'Space' === $data['sys']['type']) {
              return $this->environmentId;
          }
  
          // Environment resource
          if (isset($data['sys']['type']) && 'Environment' === $data['sys']['type']) {
              return $data['sys']['id'];
          }
  
          // Resource linked to a environment
          if (isset($data['sys']['environment'])) {
              return $data['sys']['environment']['sys']['id'];
          }
  
          // Array resource with at least an element
          if (isset($data['items'][0]['sys']['environment'])) {
              return $data['items'][0]['sys']['environment']['sys']['id'];
          }
  
          // Empty array resource
          if (isset($data['items']) && !$data['items']) {
              return $this->environmentId;
          }
  
          return 'master';
      }
docs: Checks a data structure and extracts the environment ID, if present.
  
  @param array $data
  
  @return string