/**
  * Update/add a spec for a given specsPerMethod object.
  * It returns a new instance.
  *
  * @param \Box\TestScribe\Spec\SpecsPerMethod $specsPerMethod
  * @param OneSpec $oneSpec
  *
  * @return \Box\TestScribe\Spec\SpecsPerMethod
  */
 public function addOneSpec(SpecsPerMethod $specsPerMethod, OneSpec $oneSpec)
 {
     $testName = $oneSpec->getTestName();
     $specs = $specsPerMethod->getSpecs();
     $methodName = $specsPerMethod->getMethodName();
     $specs[$testName] = $oneSpec;
     $newSpecsPerMethod = new SpecsPerMethod($methodName, $specs);
     return $newSpecsPerMethod;
 }
 /**
  * @param \Box\TestScribe\Spec\SpecsPerMethod $spec
  *
  * @return array
  */
 public function encodeSpecsPerMethod(SpecsPerMethod $spec)
 {
     $methodName = $spec->getMethodName();
     $specs = $spec->getSpecs();
     $values = array_values($specs);
     $encodedSpecs = [];
     foreach ($values as $oneSpec) {
         $encodedOneSpec = $this->oneSpecPersistence->encodeOneSpec($oneSpec);
         $encodedSpecs[] = $encodedOneSpec;
     }
     $encoded = [self::METHOD_NAME_KEY => $methodName, self::TESTS_KEY => $encodedSpecs];
     return $encoded;
 }