title: Call method before another
body: <p>I have bunch of methods in which i need to test whether remote server has been reached or not and if not, reach it.</p>
  
  <p>My first idea was __call magic method, but the method is called <strong>only when real method</strong> (with the original name) <strong>is not presented</strong>.</p>
  
  <pre><code>&lt;?php
  public function __call( $name, $arguments ) {
      $needsExecution = array(
          'getBody', 'getHeader', 'getHeaders', 'getRawOutput',
          'getStatusCode', 'getFullHttp'
      );
  
      if ( in_array( $name, $needsExecution ) ) {
          if ( !$this-&gt;hasBeenExecuted() ) {
              $this-&gt;execute();
          }
      }
  }
  
  public function getBody() {
      return $this-&gt;responseBody;
  }
  
  
  public function getHeaders() {
      return $this-&gt;responseHeaders;
  }
  
  ?&gt;
  </code></pre>
  
  <p>Do I really need to have bunch of if's in each method or there's a way how to do that better?</p>