title: Only append parameter to class when condition true
body: <p>I was looking at this code and noticed it seemed a lot of code just to run 2 checks, and I remembered coding in C# and there was a way to shorten the code to just one check but add a (something ? something) in it, is there a way to do something like this in PHP? </p>
  
  <pre><code>if ($config-&gt;get('core:twig.caching.enabled')) {
      $this-&gt;twig = new \Twig_Environment($loader, array(
          'cache' =&gt; $config-&gt;get('core:template.cache_directory'),
      ));
  }
  else {
      $this-&gt;twig = new \Twig_Environment($loader);
  }
  </code></pre>