title: Extending Laravel 5.1 Mess Detection the right way
body: <p>Laravel 5.1 has only one built-in hardcoded Mess Detection, it searches to see if @package tag is the same with /namespace, like so:</p>
  
  <pre><code>preg_match('/namespace\ ' . self::REQUIRED_NAMESPACE . '\\\(.*);/isU', $content, $namespace);
          preg_match('/\/*( )+@package\ (.*)[\r?\n]/isU', $content, $package);
  
          if (!isset($namespace[1]) || empty($namespace[1])) {
              continue;
          }
  </code></pre>
  
  <p>I want to extend this to add multiple detection classes.
  My folder structure currently looks like this:</p>
  
  <pre><code>Helpers &gt;
      Commands &gt;
          MessDetector &gt;
              Detector &gt;
                  DetectorInterface.php
                  DetectorAbstract.php
              PackageTagDetector.php
          MessDetector.php
  </code></pre>
  
  <p>The file MessDetector is made as an Artisan Command, that means it extends <strong>\Illuminate\Console\Command</strong></p>
  
  <p>I have a config file called <strong>mess_detection.php</strong> which has the detection rules like so:</p>
  
  <pre><code>return [
      'rules' =&gt; [
          '\Helpers\Commands\MessDetector\PackageTagDetector' =&gt;
              [
                  'rule' =&gt; '/\/*( )+@package\ (.*)[\r?\n]/isU',
                  'path' =&gt; app_path(),
                  'info' =&gt; 'Checking for @package tag',
                  'error'=&gt; 'Malformed or missing package tag'
              ]
          ]
      ];
  </code></pre>
  
  <p>But got stuck with figuring out how exactly to instantiate PackageTagDetector class in MessDetector class.</p>
  
  <p>Any ideas design pattern wise?</p>