title: Responsibility of constructor, how much may it does?
body: <p>I want know if a constructor can do "deeped" things, of just initializing. Consider this:</p>
  
  <pre><code>class Entity
  {
      private $data;
  
      public function __construct(array $datasAlready)
      {
          $this-&gt;json_encode($datasAlready);
      }
  }
  </code></pre>
  
  <p>exising a <code>Entity</code> is pointless if no <code>$data</code> was filled. This way, I enforce load this.
  But my boss told its not okay, constructor ideally would only do basic inicializations, so:</p>
  
  <pre><code>class Entity
  {
      private $data;
  
      public function __construct(array $datasAlready)
      {
          $this-&gt;data = array();
      }
  
      public function load(array $datasAlready)
      {
          $this-&gt;json_encode($datasAlready);
      }
  }
  </code></pre>
  
  <p>or even constructor is not needed. But this way I miss the enforcing of initialization. What if I start using this object when not filled?</p>