This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Symbiote\QueuedJobs\Jobs; |
||
4 | |||
5 | use Exception; |
||
6 | use Page; |
||
7 | use SilverStripe\Control\Director; |
||
8 | use SilverStripe\Core\Config\Configurable; |
||
9 | use SilverStripe\Core\Environment; |
||
10 | use SilverStripe\Core\Injector\Injector; |
||
11 | use SilverStripe\Core\TempFolder; |
||
12 | use SilverStripe\ErrorPage\ErrorPage; |
||
13 | use SilverStripe\ORM\DB; |
||
14 | use SilverStripe\ORM\FieldType\DBDatetime; |
||
15 | use SilverStripe\Versioned\Versioned; |
||
16 | use Symbiote\QueuedJobs\Services\AbstractQueuedJob; |
||
17 | use Symbiote\QueuedJobs\Services\QueuedJob; |
||
18 | use Symbiote\QueuedJobs\Services\QueuedJobService; |
||
19 | |||
20 | /** |
||
21 | * A job for generating a site's google sitemap |
||
22 | * |
||
23 | * If the sitemap module is installed, uses information from that to populate things |
||
24 | * |
||
25 | * @author [email protected] |
||
26 | * @license http://silverstripe.org/bsd-license/ |
||
27 | */ |
||
28 | class GenerateGoogleSitemapJob extends AbstractQueuedJob |
||
29 | { |
||
30 | use Configurable; |
||
31 | |||
32 | /** |
||
33 | * @config |
||
34 | * @var int |
||
35 | */ |
||
36 | private static $regenerate_time = 43200; |
||
37 | |||
38 | public function __construct() |
||
39 | { |
||
40 | $this->pagesToProcess = DB::query('SELECT ID FROM "SiteTree_Live" WHERE "ShowInSearch"=1')->column(); |
||
0 ignored issues
–
show
|
|||
41 | $this->currentStep = 0; |
||
42 | $this->totalSteps = count($this->pagesToProcess); |
||
0 ignored issues
–
show
The property
pagesToProcess does not exist on object<Symbiote\QueuedJo...nerateGoogleSitemapJob> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
43 | } |
||
44 | |||
45 | /** |
||
46 | * Sitemap job is going to run for a while... |
||
47 | * |
||
48 | * @return int |
||
49 | */ |
||
50 | public function getJobType() |
||
51 | { |
||
52 | return QueuedJob::QUEUED; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @return string |
||
57 | */ |
||
58 | public function getTitle() |
||
59 | { |
||
60 | return _t(__CLASS__ . '.REGENERATE', 'Regenerate Google sitemap .xml file'); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Return a signature for this queued job |
||
65 | * |
||
66 | * For the generate sitemap job, we only ever want one instance running, so just use the class name |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | public function getSignature() |
||
71 | { |
||
72 | return md5(get_class($this)); |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * Note that this is duplicated for backwards compatibility purposes... |
||
77 | */ |
||
78 | public function setup() |
||
79 | { |
||
80 | parent::setup(); |
||
81 | Environment::increaseTimeLimitTo(); |
||
82 | |||
83 | $restart = $this->currentStep == 0; |
||
84 | if (!$this->tempFile || !file_exists($this->tempFile)) { |
||
0 ignored issues
–
show
The property
tempFile does not exist on object<Symbiote\QueuedJo...nerateGoogleSitemapJob> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
85 | $tmpfile = tempnam(TempFolder::getTempFolder(BASE_PATH), 'sitemap'); |
||
86 | if (file_exists($tmpfile)) { |
||
87 | $this->tempFile = $tmpfile; |
||
0 ignored issues
–
show
The property
tempFile does not exist on object<Symbiote\QueuedJo...nerateGoogleSitemapJob> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
88 | } |
||
89 | $restart = true; |
||
90 | } |
||
91 | |||
92 | if ($restart) { |
||
93 | $this->pagesToProcess = DB::query('SELECT ID FROM SiteTree_Live WHERE ShowInSearch=1')->column(); |
||
0 ignored issues
–
show
The property
pagesToProcess does not exist on object<Symbiote\QueuedJo...nerateGoogleSitemapJob> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
94 | } |
||
95 | } |
||
96 | |||
97 | /** |
||
98 | * On any restart, make sure to check that our temporary file is being created still. |
||
99 | */ |
||
100 | public function prepareForRestart() |
||
101 | { |
||
102 | parent::prepareForRestart(); |
||
103 | // if the file we've been building is missing, lets fix it up |
||
104 | if (!$this->tempFile || !file_exists($this->tempFile)) { |
||
0 ignored issues
–
show
The property
tempFile does not exist on object<Symbiote\QueuedJo...nerateGoogleSitemapJob> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
105 | $tmpfile = tempnam(TempFolder::getTempFolder(BASE_PATH), 'sitemap'); |
||
106 | if (file_exists($tmpfile)) { |
||
107 | $this->tempFile = $tmpfile; |
||
0 ignored issues
–
show
The property
tempFile does not exist on object<Symbiote\QueuedJo...nerateGoogleSitemapJob> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
108 | } |
||
109 | $this->currentStep = 0; |
||
110 | $this->pagesToProcess = DB::query('SELECT ID FROM SiteTree_Live WHERE ShowInSearch=1')->column(); |
||
0 ignored issues
–
show
The property
pagesToProcess does not exist on object<Symbiote\QueuedJo...nerateGoogleSitemapJob> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
111 | } |
||
112 | } |
||
113 | |||
114 | public function process() |
||
115 | { |
||
116 | if (!$this->tempFile) { |
||
0 ignored issues
–
show
The property
tempFile does not exist on object<Symbiote\QueuedJo...nerateGoogleSitemapJob> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
117 | throw new Exception("Temporary sitemap file has not been set"); |
||
118 | } |
||
119 | |||
120 | if (!file_exists($this->tempFile)) { |
||
0 ignored issues
–
show
The property
tempFile does not exist on object<Symbiote\QueuedJo...nerateGoogleSitemapJob> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
121 | throw new Exception("Temporary file $this->tempFile has been deleted!"); |
||
0 ignored issues
–
show
The property
tempFile does not exist on object<Symbiote\QueuedJo...nerateGoogleSitemapJob> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
122 | } |
||
123 | |||
124 | $remainingChildren = $this->pagesToProcess; |
||
0 ignored issues
–
show
The property
pagesToProcess does not exist on object<Symbiote\QueuedJo...nerateGoogleSitemapJob> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
125 | |||
126 | // if there's no more, we're done! |
||
127 | if (!count($remainingChildren)) { |
||
128 | $this->completeJob(); |
||
129 | $this->isComplete = true; |
||
130 | return; |
||
131 | } |
||
132 | |||
133 | // lets process our first item - note that we take it off the list of things left to do |
||
134 | $ID = array_shift($remainingChildren); |
||
135 | |||
136 | // get the page |
||
137 | $page = Versioned::get_by_stage(Page::class, Versioned::LIVE, '"SiteTree_Live"."ID" = ' . $ID); |
||
138 | |||
139 | if (!$page || !$page->Count()) { |
||
140 | $this->addMessage("Page ID #$ID could not be found, skipping"); |
||
141 | } else { |
||
142 | $page = $page->First(); |
||
143 | } |
||
144 | |||
145 | if ($page && $page instanceof Page && !($page instanceof ErrorPage)) { |
||
0 ignored issues
–
show
The class
SilverStripe\ErrorPage\ErrorPage does not exist. Did you forget a USE statement, or did you not list all dependencies?
This error could be the result of: 1. Missing dependenciesPHP Analyzer uses your Are you sure this class is defined by one of your dependencies, or did you maybe
not list a dependency in either the 2. Missing use statementPHP does not complain about undefined classes in if ($x instanceof DoesNotExist) {
// Do something.
}
If you have not tested against this specific condition, such errors might go unnoticed. ![]() |
|||
146 | if ($page->canView() && (!isset($page->Priority) || $page->Priority > 0)) { |
||
147 | /** @var DBDatetime $created */ |
||
148 | $created = $page->dbObject('Created'); |
||
149 | $now = DBDatetime::create(); |
||
150 | $now->setValue(DBDatetime::now()->Rfc2822()); |
||
151 | $versions = $page->Version; |
||
152 | $timediff = $now->format('U') - $created->format('U'); |
||
153 | |||
154 | // Check how many revisions have been made over the lifetime of the |
||
155 | // Page for a rough estimate of it's changing frequency. |
||
156 | $period = $timediff / ($versions + 1); |
||
157 | |||
158 | if ($period > 60 * 60 * 24 * 365) { // > 1 year |
||
159 | $page->ChangeFreq = 'yearly'; |
||
160 | } elseif ($period > 60 * 60 * 24 * 30) { // > ~1 month |
||
161 | $page->ChangeFreq = 'monthly'; |
||
162 | } elseif ($period > 60 * 60 * 24 * 7) { // > 1 week |
||
163 | $page->ChangeFreq = 'weekly'; |
||
164 | } elseif ($period > 60 * 60 * 24) { // > 1 day |
||
165 | $page->ChangeFreq = 'daily'; |
||
166 | } elseif ($period > 60 * 60) { // > 1 hour |
||
167 | $page->ChangeFreq = 'hourly'; |
||
168 | } else { // < 1 hour |
||
169 | $page->ChangeFreq = 'always'; |
||
170 | } |
||
171 | |||
172 | // do the generation of the file in a temporary location |
||
173 | $content = $page->renderWith('SitemapEntry'); |
||
174 | |||
175 | $fp = fopen($this->tempFile, "a"); |
||
0 ignored issues
–
show
The property
tempFile does not exist on object<Symbiote\QueuedJo...nerateGoogleSitemapJob> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
176 | if (!$fp) { |
||
177 | throw new Exception("Could not open $this->tempFile for writing"); |
||
0 ignored issues
–
show
The property
tempFile does not exist on object<Symbiote\QueuedJo...nerateGoogleSitemapJob> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
178 | } |
||
179 | fputs($fp, $content, strlen($content)); |
||
180 | fclose($fp); |
||
181 | } |
||
182 | } |
||
183 | |||
184 | // and now we store the new list of remaining children |
||
185 | $this->pagesToProcess = $remainingChildren; |
||
0 ignored issues
–
show
The property
pagesToProcess does not exist on object<Symbiote\QueuedJo...nerateGoogleSitemapJob> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
186 | $this->currentStep++; |
||
187 | |||
188 | if (!count($remainingChildren)) { |
||
189 | $this->completeJob(); |
||
190 | $this->isComplete = true; |
||
191 | return; |
||
192 | } |
||
193 | } |
||
194 | |||
195 | /** |
||
196 | * Outputs the completed file to the site's webroot |
||
197 | */ |
||
198 | protected function completeJob() |
||
199 | { |
||
200 | $content = '<?xml version="1.0" encoding="UTF-8"?>' . |
||
201 | '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; |
||
202 | $content .= file_get_contents($this->tempFile); |
||
0 ignored issues
–
show
The property
tempFile does not exist on object<Symbiote\QueuedJo...nerateGoogleSitemapJob> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
203 | $content .= '</urlset>'; |
||
204 | |||
205 | $sitemap = Director::baseFolder() . '/sitemap.xml'; |
||
206 | |||
207 | file_put_contents($sitemap, $content); |
||
208 | |||
209 | if (file_exists($this->tempFile)) { |
||
0 ignored issues
–
show
The property
tempFile does not exist on object<Symbiote\QueuedJo...nerateGoogleSitemapJob> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
210 | unlink($this->tempFile); |
||
0 ignored issues
–
show
The property
tempFile does not exist on object<Symbiote\QueuedJo...nerateGoogleSitemapJob> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
211 | } |
||
212 | |||
213 | $nextgeneration = Injector::inst()->create(GenerateGoogleSitemapJob::class); |
||
214 | QueuedJobService::singleton()->queueJob( |
||
215 | $nextgeneration, |
||
216 | DBDatetime::create()->setValue( |
||
217 | DBDatetime::now()->getTimestamp() + $this->config()->get('regenerate_time') |
||
218 | )->Rfc2822() |
||
219 | ); |
||
220 | } |
||
221 | } |
||
222 |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.