/**
  * Prefetch the project entity, or return a precached one from the projectCache array.
  * When the project doesn't exist yet, it creates the new entity and fetches TimeTrack settings
  *
  * When timetrack settings are enabled on the project, they can also be fetched for the Issue entity.
  *
  * @param $issueData
  * @return Project | null
  * @throws \InvalidArgumentException
  */
 private function preFetchProject($issueData)
 {
     $projectName = null;
     foreach ($issueData['field'] as $idx => $info) {
         if ($info['name'] == 'projectShortName') {
             $projectName = $info['value'];
             break;
         }
     }
     if ($projectName == null) {
         throw \InvalidArgumentException("No Project found for issue {$issueData['id']}");
     } else {
         if (!array_key_exists($projectName, $this->projectCache)) {
             $project = new Entity\Project($projectName);
             $project->setSettings($this->getTimeTrackingSettings($project));
             $this->projectCache[$projectName] = $project;
         }
         return $this->projectCache[$projectName];
     }
 }