These are chat archives for phparsenal/phparsenal

5th
Jul 2015
Marcel Voigt
@nochso
Jul 05 2015 10:44
I've added the basics for storing/reading settings
@natedrake, you can open a pull request from your fork-master to our develop branch. If you mention "Fixes #15" in it and the PR gets merged, the issue will be closed
John O'Grady
@natedrake
Jul 05 2015 11:12
I think I done it right
Marcel Voigt
@nochso
Jul 05 2015 11:23
think so too. I'll test and merge it
Marcel Voigt
@nochso
Jul 05 2015 11:31
I merged it but the issue didn't get closed?!
maybe it has to be merged into master for the issue to close? I'm not sure
John O'Grady
@natedrake
Jul 05 2015 11:35
Will I close manually?
Marcel Voigt
@nochso
Jul 05 2015 11:37
maybe try merging into master
John O'Grady
@natedrake
Jul 05 2015 11:40
closed when I merged to master
Marcel Voigt
@nochso
Jul 05 2015 11:40
ah, ok
John O'Grady
@natedrake
Jul 05 2015 11:41
When you run a command does it display its hitcount correctly?
Marcel Voigt
@nochso
Jul 05 2015 11:58
oh yeah
John O'Grady
@natedrake
Jul 05 2015 12:00
I have a fix
Just synced with my fork
Marcel Voigt
@nochso
Jul 05 2015 12:00
it's ordinal not liking strings, right?
John O'Grady
@natedrake
Jul 05 2015 12:01
Ye, but the type is int in DB. Strange, just used intval to change to int
Marcel Voigt
@nochso
Jul 05 2015 12:01
I remember it working
John O'Grady
@natedrake
Jul 05 2015 12:01
Me too
anyway, better to fix it in function ordinal() instead. It should just cast to int itself
Marcel Voigt
@nochso
Jul 05 2015 12:22
oh I see, one PR merged into develop, another into master but they're not in sync
merge into develop was okay, but then we probably should have merged develop into master on there instead
now we need a merge between master and develop :question:
Marcel Voigt
@nochso
Jul 05 2015 13:18
everything is now merged into master
John O'Grady
@natedrake
Jul 05 2015 13:27
awesome
Gonna be offline for a while. I'll chat later
Marcel Voigt
@nochso
Jul 05 2015 13:54
see you
John O'Grady
@natedrake
Jul 05 2015 17:14
I've made a fix to the ordinal method in Client class, basically if you pass a string that only contains numbers, it will return the ordinal for that number, if you supply anything other than a number in the string it will return false
So ordinal won't complain about strings unless someone supplies a non-digit character in the string passed
Marcel Voigt
@nochso
Jul 05 2015 22:48
check out is_int() and ctype_digit()
if either one is true, you can be sure you have either an integer or a string made only of digits
Levi Durfee
@levidurfee
Jul 05 2015 23:00
That's almost 5 years old
Marcel Voigt
@nochso
Jul 05 2015 23:02
still true
Levi Durfee
@levidurfee
Jul 05 2015 23:04
weird
Marcel Voigt
@nochso
Jul 05 2015 23:04
it's because certain ints get parsed as single characters
Levi Durfee
@levidurfee
Jul 05 2015 23:09
never used it
Marcel Voigt
@nochso
Jul 05 2015 23:10
This message was deleted
This message was deleted
function ordinal($number)
{
    if (is_string($number) && ctype_digit($number)) {
        $number = (int) $number;
    }
    if (is_int($number)) {
        $ends = array('th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th');
        if ((($number % 100) >= 11) && (($number % 100) <= 13)) {
            return $number.'th';
        } else {
            return $number.$ends[$number % 10];
        }
    } else {
        return false;
    }
}
Levi Durfee
@levidurfee
Jul 05 2015 23:12
that seems like overkill
Marcel Voigt
@nochso
Jul 05 2015 23:13
well, it does make sure only integers will be used
Marcel Voigt
@nochso
Jul 05 2015 23:15
not compiled in for me
Levi Durfee
@levidurfee
Jul 05 2015 23:16
The input for the ordinal method isn't coming from the user, right?
$client->getCLI()->info("Running '" . $this->shortcut . "' for the " . $client->ordinal($this->hit_count) . " time.");
Marcel Voigt
@nochso
Jul 05 2015 23:17
for now, yes
we only touched it because SQLite returns strings and ordinal() wouldn't take that
Levi Durfee
@levidurfee
Jul 05 2015 23:20
if (is_int((int)$number)) {
I think that would be fine
Marcel Voigt
@nochso
Jul 05 2015 23:20
a simple $number = (int)$number and removing checking for is_int() would be fine
hah, yeah
you don't need is_int then. the casting should always work
Levi Durfee
@levidurfee
Jul 05 2015 23:38
works for me
Marcel Voigt
@nochso
Jul 05 2015 23:59
hah, making a test fail
Levi Durfee
@levidurfee
Jul 05 2015 23:59
locally?