Completed
Push — master ( 6452b0...d576ea )
by Michael
05:58 queued 03:02
created

MyXoopsStory::setTopicalign()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 28 and the first side effect is on line 22.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * XOOPS news story
4
 *
5
 * You may not change or alter any portion of this comment or credits
6
 * of supporting developers from this source code or any supporting source code
7
 * which is considered copyrighted (c) material of the original comment or credit authors.
8
 * This program is distributed in the hope that it will be useful,
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * @copyright       XOOPS Project (http://xoops.org)
13
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
14
 * @package         kernel
15
 * @since           2.0.0
16
 * @author          Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, http://jp.xoops.org/
17
 * @deprecated
18
 */
19
20
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
21
//$GLOBALS['xoopsLogger']->addDeprecated("'/class/xoopsstory.php' is deprecated since XOOPS 2.5.4, please create your own class instead.");
22
include_once XOOPS_ROOT_PATH . '/modules/news/class/xoopstopic.php';
23
include_once XOOPS_ROOT_PATH . '/kernel/user.php';
24
25
/**
26
 * Class MyXoopsStory
27
 */
28
class MyXoopsStory
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
29
{
30
    public $table;
31
    public $storyid;
32
    public $topicid;
33
    public $uid;
34
    public $title;
35
    public $hometext;
36
    public $bodytext  = '';
37
    public $counter;
38
    public $created;
39
    public $published;
40
    public $expired;
41
    public $hostname;
42
    public $nohtml    = 0;
43
    public $nosmiley  = 0;
44
    public $ihome     = 0;
45
    public $notifypub = 0;
46
    public $type;
47
    public $approved;
48
    public $topicdisplay;
49
    public $topicalign;
50
    public $db;
51
    public $topicstable;
52
    public $comments;
53
54
    /**
55
     * @param $storyid
56
     */
57
    public function Story($storyid = -1)
58
    {
59
        $this->db          = XoopsDatabaseFactory::getDatabaseConnection();
60
        $this->table       = '';
61
        $this->topicstable = '';
62 View Code Duplication
        if (is_array($storyid)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
63
            $this->makeStory($storyid);
64
        } elseif ($storyid != -1) {
65
            $this->getStory((int)$storyid);
66
        }
67
    }
68
69
    /**
70
     * @param $value
71
     */
72
    public function setStoryId($value)
73
    {
74
        $this->storyid = (int)$value;
75
    }
76
77
    /**
78
     * @param $value
79
     */
80
    public function setTopicId($value)
81
    {
82
        $this->topicid = (int)$value;
83
    }
84
85
    /**
86
     * @param $value
87
     */
88
    public function setUid($value)
89
    {
90
        $this->uid = (int)$value;
91
    }
92
93
    /**
94
     * @param $value
95
     */
96
    public function setTitle($value)
97
    {
98
        $this->title = $value;
99
    }
100
101
    /**
102
     * @param $value
103
     */
104
    public function setHometext($value)
105
    {
106
        $this->hometext = $value;
107
    }
108
109
    /**
110
     * @param $value
111
     */
112
    public function setBodytext($value)
113
    {
114
        $this->bodytext = $value;
115
    }
116
117
    /**
118
     * @param $value
119
     */
120
    public function setPublished($value)
121
    {
122
        $this->published = (int)$value;
123
    }
124
125
    /**
126
     * @param $value
127
     */
128
    public function setExpired($value)
129
    {
130
        $this->expired = (int)$value;
131
    }
132
133
    /**
134
     * @param $value
135
     */
136
    public function setHostname($value)
137
    {
138
        $this->hostname = $value;
139
    }
140
141
    /**
142
     * @param int $value
143
     */
144
    public function setNohtml($value = 0)
145
    {
146
        $this->nohtml = $value;
147
    }
148
149
    /**
150
     * @param int $value
151
     */
152
    public function setNosmiley($value = 0)
153
    {
154
        $this->nosmiley = $value;
155
    }
156
157
    /**
158
     * @param $value
159
     */
160
    public function setIhome($value)
161
    {
162
        $this->ihome = $value;
163
    }
164
165
    /**
166
     * @param $value
167
     */
168
    public function setNotifyPub($value)
169
    {
170
        $this->notifypub = $value;
171
    }
172
173
    /**
174
     * @param $value
175
     */
176
    public function setType($value)
177
    {
178
        $this->type = $value;
179
    }
180
181
    /**
182
     * @param $value
183
     */
184
    public function setApproved($value)
185
    {
186
        $this->approved = (int)$value;
187
    }
188
189
    /**
190
     * @param $value
191
     */
192
    public function setTopicdisplay($value)
193
    {
194
        $this->topicdisplay = $value;
195
    }
196
197
    /**
198
     * @param $value
199
     */
200
    public function setTopicalign($value)
201
    {
202
        $this->topicalign = $value;
203
    }
204
205
    /**
206
     * @param $value
207
     */
208
    public function setComments($value)
209
    {
210
        $this->comments = (int)$value;
211
    }
212
213
    /**
214
     * @param bool $approved
215
     *
216
     * @return bool
217
     */
218
    public function store($approved = false)
0 ignored issues
show
Unused Code introduced by
The parameter $approved is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
219
    {
220
        //$newpost = 0;
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
221
        $myts     = MyTextSanitizer::getInstance();
222
        $title    = $myts->censorString($this->title);
223
        $hometext = $myts->censorString($this->hometext);
224
        $bodytext = $myts->censorString($this->bodytext);
225
        $title    = $myts->addSlashes($title);
226
        $hometext = $myts->addSlashes($hometext);
227
        $bodytext = $myts->addSlashes($bodytext);
228
        if (!isset($this->nohtml) || $this->nohtml != 1) {
229
            $this->nohtml = 0;
230
        }
231
        if (!isset($this->nosmiley) || $this->nosmiley != 1) {
232
            $this->nosmiley = 0;
233
        }
234
        if (!isset($this->notifypub) || $this->notifypub != 1) {
235
            $this->notifypub = 0;
236
        }
237
        if (!isset($this->topicdisplay) || $this->topicdisplay != 0) {
238
            $this->topicdisplay = 1;
239
        }
240
        $expired = !empty($this->expired) ? $this->expired : 0;
241
        if (!isset($this->storyid)) {
242
            //$newpost = 1;
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
243
            $newstoryid = $this->db->genId($this->table . '_storyid_seq');
244
            $created    = time();
245
            $published  = $this->approved ? $this->published : 0;
246
247
            $sql = sprintf("INSERT INTO %s (storyid, uid, title, created, published, expired, hostname, nohtml, nosmiley, hometext, bodytext, counter, topicid, ihome, notifypub, story_type, topicdisplay, topicalign, comments) VALUES (%u, %u, '%s', %u, %u, %u, '%s', %u, %u, '%s', '%s', %u, %u, %u, %u, '%s', %u, '%s', %u)", $this->table, $newstoryid, $this->uid, $title, $created, $published, $expired, $this->hostname, $this->nohtml, $this->nosmiley, $hometext, $bodytext, 0, $this->topicid, $this->ihome, $this->notifypub, $this->type, $this->topicdisplay, $this->topicalign, $this->comments);
248
        } else {
249
            if ($this->approved) {
250
                $sql = sprintf("UPDATE %s SET title = '%s', published = %u, expired = %u, nohtml = %u, nosmiley = %u, hometext = '%s', bodytext = '%s', topicid = %u, ihome = %u, topicdisplay = %u, topicalign = '%s', comments = %u WHERE storyid = %u", $this->table, $title, $this->published, $expired, $this->nohtml, $this->nosmiley, $hometext, $bodytext, $this->topicid, $this->ihome, $this->topicdisplay, $this->topicalign, $this->comments, $this->storyid);
251
            } else {
252
                $sql = sprintf("UPDATE %s SET title = '%s', expired = %u, nohtml = %u, nosmiley = %u, hometext = '%s', bodytext = '%s', topicid = %u, ihome = %u, topicdisplay = %u, topicalign = '%s', comments = %u WHERE storyid = %u", $this->table, $title, $expired, $this->nohtml, $this->nosmiley, $hometext, $bodytext, $this->topicid, $this->ihome, $this->topicdisplay, $this->topicalign, $this->comments, $this->storyid);
253
            }
254
            $newstoryid = $this->storyid;
255
        }
256
        if (!$result = $this->db->query($sql)) {
257
            return false;
258
        }
259
        if (empty($newstoryid)) {
260
            $newstoryid    = $this->db->getInsertId();
261
            $this->storyid = $newstoryid;
262
        }
263
264
        return $newstoryid;
265
    }
266
267
    /**
268
     * @param $storyid
269
     */
270 View Code Duplication
    public function getStory($storyid)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
271
    {
272
        $storyid = (int)$storyid;
273
        $sql     = 'SELECT * FROM ' . $this->table . ' WHERE storyid=' . $storyid . '';
274
        $array   = $this->db->fetchArray($this->db->query($sql));
275
        $this->makeStory($array);
276
    }
277
278
    /**
279
     * @param $array
280
     */
281
    public function makeStory($array)
282
    {
283
        foreach ($array as $key => $value) {
284
            $this->$key = $value;
285
        }
286
    }
287
288
    /**
289
     * @return bool
290
     */
291 View Code Duplication
    public function delete()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
292
    {
293
        $sql = sprintf('DELETE FROM %s WHERE storyid = %u', $this->table, $this->storyid);
294
        if (!$result = $this->db->query($sql)) {
295
            return false;
296
        }
297
298
        return true;
299
    }
300
301
    /**
302
     * @return bool
303
     */
304 View Code Duplication
    public function updateCounter()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
305
    {
306
        $sql = sprintf('UPDATE %s SET counter = counter+1 WHERE storyid = %u', $this->table, $this->storyid);
307
        if (!$result = $this->db->queryF($sql)) {
308
            return false;
309
        }
310
311
        return true;
312
    }
313
314
    /**
315
     * @param $total
316
     *
317
     * @return bool
318
     */
319 View Code Duplication
    public function updateComments($total)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
320
    {
321
        $sql = sprintf('UPDATE %s SET comments = %u WHERE storyid = %u', $this->table, $total, $this->storyid);
322
        if (!$result = $this->db->queryF($sql)) {
323
            return false;
324
        }
325
326
        return true;
327
    }
328
329
    public function topicid()
330
    {
331
        return $this->topicid;
332
    }
333
334
    /**
335
     * @return MyXoopsTopic
336
     */
337
    public function topic()
338
    {
339
        return new MyXoopsTopic($this->topicstable, $this->topicid);
340
    }
341
342
    public function uid()
343
    {
344
        return $this->uid;
345
    }
346
347
    /**
348
     * @return string
349
     */
350
    public function uname()
351
    {
352
        return XoopsUser::getUnameFromId($this->uid);
353
    }
354
355
    /**
356
     * @param string $format
357
     *
358
     * @return mixed
359
     */
360 View Code Duplication
    public function title($format = 'Show')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
361
    {
362
        $myts   = MyTextSanitizer::getInstance();
363
        $smiley = 1;
0 ignored issues
show
Unused Code introduced by
$smiley is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
364
        if ($this->nosmiley()) {
365
            $smiley = 0;
0 ignored issues
show
Unused Code introduced by
$smiley is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
366
        }
367
        switch ($format) {
368
            case 'Show':
369
            case 'Edit':
370
                $title = $myts->htmlSpecialChars($this->title);
371
                break;
372
            case 'Preview':
373
            case 'InForm':
374
                $title = $myts->htmlSpecialChars($myts->stripSlashesGPC($this->title));
375
                break;
376
        }
377
378
        return $title;
0 ignored issues
show
Bug introduced by
The variable $title does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
379
    }
380
381
    /**
382
     * @param string $format
383
     *
384
     * @return string
385
     */
386 View Code Duplication
    public function hometext($format = 'Show')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
387
    {
388
        $myts   = MyTextSanitizer::getInstance();
389
        $html   = 1;
390
        $smiley = 1;
391
        $xcodes = 1;
392
        if ($this->nohtml()) {
393
            $html = 0;
394
        }
395
        if ($this->nosmiley()) {
396
            $smiley = 0;
397
        }
398
        switch ($format) {
399
            case 'Show':
400
                $hometext = $myts->displayTarea($this->hometext, $html, $smiley, $xcodes);
401
                break;
402
            case 'Edit':
403
                $hometext = htmlspecialchars($this->hometext, ENT_QUOTES);
404
                break;
405
            case 'Preview':
406
                $hometext = $myts->previewTarea($this->hometext, $html, $smiley, $xcodes);
407
                break;
408
            case 'InForm':
409
                $hometext = htmlspecialchars($myts->stripSlashesGPC($this->hometext), ENT_QUOTES);
410
                break;
411
        }
412
413
        return $hometext;
0 ignored issues
show
Bug introduced by
The variable $hometext does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
414
    }
415
416
    /**
417
     * @param string $format
418
     *
419
     * @return string
420
     */
421 View Code Duplication
    public function bodytext($format = 'Show')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
422
    {
423
        $myts   = MyTextSanitizer::getInstance();
424
        $html   = 1;
425
        $smiley = 1;
426
        $xcodes = 1;
427
        if ($this->nohtml()) {
428
            $html = 0;
429
        }
430
        if ($this->nosmiley()) {
431
            $smiley = 0;
432
        }
433
        switch ($format) {
434
            case 'Show':
435
                $bodytext = $myts->displayTarea($this->bodytext, $html, $smiley, $xcodes);
436
                break;
437
            case 'Edit':
438
                $bodytext = htmlspecialchars($this->bodytext, ENT_QUOTES);
439
                break;
440
            case 'Preview':
441
                $bodytext = $myts->previewTarea($this->bodytext, $html, $smiley, $xcodes);
442
                break;
443
            case 'InForm':
444
                $bodytext = htmlspecialchars($myts->stripSlashesGPC($this->bodytext), ENT_QUOTES);
445
                break;
446
        }
447
448
        return $bodytext;
0 ignored issues
show
Bug introduced by
The variable $bodytext does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
449
    }
450
451
    public function counter()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
452
    {
453
        return $this->counter;
454
    }
455
456
    public function created()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
457
    {
458
        return $this->created;
459
    }
460
461
    public function published()
462
    {
463
        return $this->published;
464
    }
465
466
    public function expired()
467
    {
468
        return $this->expired;
469
    }
470
471
    public function hostname()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
472
    {
473
        return $this->hostname;
474
    }
475
476
    public function storyid()
477
    {
478
        return $this->storyid;
479
    }
480
481
    /**
482
     * @return int
483
     */
484
    public function nohtml()
485
    {
486
        return $this->nohtml;
487
    }
488
489
    /**
490
     * @return int
491
     */
492
    public function nosmiley()
493
    {
494
        return $this->nosmiley;
495
    }
496
497
    /**
498
     * @return int
499
     */
500
    public function notifypub()
501
    {
502
        return $this->notifypub;
503
    }
504
505
    public function type()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
506
    {
507
        return $this->type;
508
    }
509
510
    /**
511
     * @return int
512
     */
513
    public function ihome()
514
    {
515
        return $this->ihome;
516
    }
517
518
    public function topicdisplay()
519
    {
520
        return $this->topicdisplay;
521
    }
522
523
    /**
524
     * @param bool $astext
525
     *
526
     * @return string
527
     */
528
    public function topicalign($astext = true)
529
    {
530
        if ($astext) {
531
            if ($this->topicalign === 'R') {
532
                $ret = 'right';
533
            } else {
534
                $ret = 'left';
535
            }
536
537
            return $ret;
538
        }
539
540
        return $this->topicalign;
541
    }
542
543
    public function comments()
544
    {
545
        return $this->comments;
546
    }
547
}
548