for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace FLAIRUK\GoodTillSystem\Models;
use FLAIRUK\GoodTillSystem\API;
use Illuminate\Support\Facades\Config;
class Staff extends API {
/**
* The url attribute.
*
* @var string
*/
protected $url = 'staffs';
const STAFF = 'staffs';
* Create a new Good Till Product instance.
* @param array $user
* @return void
@return
Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.
Please refer to the PHP core documentation on constructors.
public function __construct(array $user) {
parent::__construct($user, $this->url);
}
public function setURL($url = null): void {
$this->url = $url ? $url : Config::get('goodtill.routes.api') . self::STAFF;
* Product Set Outlet ID
* @param $id
* @return object
public function setID($id): object {
$this->id = $id;
id
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
return $this;
public function setOutlet($id): object {
$this->outlet_id = ['outlet_id' => $id];
outlet_id
public function setName($name): object {
$this->product_name = ['product_name' => $name];
product_name
// $this->product_name = array_merge($this->payload, ['product_name' => $name ]);
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.