Code Duplication    Length = 24-24 lines in 2 locations

class/utility.php 1 location

@@ 312-335 (lines=24) @@
309
     * @param $author
310
     * @return string
311
     */
312
    public static function getAuthorName($author)
313
    {
314
        $ret = '';
315
        //get author
316
        $_authoruserHandler = xoops_getHandler('user');
317
        $_authoruser        = $_authoruserHandler->get($author);
318
        if (!is_object($_authoruser)) {
319
            $name3      = '';
320
            $uname3     = '';
321
            $authorname = '';
322
        } else {
323
            $name3      = $_authoruser->getVar('name');
324
            $uname3     = $_authoruser->getVar('uname');
325
            $authorname = $name3;
326
        }
327
        //-------------------------------------
328
        $ret = $authorname;
329
        if (empty($authorname) || $authorname === '') {
330
            $ret = $uname3;
331
        }
332
333
        return $ret;
334
        //-------------------------------------
335
    }
336
337
    /**
338
     * @param int $showCreate

include/functions.php 1 location

@@ 197-220 (lines=24) @@
194
 * @param $author
195
 * @return string
196
 */
197
function getAuthorName($author)
198
{
199
    $ret = '';
200
    //get author
201
    $_authoruserHandler = xoops_getHandler('user');
202
    $_authoruser        = $_authoruserHandler->get($author);
203
    if (!is_object($_authoruser)) {
204
        $name3      = '';
205
        $uname3     = '';
206
        $authorname = '';
207
    } else {
208
        $name3      = $_authoruser->getVar('name');
209
        $uname3     = $_authoruser->getVar('uname');
210
        $authorname = $name3;
211
    }
212
    //-------------------------------------
213
    $ret = $authorname;
214
    if (empty($authorname) || $authorname === '') {
215
        $ret = $uname3;
216
    }
217
218
    return $ret;
219
    //-------------------------------------
220
}
221
222
/**
223
 * @param int $showCreate