/**
  * Get the Parent of the given base class, if any.
  *
  * @param PackageClass $package_class the base for which the parent needs to be extracted.
  * @return NULL|\Hostnet\Component\EntityPlugin\PackageClass the parent class if any, otherwise null is returned.
  */
 protected function getParentClass(PackageClass $package_class)
 {
     try {
         $base_class = new \ReflectionClass($package_class->getName());
     } catch (\ReflectionException $e) {
         return null;
     }
     if (false === ($parent_reflection = $base_class->getParentClass()) || dirname($parent_reflection->getFileName()) !== dirname($base_class->getFileName())) {
         return null;
     }
     return new PackageClass($parent_reflection->getName(), $parent_reflection->getFileName());
 }
 /**
  * @dataProvider getAliasProvider
  */
 public function testGetAlias($class, $expected)
 {
     $package_class = new PackageClass($class, __DIR__);
     $this->assertEquals($expected, $package_class->getAlias());
 }
 /**
  * Generates Generated/<class_name>Traits.php
  *
  * @param PackageClass $package_class
  * @param array $traits
  */
 private function generateTrait(PackageClass $package_class, array $traits)
 {
     $short_name = $package_class->getShortName();
     $this->writeIfVeryVerbose('        - Generating trait of traits for <info>' . $package_class->getName() . '</info>');
     $generated_namespace = $package_class->getGeneratedNamespaceName();
     $use_statements = array_filter($traits, function (PackageClass $stmt) {
         return $stmt->isTrait();
     });
     sort($use_statements);
     $data = $this->environment->render('trait.php.twig', ['class_name' => $short_name, 'namespace' => $generated_namespace, 'use_statements' => $use_statements]);
     $this->filesystem->dumpFile($package_class->getGeneratedDirectory() . $short_name . 'Trait.php', $data);
 }