« first day (1546 days earlier)      last day (3628 days later) » 

17:01
@bwoebi Your fix is right, I've added the stack->top assignment
@ircmaxell +1 for E_WARNING
http://thecodinglove.com/post/107606299193
The coding love
Friday, 5pm
kbironneau
1420822898
@PaulCrovella I'm torn down the middle, which is why I opened it for discussion
I'm back :) As I'm dealing with standalone ZF2 form, how do I instantiate the Zend PRG (no framework/controller involved)
$plugins = $v->getHelperPluginManager();
Zend docs say:
Example Usage

// Pass in the route/url you want to redirect to after the POST
$prg = $this->prg('/user/register', true);

if ($prg instanceof \Zend\Http\PhpEnvironment\Response) {
// returned a response to redirect us
return $prg;
} elseif ($prg === false) {
// this wasn't a POST request, but there were no params in the flash messenger
// probably this is the first time the form was loaded
return array('form' => $myForm);
}

// $prg is an array containing the POST params from the previous request
I suggest you to ask on #zftalk on IRC (freenode)
since this room is not ZF2-specific
17:12
Thanks
OH -- Q: Why do jihadists only drink instant coffee? A: They hate the French press. (/me waits to get blown up)
Cloud in fire !!! #datacenter RT @businessinsider An Amazon data center in Virginia is on fire http://read.bi/1w5H0wx http://t.co/2QDeEt4gBU
the internet is doomed!
I wonder whose day that most ruined
aparently it was under construction
17:39
looks better than the bitcoin mining farm in Hong Kong at least...
PHP Hampshire folks - even if you are an inexperienced speaker, please submit a talk to @phpsouthcoast conference https://cfp.phpsouthcoast.co.uk/
@JoeWatkins did you submit yet?
@DaveRandom Did you?
Hello everyone
I didn't know they wanted speakers
17:44
@Jimbo I don't know what I'd submit, also probably don't have time to prepare anything
@Jimbo The conversation I had with u 1 week ago about depency injection was very helpful. I have learnt a lot :)
@DaveRandom I'll hopefully submit on sunday
I want to submit, but July isn't something I can commit to
@AndreaFaulds Does the php spec have a concept of a non-normative note and if so, how is it delimited?
I have a noob question but i'm new with PHP. Is it possible to do something like this: $callback = new Callback(){ @override function myListener(){some stuff} }
17:51
@Ocramius awesome! anything in mind?
@DaveRandom something about nazi-coding or such
we'll see
I have something like 20 abstracts lying around
@ircmaxell Struggling to resist the urge to say something along the lines of "July usually happens to me regardless of whether I committed to it" :-P
This method may be called statically, but will issue an E_STRICT error; this is really annoying, and we should have a dedicated static factory method.
@DaveRandom /s/no/yes/
17:52
@DanLugg better solution: don't call it statically
@Ocramius Ummm... what? Code that has a tendency to invade Poland or something?
@ircmaxell Eh, syntactically, $doc = Doc::createFromString($string) reads fine.
still, just don't call it statically and you're fine :-P
lol, I know.
@korima which would do what, sorry?
@DanLugg better solution: load() always returns the instance on success
17:55
@DaveRandom I usually target my projects to use cases following Clean Architecture Uncle Bob and for them, I register callbacks to catch events
@DaveRandom When called off an instance?
$doc = $doc->load() ...?
@DanLugg $doc = (new DOMDocument)->load();
@DaveRandom no, but I can invade your country depending on your code.
And I haz panzers.
@DaveRandom Eh, true.
$docLoader = new DocLoader();
$doc = $docLoader->load($input);
@DaveRandom For example, in Android, if I have a use case to getMovies, this use case has a callback with 2 events: onGetMovies(), and onError().
17:57
@DanLugg You forgot the DocLoaderFactory
Then I can do differents things on my view. Now, I want to do the same on PHP and I don't know if this language support it
@DaveRandom DocLoaderFactoryBuilder
@RonniSkansing, you are a monster
@korima Your question doesn't seem intelligible to me....it might be clearer if you say what you're trying to do....
@DaveRandom that
@DanLugg not that
17:58
@korima Glad it helped :-)
@Danack Ok, sorry. My english is not very good. :( Well. I will try to explain better.
@korima PHP doesn't have "events" in that sense, generally what you'd do would be to have an interface and a class. PHP does have anonymous functions though, $func = function() { /* code here */ };
@JoeWatkins awesomesauce :-)
@DaveRandom Ummm, that is what I asked, thanks!
@ircmaxell That said, is there actually any gain with built-in stuff?
You're tightly coupled either way, and you don't need to test DOMDocument because it's built in, in userland anyway
$docLoaderFactory = (new DocLoaderFactoryBuilder())
    ->setConfig($config)
    ->setMoreConfig($moreConfig)
    ->setEvenMoreConfig($evenMoreConfig)
    ->build();
$docLoader = $docLoaderFactory->create($someOptions, $someFlags)
$doc = $docLoader->load($someInput);
ALL I WANNA DO IS LOAD AN XML FILE
18:03
/me hides
@DaveRandom I'm not worried about needing to pass around instances as dependencies
I'm more just thinking that if it ain't broke, don't fix it. And it currently doesn't seem broken since most people actually just understand how to work with it
That's fair
: Docs, Backlog | Tools: Explain, phpdbg, devdocs.io | Addons: [cv-pls], PHP Manual Linkifier | Snippets: ext/mysql | Reference: QAs
6
@DaveRandom I will find you. I will find you and I will hurt you.
Hey guys
When I load content from a website and that website is redirecting to another link in the same origin (not to another site) and I use curl or anything else, it will take up to 50 secs or more to load, or even fail didnt see the final result. But when I do on my other webserver, xampp one it works. If I directly access the link it also works instantly.
What can be wrong?
@ircmaxell It definitely isn't broke. But it is a bit derpy IMO.
@ircmaxell Also, not serious, was segueing into the DocLoaderFactoryBuilderWrapperFacade
user924016
18:17
@Charles =] happy friday
@RonniSkansing "Happy" indeed.
Does curl use file writing or anything when its following redirects?
@oligriffiths It's hard to claim "fundamental misunderstanding" of, e.g., "kill them wherever you find them" http://www.usc.edu/org/cmje/religious-texts/quran/verses/002-qmt.php#002.191
this is a crazy conversation ...
@DanLugg I know :-P
@JoeWatkins I don't pay attention to Paul
it's easy to misunderstand, if you want to misunderstand something ...
lots do, and taylor
18:22
/me blocks taylor
yeah extremely inappropriate ....
actually, I'm down to blocking only two "sizable" names: Taylor and Brandon
Are you naming babies or software?
Has php.net deliberate lost some mirrors e.g. de3.php.net/manual/en/function.mime-content-type.php ?
@AndreaFaulds babies
18:35
I have shopping cart that I created by myself, how to solve the problem of the cached shopping cart? I mean when I go a page of a product and I added it to the cart, and go back using the browser button, the added product is not on the cart. I have to refresh the page to see it on the cart.
@ircmaxell Rasmus, after our God?
/me blocks @AndreaFaulds
@ircmaxell It's a unique name, though!
not really
@ziiweb I'd suggest reading the code of other shopping cart libraries, and see how they do it.
18:45
@ziiweb There's not necessarily anything you can do about that
@AndreaFaulds sure there is. Use JS
@ircmaxell won't help.
@NikiC I don't think it does. It probably should.
@ircmaxell OK, you defeat the cache, but only if the browser goes to cache
18:49
It won't always. It'll just restore the previous page as it was sometimes.
the HTML yes
but the JS will still restart
Though it might be only Presto that did that, I think Firefox/Chrome/Safari may just be going to cache but restoring the input fields and scroll position
19:07
We’re all brave until we realize the cockroach has wings.
@ircmaxell You're totally right, the code formatting is horrible!
It seems to me that everyone is doing the function_exists check backwards; if my_function is already defined, and your library loads sanely, then it's probably a conflict and should bail out.
are those tabs! mine eyes
if (function_exists('my_function')) throw new AlreadyDefinedException('my_function');
19:12
 if(function_exists(...)) throw new Exception("You idiot, stop including this file twice.");
3
^^ That works equally well
@DanLugg unless you're designing it to be extensible so you can override a core implementation
which is dumb, but not that dumb
Well... subjective is subjective. I'd err on the side of "that dumb"
Morning room 11ers
Mornin'
19:17
Mornin'
github.com/letsdrink/ouzo-goodies - utility classes, test assertions and mocking framework
"utility classes"
"goodies"
public static function constant($value)
{
    return function () use ($value) {
        return $value;
    };
}
huh?
public static function trim()
{
    return function ($string) {
        return trim($string);
    };
}
Not sure what I am looking at?
19:24
@PeeHaa Useful as a callback?
@AndreaFaulds In what context is that useful? @PiotrOlaszewski
static factories for functions
@PeeHaa Very limited ones
I think I am missing something here :P
you can use them with Arrays
e.g.
19:26
@AndreaFaulds ah tnx :-)
Arrays::map($names, Functions::trim());
@woru Bad example is bad ;P
or $bobs = Arrays::filter($names, Functions::startsWith("Bob"))
Why is bad?
@PeeHaa ?
@woru No. Bad. Wrong. array_filter. array_map. They are builtins. Stop wrapping them needlessly.
19:27
@PiotrOlaszewski I did not say something was bad (besides @woru's example)
Basically because of what @Charles just said
and as you know
they have inconsistent interfaces
AHAHAHA ONE TAKES HAYSTACK, NEEDLE, ONE TAKES NEEDLE, HAYSTACK.
I HATE PHP
you never know what comes first
Goddamn seriously this language.
I know
19:28
Nevermind. Wrap away and unleash the assassins.
hehe
@Charles NEITHER TAKE NEEDLE NOR HAYSTACK!
@salathe Shush.
I prefer wrapping to consulting docs every time I want to use them
@woru Get a better IDE?
19:29
s/a better/any
I use the best IDE :P
@woru So instead everybody has to look into your code instead of the manual?
phpsorm
phpstorm properly hints argument order, what's the problem? I mean, other than the order being wrong sometimes.
php sucks
we already established that
this is a library
that tries to make php better
19:31
and fails
fix its inconsistencies
this is your opinion
mine is different :)
Possibly related, I was wondering why this tweet blew up:
Prediction for 10 years "Looking for Javascript developer to maintain legacy project depending on 36000 unmaintained NPM modules"
haha
@PiotrOlaszewski what is the goal of the library?
We have written some utils
I honestly had no idea, that this was a thing.
That are provided for java
@PeeHaa make php better, make mocking easier
in guava library
and other java libraries
when I started programming in php
19:33
@PiotrOlaszewski What is currently hard at mocking?
@PiotrOlaszewski Mocking, in the sense of pointing and laughing at?
there was something missing
Mockery is one big miss understainding
for mocking
when you write tests
PHPUnit mocks suck too
19:34
Why?
in BDD style
you want to have assertions at the end
in Mockery
Why does mocking in phpunit suck in specific?
you have to specify expectations first
test are messy that way
huh?
it's easier to read tests
19:35
I may have been drinking too much already, but I have no idea what's going on in the last 5 minutes of chat, above. o.O
when there's
@salathe Me neither tbh :P
//given //when //then
section
with clear responsibilities
Different words same syntax :|
@PeeHaa Well, because PHPunit sucks.....
19:36
@PeeHaa Likewise, but I blame mine on cough syrup
$mock = Mock::create();
Mock::when($mock)->method(1)->thenReturn('result');

$result = $mock->method(1);

$this->assertEquals("result", $result);
ok this is not a good example
Yes I see that, but that's the same as phpunit?
Seriously, the function call for setting up mocks is awful....Mockery is better saner.
w8
//given
$mock = Mock::create();

//when
$mock->method("arg");

//then
Mock::verify($mock)->method("arg");
19:37
you can see preconditions in given
@DanLugg U WOT M8?
tested behaviour in //when
@Danack I'LL CUFF YOU IN THE GOB I WILL
and assertions in //then section of a test
Don't worry about Reflection support; it will come. @Danack @AndreaFaulds
19:38
Sorry I give up. Clearly I fail to see the genius in all of this :)
cool.
@LeviMorrison I'm not the one who needs convincing :p
I don't think PhpUnit was designed with Given-When-Then in mind.
19:41
why not
you can always
write //given when then
@PeeHaa you are obviously deficient. I will wrap you in a static method to help.
4
comments
Last thing I will say about it. I think you people are "abstracting" the wrong things with all those utility things
to group you test case
*your
@PaulCrovella Statics are bad. You should make a PeeHaaFactory so that it can be instantiated.
2
yeah statics are bad, Gluten is bad
If you
don't write on
a single line you may
just
look dumb.
alcohol is bad (if you've seen southpark)
@Danack It just makes you look horrible at haiku.
@woru Nah, I avoid alcohol regardless
19:46
I mean serious:
$media = Arrays::first($elements);
@AndreaFaulds too scared to shout your root password?
$media = Arrays::firstOrNull($elements);
@FlorianMargaine ...something like that.
it's certainly better than
isset(...) ? ; ;
$media = $elements->first(); // surely better.
19:47
^
yes
i agree
No it is not. You are wrapping native php code in static functions and that's about it
@woru Or: $elements[0] ?? null
unles you have a bare array
$media = $elements->first() ?? null;
19:48
you would get a warning
haha @AndreaFaulds :D
@FlorianMargaine redundant, that only works if it already returns null
@woru not with php7
ouzo-goodies aims > 5.3
19:49
I'll try other example
I thing is cool
public static function getValue(array $elements, $key, $default = null)
{
    return isset($elements[$key]) ? $elements[$key] : $default;
}
>= 5.3
5.3... the EOL version?
19:50
I mean, 5.3, the version that doesn't get any security update?
So instead of that single line you now need four lines to do the same thing
I said 5.3+
coz somebody here uses php7
good for him
@PeeHaa Or: $arr[$elem] ?? $default
but I'm not so lucky
@AndreaFaulds Or that even
19:51
@woru so? Why don't you use 5.4 features?
@AndreaFaulds Am confused, if null default to null?
null ?? null ?? null // any one will do
@LeviMorrison Yes, because ?? is binary
@AndreaFaulds ... so you just want to suppress/avoid the warning?
19:53
There's no $foo?? form
@LeviMorrison Yes.
y u no propose unary form?? ^^
(totally kidding, in case it was not evident)
@DanLugg No.
one more example and I'm out of here
19:55
?>
^^ lol
Let’s assume that you have a User class that has a list of addresses. Each address has a type (like: home, invoice etc.) and User has getAddress($type) method.
$cities = Arrays::map($users, Functions::extract()->getAddress('home')->city);
$i?->like?->nullsafe?->deref
can you do that with php5.<what ever>?
Yes it's called a loop
19:56
i mean in one line
loops are bad
lol
:P
@woru array_column
19:56
^^
^^ also bad :-)
will array_column wirk with functions?
and bind arguments?
Lets put it this way. @woru @PiotrOlaszewski I say this not to put you people or your project down, but that thing is pretty much useless. You are trying to fix a problem that is nonexistent.
On the up side I really love your github org name
nonexistent for you
I'm fine with that
I will not argue with this :P
@PeeHaa not very professional though

« first day (1546 days earlier)      last day (3628 days later) »