Ver Fonte

Add PHPdoc

Alan Lam há 7 anos atrás
pai
commit
701a5142d4
8 ficheiros alterados com 135 adições e 0 exclusões
  1. 4 0
      controllers/test.php
  2. 4 0
      engine/core.php
  3. 27 0
      engine/customer.php
  4. 33 0
      engine/project.php
  5. 10 0
      engine/template.php
  6. 50 0
      engine/test.php
  7. 3 0
      engine/user.php
  8. 4 0
      views/test_verify_form.php

+ 4 - 0
controllers/test.php

@@ -1,5 +1,9 @@
 <?php
 
+/**
+ * @var Test $test
+ */
+
 Core::addScript("public/js/app-test.js");
 
 $test = Test::get($id);

+ 4 - 0
engine/core.php

@@ -1,7 +1,11 @@
 <?php
 
+
 class Core {
 
+	/**
+	 * @var User $user
+	 */
 	public static $user = null;
 	public static $admin = false;
 

+ 27 - 0
engine/customer.php

@@ -1,5 +1,26 @@
 <?php
 
+/**
+ * @property int $id
+ * @property string $name
+ * @property string $address_1
+ * @property string $address_2
+ * @property string $city
+ * @property string $county
+ * @property string $postal_code
+ * @property string $country
+ * @property string $email
+ * @property string $phone
+ * @property string $invoice_contact_name
+ * @property bool $email_after_test
+ * @property bool $email_locations_after_test
+ * @property string $internal_id_field_name
+ * @property string $region_field_name
+ * @property string $area_manager_field_name
+ *
+ * @method Customer get(int $id)
+ */
+
 class Customer extends Model {
 
 	protected static $table = "customer";
@@ -48,10 +69,16 @@ class Customer extends Model {
 		return Location::query($nvp, ["sort" => "name"]);
 	}
 
+	/**
+	 * @return Project[]
+	 */
 	public function getProjects() {
 		return Project::query(["customer_id" => $this->id], ["sort" => "dts_deadline", "order" => "desc"]);
 	}
 
+	/**
+	 * @return Template[]
+	 */
 	public function getTemplates() {
 		return Template::query(["customer_id" => $this->id], ["sort" => "name"]);
 	}

+ 33 - 0
engine/project.php

@@ -1,5 +1,29 @@
 <?php
 
+/**
+ * @property int $id
+ * @property int $customer_id
+ * @property int $template_id
+ * @property string $name
+ * @property int $test_count
+ * @property int $min_age
+ * @property int $max_age
+ * @property float $default_customer_fee
+ * @property float $default_tester_fee
+ * @property int $time_of_day
+ * @property bool $tester_can_claim
+ * @property string $template_overrides_json
+ * @property string $dts_start
+ * @property string $dts_deadline
+ * @property string $dts_created
+ * @property string $dts_updated
+ * @property string $dts_report
+ * @property string $dts_finished
+ * @property int $user_id_finished
+ *
+ * @method Project get(int $id)
+ */
+
 class Project extends Model {
 
 	protected static $table = "project";
@@ -10,10 +34,16 @@ class Project extends Model {
 	];
 
 	// Object methods
+	/**
+	 * @return Customer
+	 */
 	public function getCustomer() {
 		return Customer::get($this->customer_id);
 	}
 
+	/**
+	 * @return Test[]
+	 */
 	public function getTests() {
 
 		$nvp = [];
@@ -58,6 +88,9 @@ class Project extends Model {
 
 	}
 
+	/**
+	 * @return Template
+	 */
 	public function getTemplate() {
 		return Template::get($this->template_id);
 	}

+ 10 - 0
engine/template.php

@@ -1,5 +1,15 @@
 <?php
 
+/**
+ * @property int $id
+ * @property int $customer_id
+ * @property string $name
+ * @property string $json
+ * @property string $json_file
+ * @property bool $practice
+ * @property int $pass_stage
+ */
+
 class Template extends Model {
 
 	protected static $table = "template";

+ 50 - 0
engine/test.php

@@ -1,5 +1,43 @@
 <?php
 
+/**
+ * @property int $id
+ * @property int $project_id
+ * @property int $location_id
+ * @property int $tester_id
+ * @property int $status
+ * @property int $status_tester_invoice
+ * @property float $customer_fee
+ * @property float $test_fee
+ * @property string $test_time
+ * @property float $test_travel_cost
+ * @property string $shop_left
+ * @property string $shop_right
+ * @property string $attire
+ * @property int $challenge_stage
+ * @property string $challenge_description
+ * @property string $challenger_name
+ * @property string $challenger_description
+ * @property string $challenger_gender
+ * @property string $challenger_eye_contact
+ * @property string $additional_notes
+ * @property string $dts_due
+ * @property string $dts_start
+ * @property string $dts_end
+ * @property string $dts_tester_invoice_generated
+ * @property string $dts_tester_invoice_paid
+ * @property int $verifier_id
+ * @property string $verifier_notes
+ * @property bool $pass
+ * @property bool $retest
+ * @property string $dts_created
+ * @property string $dts_updated
+ * @property string $dts_assigned
+ * @property string $dts_verified
+ *
+ * @method Test get(int $id)
+ */
+
 class Test extends Model {
 
 	protected static $table = "test";
@@ -322,6 +360,9 @@ class Test extends Model {
 		return Project::get($this->project_id);
 	}
 
+	/**
+	 * @return Location
+	 */
 	public function getLocation() {
 		return Location::get($this->location_id);
 	}
@@ -372,16 +413,25 @@ class Test extends Model {
 		return "$mins min. $secs sec.";
 	}
 
+	/**
+	 * @return string Bootstrap class name
+	 */
 	public function getPassClass() {
 		if(is_null($this->pass)) return "secondary";
 		return $this->pass ? "success" : "danger";
 	}
 
+	/**
+	 * @return string FA icon name without prefix
+	 */
 	public function getPassIcon() {
 		if(is_null($this->pass)) return "clock";
 		return $this->pass ? "check-circle" : "times-circle";
 	}
 
+	/**
+	 * @return string Pending, Pass or Fail
+	 */
 	public function getPassText() {
 		if(is_null($this->pass)) return __("Pending");
 		return $this->pass ? __("Pass") : __("Fail");

+ 3 - 0
engine/user.php

@@ -437,6 +437,9 @@ class User extends Model {
 		return false;
 	}
 
+	/**
+	 * @return Customer[]
+	 */
 	public function getCustomers() {
 
 		if($this->level >= User::LEVEL_ADMIN) {

+ 4 - 0
views/test_verify_form.php

@@ -1,5 +1,9 @@
 <?php
 
+/**
+ * @var Test $test
+ */
+
 $test_details = [
 	"Status" => "<span class=\"badge badge-lg badge-" . $test->getStatusClass() . "\">" . $test->getStatusText() . "</span>",
 	"Result" => "<span class=\"badge badge-lg badge-" . $test->getPassClass() . "\">" . $test->getPassText() . "</span>",