/**
  * Create Branch
  *
  * @param string                        $name
  * @param string                        $description
  * @param null|string                   $key
  * @param null|User                     $defaultAssignee
  * @param Logo|null|\SplFileInfo        $logo
  * @param null|array|ArrayCollection    $tags
  * @return Branch
  */
 public function create($name, $description, $key = null, User $defaultAssignee = null, Logo $logo = null, $tags = null)
 {
     if (is_null($key) || empty($key)) {
         $key = $this->branchKeyGenerator->generate($name);
     }
     return new $this->entityClassName($key, $name, $description, $defaultAssignee, $logo, $tags);
 }
 /**
  * Create Branch
  *
  * @param string                     $name
  * @param string                     $description
  * @param null|string                $key
  * @param null|User                  $defaultAssignee
  * @param null|\SplFileInfo          $logo
  * @param string|null                $originalName
  * @param null|array|ArrayCollection $tags
  *
  * @return Branch
  */
 public function create($name, $description, $key = null, User $defaultAssignee = null, \SplFileInfo $logo = null, $originalName = null, $tags = null)
 {
     if ($logo) {
         $logo = new Logo($logo->getFilename(), $originalName);
     }
     if (is_null($key) || empty($key)) {
         $key = $this->branchKeyGenerator->generate($name);
     }
     return new $this->entityClassName($key, $name, $description, $defaultAssignee, $logo, $tags);
 }
 public function testCreateWhenKeyIsNotDefined()
 {
     $this->branchKeyGenerator->expects($this->once())->method('generate')->with(self::NAME)->will($this->returnValue(self::KEY));
     $branch = $this->factory->create(self::NAME, self::DESCRIPTION);
     $this->assertEquals(self::KEY, $branch->getKey());
 }