brantje /
nextnote
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Nextcloud - ownnote |
||
| 4 | * |
||
| 5 | * @copyright Copyright (c) 2015, Ben Curtis <[email protected]> |
||
| 6 | * @copyright Copyright (c) 2017, Sander Brand ([email protected]) |
||
| 7 | * @license GNU AGPL version 3 or any later version |
||
| 8 | * |
||
| 9 | * This program is free software: you can redistribute it and/or modify |
||
| 10 | * it under the terms of the GNU Affero General Public License as |
||
| 11 | * published by the Free Software Foundation, either version 3 of the |
||
| 12 | * License, or (at your option) any later version. |
||
| 13 | * |
||
| 14 | * This program is distributed in the hope that it will be useful, |
||
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 17 | * GNU Affero General Public License for more details. |
||
| 18 | * |
||
| 19 | * You should have received a copy of the GNU Affero General Public License |
||
| 20 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
| 21 | * |
||
| 22 | */ |
||
| 23 | |||
| 24 | namespace OCA\OwnNote\Db; |
||
| 25 | use \OCP\AppFramework\Db\Entity; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @method integer getId() |
||
| 29 | * @method void setId($value) |
||
| 30 | * @method void setName(string $value) |
||
| 31 | * @method string getName() |
||
| 32 | * @method void setGrouping(string $value) |
||
| 33 | * @method string getGrouping() |
||
| 34 | * @method void setUid(string $value) |
||
| 35 | * @method string getNote() |
||
| 36 | * @method void setNote(string $value) |
||
| 37 | * @method string getUid() |
||
| 38 | * @method void setMtime(integer $value) |
||
| 39 | * @method integer getMtime() |
||
| 40 | * @method void setDeleted(integer $value) |
||
| 41 | * @method integer getDeleted() |
||
| 42 | */ |
||
| 43 | |||
| 44 | |||
| 45 | class OwnNote extends Entity implements \JsonSerializable{ |
||
| 46 | |||
| 47 | use EntityJSONSerializer; |
||
| 48 | |||
| 49 | protected $name; |
||
| 50 | protected $grouping; |
||
| 51 | protected $uid; |
||
| 52 | protected $mtime; |
||
| 53 | protected $deleted; |
||
| 54 | protected $note; |
||
| 55 | |||
| 56 | public function __construct() { |
||
| 57 | // add types in constructor |
||
| 58 | $this->addType('mtime', 'integer'); |
||
| 59 | } |
||
| 60 | /** |
||
| 61 | * Turns entity attributes into an array |
||
| 62 | */ |
||
| 63 | public function jsonSerialize() { |
||
| 64 | $now = new \DateTime(); |
||
| 65 | return [ |
||
| 66 | 'id' => $this->getId(), |
||
| 67 | 'mtime' => $this->getMtime(), |
||
| 68 | 'timediff' => $now->getTimestamp() - $this->getMtime(), |
||
| 69 | 'name' => $this->getName(), |
||
|
1 ignored issue
–
show
Bug
introduced
by
Loading history...
|
|||
| 70 | 'uid' => $this->getUid(), |
||
| 71 | 'group' => ($this->getGrouping()) ? $this->getGrouping() : '', |
||
| 72 | 'note' => $this->getNote(), |
||
| 73 | 'deleted' => $this->getDeleted(), |
||
| 74 | ]; |
||
| 75 | } |
||
| 76 | } |