/**
  * Invoke a method on the target object regardless if the method is private, protected or public.
  *
  * @param object|null                         $targetObject null if the method is static
  * @param \Box\TestScribe\MethodInfo\Method    $method
  * @param \Box\TestScribe\ArgumentInfo\Arguments $arguments
  *
  * @return mixed
  */
 public function invokeMethodRegardlessOfProtectionLevel($targetObject, Method $method, Arguments $arguments)
 {
     $className = $method->getFullClassName();
     $argumentValues = $arguments->getValues();
     // @TODO (ryang 2/3/15) : warn against testing private methods directly.
     // @TODO (ryang 6/8/15) : only change accessibility when the method is not public
     $reflectionClass = new \ReflectionClass($className);
     $methodName = $method->getName();
     $reflectionMethod = $reflectionClass->getMethod($methodName);
     $reflectionMethod->setAccessible(true);
     $this->output->writeln("\nStart executing method ( {$methodName} ).\n");
     $executionResult = $reflectionMethod->invokeArgs($targetObject, $argumentValues);
     $this->output->writeln("\nFinish executing method ( {$methodName} ).\n");
     return $executionResult;
 }
 /**
  * Generate the argument list string to be used in the method invocation statement.
  *
  * @param \Box\TestScribe\ArgumentInfo\Arguments $argsObj
  *
  * @return string
  */
 public function renderArgumentsAsStringInCode(Arguments $argsObj)
 {
     $expressions = $argsObj->getExpressions();
     $argumentsString = implode(', ', $expressions);
     return $argumentsString;
 }