title: php error of Using $this when not in object in context
body: <p>codes in both the files are deleted to make it concise and to the point :</p>
  
  <h2>controller/LessonMainController.php</h2>
  
  <pre><code>use demo\Model\Courses\CourseToUser;
  use demo\Model\Courses\CourseDependency;
  use demo\Model\User;
  use demo\Model\Course;
  
      if (!CourseDependency::isDependencyAccessible($_GET['course']) || !$this-&gt;course-&gt;isDateAccessible())
   {
     TemplateController::setMessage("This course does not exist or you are not allowed to access it");
     UrlhelperController::redirect(array('ctg' =&gt; 'start'));
    }
  </code></pre>
  
  <h2>Model/Courses/CourseDependency.php</h2>
  
  <pre><code>public static function isDependencyAccessible($course_id, $user_id = false) {
          self::checkId($course_id);
          if (!$user_id) {
              $user_id = User::getCurrentUser()-&gt;id;
          }
          $courses =  self::getDependencies($course_id);
  
          $access = true;
          if (!empty($courses)) {
              $user  = new User($user_id);
              $user_to_courses = CourseToUser::getAll(array('condition' =&gt; 'users_ID='.$user-&gt;id." and courses_ID IN (".implode(",", $courses).")"), array('courses_ID', 'status'));
  
              foreach ($user_to_courses as $value) {
                  if ($value['status'] != CourseToUser::STATUS_COMPLETED) {
                       $access = false;
                  }
              }
          }
          return $access;
      }
  
  }
  </code></pre>
  
  <h2>PROBELM:</h2>
  
  <p>In the absence of <code>!CourseDependency::isDependencyAccessible($_GET['course'])</code> everything works well but with this condition i get the error <code>Using $this when not in object context (0)</code> Please guide me to fix this.</p>