Skip to content

Commit 5ef5c90

Browse files
committed
added getters to literals
1 parent 7cc5f5f commit 5ef5c90

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

src/Literals/Boolean.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ class Boolean implements BooleanType
3636
*/
3737
private bool $value;
3838

39+
/**
40+
* Returns the boolean value.
41+
*
42+
* @return bool
43+
*/
44+
public function getValue(): bool
45+
{
46+
return $this->value;
47+
}
48+
3949
/**
4050
* Boolean constructor.
4151
*

src/Literals/Decimal.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ class Decimal implements NumeralType
3636
*/
3737
private string $value;
3838

39+
/**
40+
* Returns the numeric string value.
41+
*
42+
* @return string
43+
*/
44+
public function getValue(): string
45+
{
46+
return $this->value;
47+
}
48+
3949
/**
4050
* Decimal constructor.
4151
*
@@ -51,6 +61,6 @@ public function __construct($value)
5161
*/
5262
public function toQuery(): string
5363
{
54-
return strval($this->value);
64+
return (string)$this->value;
5565
}
5666
}

src/Literals/StringLiteral.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,32 @@ public function __construct(string $value)
5454
$this->value = $value;
5555
}
5656

57+
/**
58+
* Returns the string value.
59+
*
60+
* @return string
61+
*/
62+
public function getValue(): string
63+
{
64+
return $this->value;
65+
}
66+
67+
/**
68+
* Returns whether the string uses double quotes. Single quotes are used if false.
69+
*
70+
* @return bool
71+
*/
72+
public function usesDoubleQuotes(): bool
73+
{
74+
return $this->useDoubleQuotes;
75+
}
76+
5777
/**
5878
* Whether to use double quotes or not.
5979
*
6080
* @param bool $useDoubleQuotes
6181
*/
62-
public function useDoubleQuotes(bool $useDoubleQuotes = true)
82+
public function useDoubleQuotes(bool $useDoubleQuotes = true): void
6383
{
6484
$this->useDoubleQuotes = $useDoubleQuotes;
6585
}

0 commit comments

Comments
 (0)