[Phpmyadmin-devel] Refactoring: Displaying query results

Dieter Adriaenssens dieter.adriaenssens at gmail.com
Sun Jun 10 19:51:10 CEST 2012


2012/6/9 Chanaka Dharmarathna <pe.chanaka.ck at gmail.com>:
>
>
> On Fri, Jun 8, 2012 at 10:58 AM, Chanaka Dharmarathna
> <pe.chanaka.ck at gmail.com> wrote:
>>
>> Hi All,
>>
>> I have a doubt of using @see tag in Docblock comments for functions.
>> In the comments of functions PMA_getTable() and PMA_getTableBody() in
>> display_tbl.lib.php file, @see tag is used for different purposes.
>> As I feel PMA_getTableBody() used that corrrectly.
>> What should be the actual behavior ?
>>
>> Regards !
>> --
>> ____________________________________
>>
>> Chanaka Indrajith
>> Bsc.Computer Engineering Undergraduate
>> Faculty of Engineering
>> University of Peradeniya
>> Sri Lanka
>> ____________________________________
>>
>
> Hi All,
>
> I am fixing some code violations in my code now.
> For remove code violation of large comparison in a if condition, what would
> be the better approach ?
>
> Ex:-
> if ((PMA_strlen($wkbval) > $GLOBALS['cfg']['LimitChars'])
>     && ($_SESSION['tmp_user_values']['display_text'] ==
> self::DISPLAY_PARTIAL_TEXT)
> ) {
> // code
> }
>
> Is that good to use tempory variable insted of using
> $_SESSION['tmp_user_values']['display_text'] ?

It depends :

If the value of $_SESSION['tmp_user_values']['display_text'] is used
later on in the code, you could assign it to a shorter local
(temporary) variable, and use that variable with a shorter name, in
the if statement and further on in the code.

If it is used only oncet you might consider assigning the result of

$_SESSION['tmp_user_values']['display_text'] == self::DISPLAY_PARTIAL_TEXT

to a local (temporary) variable and use that variable in the if statement.

Hope this helps!

-- 
Kind regards,

Dieter Adriaenssens




More information about the Developers mailing list