/**
  * Update/add a spec for a given specsPerClass object.
  * It returns a new instance.
  *
  * @param \Box\TestScribe\Spec\SpecsPerClass $specsPerClass
  * @param string $methodName
  * @param OneSpec $oneSpec
  *
  * @return \Box\TestScribe\Spec\SpecsPerClass
  */
 public function addOneSpec(SpecsPerClass $specsPerClass, $methodName, OneSpec $oneSpec)
 {
     $specsPerMethod = $specsPerClass->getSpecsPerMethodByName($methodName);
     $newSpecsPerMethod = $this->specsPerMethodService->addOneSpec($specsPerMethod, $oneSpec);
     $specs = $specsPerClass->getSpecs();
     $fullClassName = $specsPerClass->getFullClassName();
     $specs[$methodName] = $newSpecsPerMethod;
     $newSpecsPerClass = new SpecsPerClass($fullClassName, $specs);
     return $newSpecsPerClass;
 }
 /**
  * @param \Box\TestScribe\Spec\SpecsPerClass $spec
  *
  * @return array
  */
 public function encodeSpecsPerClass(SpecsPerClass $spec)
 {
     $fullClassName = $spec->getFullClassName();
     $specs = $spec->getSpecs();
     $encodedSpecs = [];
     $values = array_values($specs);
     foreach ($values as $oneSpecsPerMethod) {
         $encodedSpecsPerMethod = $this->specsPerMethodPersistence->encodeSpecsPerMethod($oneSpecsPerMethod);
         $encodedSpecs[] = $encodedSpecsPerMethod;
     }
     $encoded = [self::CLASS_NAME_KEY => $fullClassName, self::METHODS_KEY => $encodedSpecs];
     return $encoded;
 }