Skip to content

Commit cf61e97

Browse files
committed
replace 'array_key_exists' with 'Arr::exists'
- and replace == to ===, != to !== in according places
1 parent e5f3363 commit cf61e97

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/Entities/Properties/Formula.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use DateTime;
66
use FiveamCode\LaravelNotionApi\Entities\PropertyItems\RichDate;
7+
use Illuminate\Support\Arr;
78

89
/**
910
* Class Formula
@@ -20,12 +21,12 @@ protected function fillFromRaw(): void
2021
{
2122
parent::fillFromRaw();
2223

23-
if (array_key_exists('type', $this->rawContent)) {
24+
if (Arr::exists($this->rawContent, 'type')) {
2425
$this->formulaType = $this->rawContent['type'];
2526

26-
if ($this->formulaType == 'string' || $this->formulaType == 'number' || $this->formulaType == 'boolean') {
27+
if ($this->formulaType === 'string' || $this->formulaType === 'number' || $this->formulaType === 'boolean') {
2728
$this->content = $this->rawContent[$this->formulaType];
28-
} else if ($this->formulaType == 'date') {
29+
} else if ($this->formulaType === 'date') {
2930
$this->content = new RichDate();
3031
if (isset($this->rawContent[$this->formulaType]['start'])) $this->content->setStart(new DateTime($this->rawContent[$this->formulaType]['start']));
3132
if (isset($this->rawContent[$this->formulaType]['end'])) $this->content->setEnd(new DateTime($this->rawContent[$this->formulaType]['end']));

src/Entities/Properties/LastEditedTime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ protected function fillFromRaw(): void
2020
parent::fillFromRaw();
2121

2222
try {
23-
if ($this->rawContent != null) {
23+
if ($this->rawContent !== null) {
2424
$this->content = new DateTime($this->rawContent);
2525
}
2626
} catch (Exception $e) {

src/Entities/Properties/MultiSelect.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use FiveamCode\LaravelNotionApi\Entities\Contracts\Modifiable;
66
use FiveamCode\LaravelNotionApi\Entities\PropertyItems\SelectItem;
77
use FiveamCode\LaravelNotionApi\Exceptions\HandlingException;
8+
use Illuminate\Support\Arr;
89
use Illuminate\Support\Collection;
910

1011
/**
@@ -56,7 +57,7 @@ protected function fillFromRaw(): void
5657

5758
$itemCollection = new Collection();
5859

59-
if(array_key_exists('options', $this->rawContent)){
60+
if(Arr::exists($this->rawContent, 'options')){
6061
$this->options = new Collection();
6162
foreach ($this->rawContent['options'] as $key => $item) {
6263
$this->options->add(new SelectItem($item));

src/Entities/Properties/Rollup.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use DateTime;
66
use FiveamCode\LaravelNotionApi\Entities\PropertyItems\RichDate;
77
use FiveamCode\LaravelNotionApi\Exceptions\HandlingException;
8+
use Illuminate\Support\Arr;
89
use Illuminate\Support\Collection;
910

1011
/**
@@ -22,7 +23,7 @@ protected function fillFromRaw(): void
2223
{
2324
parent::fillFromRaw();
2425

25-
if(array_key_exists('type', $this->rawContent))
26+
if(Arr::exists($this->rawContent, 'type'))
2627
{
2728
$this->rollupType = $this->rawContent['type'];
2829

0 commit comments

Comments
 (0)