From 927e68f71bb0fbab8b6064da12c7f297e7a145f3 Mon Sep 17 00:00:00 2001 From: James Date: Sat, 7 Sep 2019 09:22:07 +0100 Subject: [PATCH] only POST new/changed data to the API when saving (#2) --- src/GiteaData.php | 3 +++ src/GiteaRepoData.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/GiteaData.php b/src/GiteaData.php index ace985b..7c402b1 100644 --- a/src/GiteaData.php +++ b/src/GiteaData.php @@ -4,8 +4,10 @@ namespace JHodges\GiteaBot; class GiteaData{ protected $data=null; + protected $newData=null; public function __construct($data=null){ + $this->newData=new stdClass(); if(!$data){ $data=new stdClass(); } @@ -14,6 +16,7 @@ class GiteaData{ public function __set($k,$v){ $this->data->$k=$v; + $this->newData->$k=$v; } public function __get($k){ diff --git a/src/GiteaRepoData.php b/src/GiteaRepoData.php index 5e8bb2f..33deb63 100644 --- a/src/GiteaRepoData.php +++ b/src/GiteaRepoData.php @@ -15,7 +15,7 @@ class GiteaRepoData extends GiteaData{ } public function save(){ - return $this->repo->request($this->url,'PATCH',$this->data); + return $this->repo->request($this->url,'PATCH',$this->newData); } }