コード例 #1
0
 /**
  * Generates use statements out of namespaces for all classes used by the mocked class
  *
  * To help out with generating mocks, we're gathering the namespaces
  * that are used in typehinting as well as the ones declared at the
  * top of the file.
  *
  * @param   MockData   $mockData   MockData object
  * @param   EntityData $entityData EntityData object
  * @return  string
  */
 protected function generateUseStatements(MockData $mockData, EntityData $entityData)
 {
     $classUse = $mockData->getUseStatements();
     $mockedClassUse = "use {$entityData->getClassNamespace()}\\{$entityData->getClassName()};";
     array_unshift($classUse, $mockedClassUse);
     $propUse = $this->getUseStatementsFromClassProperties($mockData->getProperties());
     $methodUse = $this->getUseStatementsFromClassMethods($mockData->getMethods());
     $statements = array_merge($classUse, $propUse, $methodUse);
     return join(PHP_EOL, array_unique($statements));
 }