title: Which SPL Exception should I use when validating set data before a process?
body: <p>I'm struggling to get my head around when to use a couple of the <a href="http://uk.php.net/manual/en/spl.exceptions.php" rel="nofollow">PHP SPL Exceptions</a>, specifically in the below scenario,</p>
  
  <pre><code>class MyClass {
      protected $data1;
      protected $data2;
  
      public function setData1($data1) {
          $this-&gt;data1 = $data1;
      }
  
      public function setData2($data2) {
          $this-&gt;data2 = $data2;
      }
  
      public function invokeProcess() {
          $this-&gt;validateData();
      }
  
      protected function validateData() {
          if(!$this-&gt;data1) {
              // Which Exception do I throw? See explanation below
          }
  
          if($this-&gt;data1 &amp;&amp; $this-&gt;data2) {
              // Which Exception do I throw? See explanation below
          }
      }
  }
  </code></pre>
  
  <p>I have a class which is constructed. The user then sets some data on the object, and invokes a process. The first thing this process does is validate the data on the object to make sure required data is present, data combinations are correct, etc, and if they aren't, an Exception needs to be thrown.</p>
  
  <p><strong>So what Exceptions do I throw?</strong></p>
  
  <p>My validation checks for two scenarios really,</p>
  
  <ol>
  <li>Missing data, a.k.a. data that has not been set.</li>
  <li>Bad combination of data.</li>
  </ol>
  
  <p>For #1, I'm torn between <code>BadMethodCallException</code>, <code>RuntimeException</code>, and <code>LogicException</code>. And for #2, I think it's just a <code>LogicException</code>?</p>
  
  <p>So, which ones so I use?</p>
  
  <p><strong>Note:</strong> Before anyone asks, I can't have required data as parameters in the constructor due to some data only being required when other data is set, etc.</p>