diff --git a/lib/Gitlab/Model/Branch.php b/lib/Gitlab/Model/Branch.php index 9af9b08fe..7f2d7c971 100644 --- a/lib/Gitlab/Model/Branch.php +++ b/lib/Gitlab/Model/Branch.php @@ -16,7 +16,7 @@ class Branch extends AbstractModel public static function fromArray(Client $client, Project $project, array $data) { - $branch = new Branch($project, $data['name'], $client); + $branch = new static($project, $data['name'], $client); if (isset($data['commit'])) { $data['commit'] = Commit::fromArray($client, $project, $data['commit']); diff --git a/lib/Gitlab/Model/Commit.php b/lib/Gitlab/Model/Commit.php index 4353160ef..ef1806be9 100644 --- a/lib/Gitlab/Model/Commit.php +++ b/lib/Gitlab/Model/Commit.php @@ -25,7 +25,7 @@ class Commit extends AbstractModel public static function fromArray(Client $client, Project $project, array $data) { - $commit = new Commit($project, $data['id'], $client); + $commit = new static($project, $data['id'], $client); if (isset($data['parents'])) { $parents = array(); diff --git a/lib/Gitlab/Model/Event.php b/lib/Gitlab/Model/Event.php index 87b408dfc..87ad4c06b 100644 --- a/lib/Gitlab/Model/Event.php +++ b/lib/Gitlab/Model/Event.php @@ -20,7 +20,7 @@ class Event extends AbstractModel public static function fromArray(Client $client, Project $project, array $data) { - $event = new Event($project, $client); + $event = new static($project, $client); return $event->hydrate($data); } diff --git a/lib/Gitlab/Model/File.php b/lib/Gitlab/Model/File.php index c6c8a8f36..827143981 100644 --- a/lib/Gitlab/Model/File.php +++ b/lib/Gitlab/Model/File.php @@ -14,7 +14,7 @@ class File extends AbstractModel public static function fromArray(Client $client, Project $project, array $data) { - $file = new File($project, $data['file_path'], $client); + $file = new static($project, $data['file_path'], $client); return $file->hydrate($data); } diff --git a/lib/Gitlab/Model/Group.php b/lib/Gitlab/Model/Group.php index edf0e8e9a..27b1f96ef 100644 --- a/lib/Gitlab/Model/Group.php +++ b/lib/Gitlab/Model/Group.php @@ -16,7 +16,7 @@ class Group extends AbstractModel public static function fromArray(Client $client, array $data) { - $group = new Group($data['id'], $client); + $group = new static($data['id'], $client); if (isset($data['projects'])) { $projects = array(); diff --git a/lib/Gitlab/Model/Hook.php b/lib/Gitlab/Model/Hook.php index 5a0ef31d9..745ce7dad 100644 --- a/lib/Gitlab/Model/Hook.php +++ b/lib/Gitlab/Model/Hook.php @@ -14,7 +14,7 @@ class Hook extends AbstractModel public static function fromArray(Client $client, array $data) { - $hook = new Hook($data['id'], $client); + $hook = new static($data['id'], $client); return $hook->hydrate($data); } diff --git a/lib/Gitlab/Model/Issue.php b/lib/Gitlab/Model/Issue.php index fd7530dab..0d06dc0a9 100644 --- a/lib/Gitlab/Model/Issue.php +++ b/lib/Gitlab/Model/Issue.php @@ -25,7 +25,7 @@ class Issue extends AbstractModel public static function fromArray(Client $client, Project $project, array $data) { - $issue = new Issue($project, $data['id'], $client); + $issue = new static($project, $data['id'], $client); if (isset($data['author'])) { $data['author'] = User::fromArray($client, $data['author']); @@ -50,14 +50,14 @@ public function show() { $data = $this->api('issues')->show($this->project->id, $this->id); - return Issue::fromArray($this->getClient(), $this->project, $data); + return static::fromArray($this->getClient(), $this->project, $data); } public function update(array $params) { $data = $this->api('issues')->update($this->project->id, $this->id, $params); - return Issue::fromArray($this->getClient(), $this->project, $data); + return static::fromArray($this->getClient(), $this->project, $data); } public function close($comment = null) diff --git a/lib/Gitlab/Model/Key.php b/lib/Gitlab/Model/Key.php index 3a819d5de..f10fdaac5 100644 --- a/lib/Gitlab/Model/Key.php +++ b/lib/Gitlab/Model/Key.php @@ -15,7 +15,7 @@ class Key extends AbstractModel public static function fromArray(Client $client, array $data) { - $key = new Key($client); + $key = new static($client); return $key->hydrate($data); } diff --git a/lib/Gitlab/Model/MergeRequest.php b/lib/Gitlab/Model/MergeRequest.php index 52592b487..cfa1d6e24 100644 --- a/lib/Gitlab/Model/MergeRequest.php +++ b/lib/Gitlab/Model/MergeRequest.php @@ -27,7 +27,7 @@ class MergeRequest extends AbstractModel public static function fromArray(Client $client, Project $project, array $data) { - $mr = new MergeRequest($project, $data['id'], $client); + $mr = new static($project, $data['id'], $client); if (isset($data['author'])) { $data['author'] = User::fromArray($client, $data['author']); @@ -52,14 +52,14 @@ public function show() { $data = $this->api('mr')->show($this->project->id, $this->id); - return MergeRequest::fromArray($this->getClient(), $this->project, $data); + return static::fromArray($this->getClient(), $this->project, $data); } public function update(array $params) { $data = $this->api('mr')->update($this->project->id, $this->id, $params); - return MergeRequest::fromArray($this->getClient(), $this->project, $data); + return static::fromArray($this->getClient(), $this->project, $data); } public function close($comment = null) diff --git a/lib/Gitlab/Model/Milestone.php b/lib/Gitlab/Model/Milestone.php index ee21357ed..75d3e65bf 100644 --- a/lib/Gitlab/Model/Milestone.php +++ b/lib/Gitlab/Model/Milestone.php @@ -22,7 +22,7 @@ class Milestone extends AbstractModel public static function fromArray(Client $client, Project $project, array $data) { - $milestone = new Milestone($project, $data['id'], $client); + $milestone = new static($project, $data['id'], $client); return $milestone->hydrate($data); } @@ -39,14 +39,14 @@ public function show() { $data = $this->api('milestones')->show($this->project->id, $this->id); - return Milestone::fromArray($this->getClient(), $this->project, $data); + return static::fromArray($this->getClient(), $this->project, $data); } public function update(array $params) { $data = $this->api('milestones')->update($this->project->id, $this->id, $params); - return Milestone::fromArray($this->getClient(), $this->project, $data); + return static::fromArray($this->getClient(), $this->project, $data); } public function complete() diff --git a/lib/Gitlab/Model/Node.php b/lib/Gitlab/Model/Node.php index 90f110a5b..881479840 100644 --- a/lib/Gitlab/Model/Node.php +++ b/lib/Gitlab/Model/Node.php @@ -16,7 +16,7 @@ class Node extends AbstractModel public static function fromArray(Client $client, Project $project, array $data) { - $node = new Node($project, $data['id'], $client); + $node = new static($project, $data['id'], $client); return $node->hydrate($data); } diff --git a/lib/Gitlab/Model/Note.php b/lib/Gitlab/Model/Note.php index 3a0d45e53..0af1778c7 100644 --- a/lib/Gitlab/Model/Note.php +++ b/lib/Gitlab/Model/Note.php @@ -19,7 +19,7 @@ class Note extends AbstractModel public static function fromArray(Client $client, $type, array $data) { - $comment = new Note($type, $data['id'], $client); + $comment = new static($type, $data['id'], $client); if (isset($data['author'])) { $data['author'] = User::fromArray($client, $data['author']); diff --git a/lib/Gitlab/Model/Project.php b/lib/Gitlab/Model/Project.php index db517aaf3..93e2a9b51 100644 --- a/lib/Gitlab/Model/Project.php +++ b/lib/Gitlab/Model/Project.php @@ -35,7 +35,7 @@ class Project extends AbstractModel public static function fromArray(Client $client, array $data) { - $project = new Project($data['id']); + $project = new static($data['id']); $project->setClient($client); if (isset($data['owner'])) { @@ -53,7 +53,7 @@ public static function create(Client $client, $name, array $params = array()) { $data = $client->api('projects')->create($name, $params); - return Project::fromArray($client, $data); + return static::fromArray($client, $data); } public function __construct($id = null, Client $client = null) @@ -66,7 +66,7 @@ public function show() { $data = $this->api('projects')->show($this->id); - return Project::fromArray($this->getClient(), $data); + return static::fromArray($this->getClient(), $data); } public function remove() diff --git a/lib/Gitlab/Model/ProjectNamespace.php b/lib/Gitlab/Model/ProjectNamespace.php index a93281403..0b776e00a 100644 --- a/lib/Gitlab/Model/ProjectNamespace.php +++ b/lib/Gitlab/Model/ProjectNamespace.php @@ -18,7 +18,7 @@ class ProjectNamespace extends AbstractModel public static function fromArray(Client $client, array $data) { - $project = new ProjectNamespace($data['id']); + $project = new static($data['id']); $project->setClient($client); return $project->hydrate($data); diff --git a/lib/Gitlab/Model/Session.php b/lib/Gitlab/Model/Session.php index 367fb27b3..7ea6d1962 100644 --- a/lib/Gitlab/Model/Session.php +++ b/lib/Gitlab/Model/Session.php @@ -17,7 +17,7 @@ class Session extends AbstractModel public static function fromArray(Client $client, array $data) { - $session = new Session($client); + $session = new static($client); return $session->hydrate($data); } diff --git a/lib/Gitlab/Model/Snippet.php b/lib/Gitlab/Model/Snippet.php index b92e91ca0..868cf4f80 100644 --- a/lib/Gitlab/Model/Snippet.php +++ b/lib/Gitlab/Model/Snippet.php @@ -19,7 +19,7 @@ class Snippet extends AbstractModel public static function fromArray(Client $client, Project $project, array $data) { - $snippet = new Snippet($project, $data['id'], $client); + $snippet = new static($project, $data['id'], $client); if (isset($data['author'])) { $data['author'] = User::fromArray($client, $data['author']); @@ -40,14 +40,14 @@ public function show() { $data = $this->api('snippets')->show($this->project->id, $this->id); - return Snippet::fromArray($this->getClient(), $this, $data); + return static::fromArray($this->getClient(), $this, $data); } public function update(array $params) { $data = $this->api('snippets')->update($this->project->id, $this->id, $params); - return Snippet::fromArray($this->getClient(), $this, $data); + return static::fromArray($this->getClient(), $this, $data); } public function content() diff --git a/lib/Gitlab/Model/Tag.php b/lib/Gitlab/Model/Tag.php index a63afdef5..971921f4a 100644 --- a/lib/Gitlab/Model/Tag.php +++ b/lib/Gitlab/Model/Tag.php @@ -15,7 +15,7 @@ class Tag extends AbstractModel public static function fromArray(Client $client, Project $project, array $data) { - $branch = new Tag($project, $data['name'], $client); + $branch = new static($project, $data['name'], $client); if (isset($data['commit'])) { $data['commit'] = Commit::fromArray($client, $project, $data['commit']); diff --git a/lib/Gitlab/Model/User.php b/lib/Gitlab/Model/User.php index 92b2cfbd9..d20eb50da 100644 --- a/lib/Gitlab/Model/User.php +++ b/lib/Gitlab/Model/User.php @@ -35,7 +35,7 @@ public static function fromArray(Client $client, array $data) { $id = isset($data['id']) ? $data['id'] : 0; - $user = new User($id, $client); + $user = new static($id, $client); return $user->hydrate($data); } @@ -44,7 +44,7 @@ public static function create(Client $client, $email, $password, array $params = { $data = $client->api('users')->create($email, $password, $params); - return User::fromArray($client, $data); + return static::fromArray($client, $data); } public function __construct($id = null, Client $client = null) @@ -58,14 +58,14 @@ public function show() { $data = $this->api('users')->show($this->id); - return User::fromArray($this->getClient(), $data); + return static::fromArray($this->getClient(), $data); } public function update(array $params) { $data = $this->api('users')->update($this->id, $params); - return User::fromArray($this->getClient(), $data); + return static::fromArray($this->getClient(), $data); } public function remove()