PrivateBin\Data\Database::readComments PHP Метод

readComments() публичный Метод

Read all comments of paste.
public readComments ( string $pasteid ) : array
$pasteid string
Результат array
    public function readComments($pasteid)
    {
        $rows = self::_select('SELECT * FROM ' . self::_sanitizeIdentifier('comment') . ' WHERE pasteid = ?', array($pasteid));
        // create comment list
        $comments = array();
        if (count($rows)) {
            foreach ($rows as $row) {
                $i = $this->getOpenSlot($comments, (int) $row['postdate']);
                $comments[$i] = new stdClass();
                $comments[$i]->id = $row['dataid'];
                $comments[$i]->parentid = $row['parentid'];
                $comments[$i]->data = $row['data'];
                $comments[$i]->meta = new stdClass();
                $comments[$i]->meta->postdate = (int) $row['postdate'];
                if (array_key_exists('nickname', $row) && !empty($row['nickname'])) {
                    $comments[$i]->meta->nickname = $row['nickname'];
                }
                if (array_key_exists('vizhash', $row) && !empty($row['vizhash'])) {
                    $comments[$i]->meta->vizhash = $row['vizhash'];
                }
            }
            ksort($comments);
        }
        return $comments;
    }