« first day (2659 days earlier)      last day (2273 days later) » 

4:01 PM
@pmmaga ahh, right, yeh that's a bit weird but I remember looking at it once
 
it sounds like something that could be used for session tickets, but i guess it's not so I'm trying to understand it :)
 
!!man SSL_copy_session_id
 
[ SSL_ ] #include < openssl/ssl.h > void SSL _ copy _ session _ id ( SSL *to , const SSL *from );
 
mother fucker
 
4:05 PM
umm... I'm sorry?
 
well, technically, she's not wrong
 
:-P
@pmmaga yeh it looks like it to me
 
Should you really inject the repository into a service? If the service does a unit of work, but then also persists to the DB for example, it's possible you may not be able to reuse that service somewhere else because you need to perform that unit of work and then another before persisting.
 
@DaveRandom as far as I understand it, it would be fine for local ssl sessions but I don't think you could achieve distributed session tickets with it, you need to hold the previous session (somehow, somewhere) so the SESSION, METHOD and CERT are copied from the previous to the new one.
 
4:20 PM
@pmmaga how would you share that data?
specifically, how would you share that data in a manner than is more efficient than just creating a new session?
If you do want to make that work somehow, it will need to be implemented as a stream context callback I think
but I feel like it's probably not worth it tbh...
 
@DaveRandom apparently via the last param of the enable_crypto function. or am I missing the point of your question?
@DaveRandom well, being able to use the abbreviated handshake saves at least 1 roundtrip :)
 
@pmmaga well by "distributed" I assume you mean "across machines"
 
no, I killed our website the way I created the project in phpstorm
I fucked something up seriously
but we're switched to the backup web server, so it's peachy for now. server admin is going to restore a backup.
 
@DaveRandom ah yes, in the case of the tickets, the client will hold your info for you and send it back on the next request. if the second server is able to decrypt that ticket, it will consider the client as a known one and won't need to renegotiate
 
@Tiffany wait, you were opening the project... on the live server?
 
4:26 PM
yes... it's not something I use often, but the code situation I'm in, I needed it
most of the time it's closed, and I only have phpstorm loading the dev project
 
you need to sort your workflows out as a matter of high priority
 
that is a ticking time bomb
@pmmaga so you'd put the session data in... redis or something I suppose?
afaik there is currently no way to retrieve the data you would need to store from an existing stream, so if you want to make that work you will need to add that first
 
@DaveRandom i guess something like that could work, yes
 
then I would suggest adding a stream context option which is a callback, invoked before negotiation, which will return the data in a usable format so that you can pass it to openssl underneath (I guess an array with those 3 bits of info in)
for client-mode streams you can just add a context option where you set the ticket info on stream creation I suppose
seems like a lot of hassle for not a lot of gain though tbh...
 
4:32 PM
yep, something like a potential stream_socket_resume_crypto could do something like that
 
please no, not more functions :-P
 
:D
I don't feel confident enough in this area to try something like that tbh
but it would be an interesting exercise :)
 
as much as I am not a huge fan of the ball of impenetrable state that is the stream context, i would prefer putting stuff in there over adding more incredibly specific functions
what I would really like is a shiny new OO streams API
 
+1
 
but that is a gargantuan task
 
4:35 PM
I take solace in the fact there are things we can agree on :)
 
oh shit, I better find a reason to change my mind
 
@DaveRandom And then?
 
...and then things will be saner?
it's not a magic bullet but it does give you a lot more scope for adding features in a way that doesn't clutter everything else up
and in a way that's not susceptible to typos causing silent, hard to find bugs (as is the case with the schemaless array-based stream context)
 
Wes
going to bed finally :B
gn all
 
try {
    go_to_bed();
} finally {
    dont();
}
 
4:42 PM
@DaveRandom I would consider it a win if I can stop putting @ in front of every stream op.
 
yes, something that throws exceptions would also be nice
something that lets you get error numbers/strings for stream ops other than connect()
 
@DaveRandom Doesn't even need to do that… just assume that I'm an adult and can inspect return values.
I don't need a warning and returning false if the buffer is full.
 
@Trowski I feel like this particular issue is a thing that could be easily solved with (you guessed it) a context option
 
Yes, or a parameter for an error code… just something reasonable.
 
Wes
client called
classic
 
4:45 PM
It's small enough that it might be allowed in a patch release
3 mins ago, by DaveRandom
try {
    go_to_bed();
} finally {
    dont();
}
 
@DaveRandom That wouldn't really solve the problem.
 
@Trowski well it would at least solve the problem of @
"disable_failure_warnings" => true
 
Wes
better than being called during the REM sleep tho
 
@DaveRandom If I control the resource creation. That's not always the case. Quite often not in Amp.
 
stream_context_set_option() works on bare streams though
so you can just set it when it's handed to you
 
4:47 PM
@DaveRandom If you want it sane, have an API for sockets, not with 132 wrappers.
 
That would be part of a suite of things, sure
 
@DaveRandom And then we have no error messages at all anymore.
 
@DaveRandom Right… but then I depend on that option not being changed again elsewhere.
I just don't like options that totally change behavior like that.
 
yeh fair enough, I like it less the more I think about it (and I didn't really like it in the first place :-P)
 
4:51 PM
nice :-)
 
I was able to reuse a statement after more than an hour of idle time yesterday, but that still doesn't make me happy. That should fix permanently.
 
Wes
groan
 
I gave up on aerys btw
wrote it in Go instead
 
Wes
traitor
 
time saved: infinity
 
Wes
4:53 PM
@kelunik someone asked about async functions in php, are there any plans about implementing that?
 
@Wes Yes.
 
@Leigh Particular reason? Lack of AMPQ lib?
 
Just hard to work with :/
 
Wes
how will that work? since there are multiple async libs?
 
effort required was more than I was willing to spend on it
 
4:55 PM
@Wes All you really need is a common (built-in) Promise interface
 
@Leigh I assume you were looking at 0.7.x. We're trying to fix a lot of that with 0.8.
 
(I originally planned to use Go, then I remembered Aerys and thought I'd try it)
 
it doesn't even need to be an actual interface, both JS and .net just look for a function with the right signature on the thing that's passed to await
 
Yea 0.7.4
 
Wes
just that. nice :D
 
4:56 PM
@DaveRandom just an object with a then method that accepts 2 callbacks, both callbacks having a specific signature
 
Wes
ok, gn. maybe \o
 
hmm.. that sounds like an... implicit interface? wink wink
 
Wes
no no
 
duck typing, or so they call it
 
Wes
that sounds like an actual interface :D
 
4:58 PM
#IMPLICITINTERFACESMATTER
 
!!lxr random_bytes
 
[ /ext/standard/random.c#187 ] PHP_FUNCTION(random_bytes)
 
I don't really understand why, IL does not like dynamic types
I'm sure there's a good reason, I have read explanations of it, none of them made sense to me though
 
@FlorianMargaine That's probably what JS went with because they already had their promises, though I think Amp-style promises make more sense for await.
 
5:01 PM
@Trowski they even have a spec! promisesaplus.com
 
a horrible, horrible spec
you know what else has a spec? SOAP
'nuff said
 
@DaveRandom it's a very small spec :)
 
My Spec is Bigger Than Yours
 
@FlorianMargaine Very familiar with it, but it's unnecessary when you're generally using the promise with yield/await.
Mostly because the returned promise goes unused. We can debate about done vs. onResolve, but I prefer the latter.
then is just wrong for await.
 
@DaveRandom If you switch from SOAP to REST are you dropping the SOAP?
 
5:07 PM
/me waves
 
tips his hat
 
o/
 
applause
 
array(
'db' => 'showimage',
'dt' => 4,
'formatter' => function( $d, $row ) {
return '<img src="$d" style="height:50px;width:50px;align:middle;"/>';
}
),
Any help please, how do I display actual relative path of images in column. Here 'showimage' is database column name having paths. Currently it displays "$d" instead of path. I could not manage to make it work.
 
615
Q: What is the difference between single-quoted and double-quoted strings in PHP?

rob waminalI'm not an expert in PHP programming, but I'm a little confused why I see some code in PHP with string placed in single quotes and sometimes in double quotes. I just know in .NET, or C language, if it is in single quote, that means it is a character, not a string.

 
5:23 PM
@DaveRandom better than python's Future, still :P
 
5:33 PM
@DaveRandom, actually src has value $d when put images\1.jpg, image is correctly displayed.
 
5:51 PM
Should NULL checks on an entity be done in the DB level or in PHP itself?
 
@CoderDudeTwodee Actually I am new to PHP. So I can't answer question.
 
Anonymous
@SaitamaSama playing ow this weekend?
 
Anonymous
I'm playing now btw, you can switch regions if you are not on EU
 
Basically I need to say if $vendortype == 'standard' echo "<i class="material-icons">&#xEB47;</i>" or if $vendortype == 'specialty' echo "<i class="material-icons">&#xEB49;</i>" or if $vendortype == 'service' echo "<i class="material-icons">&#xE54A;</i>"
but I'd like to do it in shorthand
 
Wish there was a plugin to keep track of things like PHPCS results over time locally. Guess there's CI suites
 
6:06 PM
@SamadhanGaikwad yes, because you are using a single-quoted string 3v4l.org/luEng
 
@samayo I'd be down for playing this weekend
I'm currently in the midst of upgrading my pc, so just have a fresh install of windows and arch atm, would install blizz and overwatch tomorrow, and install the new GPU by the day after tomorrow when Amazon finally delivers it
 
@DaveRandom Ok. But tried switching between single and double quotes at all places. But didn't work. Will you plz point out me where I am wrong?
 
@SamadhanGaikwad return "<img src='$d' style='height:50px;width:50px;align:middle;'/>";
 
(removed)
 
@DaveRandom I don't have words to thank you!!!!!! You solved my question which I was trying to solve from many days. Thank you so much!
@DaveRandom stackoverflow.com/questions/48048320/… -This is the link where I had asked question, you may post this answer there, I will accept it. Thanks again! - An unknown error has occurred
 
6:33 PM
got a question I have been stuck for about a week i am not familiar with dom and php but i need to pull data from url. and i only want to echo out everything in the div with a class name. can someone point me in a good direction ive tried everything from simple_html_dom and nothing I have a brief code but mods duplicated it from 7 years ago lol
 
$doc = new DOMDocument():
$doc->loadHTMLFile('http://whatever.com/foobar');
$matches = (new DOMXPath($doc))->query('//div[contains(concat(' ', normalize-space(@class), ' '), ' class-name-of-the-div ')]');
foreach ($matches as $node) {
    echo $dom->saveHTML($node);
}
@Epic ^
just replace the URL with the actual URL and class-name-of-the-div with the class name you are looking for
 
@DaveRandom it just gives errors
it gives undefined varables and unexpected
 
oh I wrote $dom when I meant $doc
but tbf you should be able to debug that much yourself...
 
Parse error: syntax error, unexpected '', normalize-space(@class), '' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')'
 
Change the single quote around the expression to double quotes
 
6:47 PM
it also says matches is undefined
 
you should be able to debug trivial syntactical errors that result from writing code very quickly in a textbox on a webpage...
 
@DaveRandom thank you soooooooo much dave its working
I really appreciate the help
 
try actually reading the error messages and figure out what it's talking about
 
@DaveRandom Wat bitch
13 mins ago, by DaveRandom
just replace the URL with the actual URL and class-name-of-the-div with the class name you are looking for
You lied
 
/me dies
 
6:52 PM
k
go for it :P
 
on another note, I hate it when class names collide with keywords :-/
 
ugh yeas
Just kill at that crap already
 
that said, there can't be many cases when a class named NULL is a valid thing to have :-P
 
null logger
Also the ones that you don't hit often are the most annoying ones :P
 
some day I will remember how to use mysqldump without having to look up how to use it
 
6:57 PM
list is the worst
I want that one a lot
 
if($vendcat == 'standard' ) { echo"<i class="material-icons">&#xEB47;</i>"; } else if ($vendcat == 'specialty' ){ echo "<i class="material-icons">&#xEB49;</i>"; } else ($vendcat == 'service' ){ echo "<i class="material-icons">&#xE54A;</i>"; }
 
List really is the wurst
 
How can write that in a shorter way using shorthand?
 
German sausage jokes are the wurst
 
@benlevywebdesign ever heard of a templating engine?
 
7:00 PM
Yes I have...fuzzy on the execution of it though
Like writing a function right?
 
no.. like separating your logic from your presentation
 
Oh.....
 
Night o/
 
7:28 PM
What ID pdo::lastInsertId() return?
Is it a field named "ID" or the Primary key?
 
@Tiffany Yeah, what ID is it? The primary key? Or some weird ID that mysql maintains?
 
Note:
This method may not return a meaningful or consistent result across different PDO drivers, because the underlying database may not even support the notion of auto-increment fields or sequences.
I infer that to mean the primary key
return values gives some good info too
 
7:45 PM
@CoderDudeTwodee from the 2 minutes it takes to test it, what did it return?
 
Hey @Tiffany is it possible to format html you import from parse so that your view source dont look like crap lol?
 
uhhh I don't know
 
@benlevywebdesign you may be looking for switch
 
8:00 PM
is there some kind of PRETTY flag like there is in JSON?
for JSON
 
Yeah that could work
 
8:14 PM
Hello everyone. Im trying to get PHP7 to execute php within .html files and this will not work
AddType application/x-httpd-php7 .html .htm
nor will
AddType application/x-httpd-php71 .html .htm or AddType application/x-httpd-php72 .html .htm any ideas?
I also recently learned that # cannot be used for comments anymore in ini files so I made sure those were all gone
from within my htaccess
 
8:29 PM
So I just pitched to my boss. I was able to explain my example and what I had missed in my example. He understood completely and even intuitively explained to me some of the positive results of the pattern without me even having to explain them. He's going to tinker for a couple days while I code review.
Thanks @Wes and @tereško!
Explaining it somehow made me understand how it worked more, even though I wrote it. :p
 
@Allenph yeah, I find that if I have to explain something, it requires a deeper knowledge of the thing than if I was reading about it or using it or implementing it
something one of my teachers in high school told me that through teaching a subject, you learn more about it or something. It was a quote, but I don't remember enough of it to search for it.
 
I'm pretty pumped. I think we're gonna try DDD. Finally! :D
 
Morning o/
 
@Allenph congrats
 
8:35 PM
Wasn't there a pattern matching RFC recently? What became of that?
 
I didn't propose one but I worked out some details.
 
Is it going anywhere? Can I help?
 
I have higher priority things at the moment so if you want to take it and run that's fine with me.
 
As in, regex?
 
No, not regex.
 
8:38 PM
A way to match object types without huge stacks of ifs and such
 
I didn't think so but I thought I'd ask anyways :P
Ahh okay
 
switch ($someObject) {
  case Foo $foo:
    $foo->doFoo();
    break;

  case Bar $bar:
    $bar->doBar();
    break;

  // ...
}
 
Not that either ^_^
Well, you need something other than switch.
The different syntax or new keyword is not something I worked out.
 
select?
could also overload instanceof for the other type of usage, e.g. if ($foo instanceof Bar $bar) {
 
8:43 PM
switch(true) { ..
 
@LeviMorrison doesn't it stand much less change of being accepted if it has to introduce a new keyword?
 
$string = match ($config) {
    Config{'name': $name} => "Matched config object with a name of $name",
    {'name': $name} => "Match some object with property name of $name",
    // probably should throw an error if it isn't exhaustive rather than default to null
};
An important bit here is that theoretically we can re-use these same patterns where we currently just allow types (parameter types, return types)
@Dereleased A bit less, yes.
 
For a moment I forgot that we didn't need to make a new variable name because we don't need to retype things. c# poisoning me again lel
 
@Dereleased poisoning, or setting you free?
 
Free from some things, chained to others
 
8:46 PM
It should allow our current array destructuring rules in it.
I was interested in it partly because it's something I've wanted from time-to-time but if done carefully we could re-use it to avoid needing to add named parameters as well.
function (Config{'name': $name} $config) {
    // do something with config
    // give type error if it isn't a Config object that has a name property
};
 
is it the RFC I linked or something else?
 
@Tiffany Something else.
It would allow object literals:
$obj = {"name": "Levi"};

// same as:
$obj = new StdClass();
$obj->name = "Levi";
Any class that does not have a constructor, including an inherited one, can be instantiated this way:
class Config {
    public $name;
}

$obj = Config{"name": "Levi"};
@Dereleased Got all that?
Whether quotes are needed around the property name is up for discussion but in my opinion they need to at least be allowed for JSON compatibility.
The construction syntax and deconstruction of the pattern matching are mirrors of each other, so they make sense to be proposed together.
 
9:20 PM
@LeviMorrison can we retain the new keyword please?
personal pref, obviously, but I don't like the visually implicit instantiation
 
9:33 PM
Laravel's eloquent just added 4 hours of useless work for me.. should've just done manual mysql queries from the start.. fun.. which is what i'll be doing.. reworking all of the queries on index pages to be able to sort properly..
 
lol
 
@DaveRandom hey i was trying some things out I have researched but all i find is that it wont work with html only xml. when i view my source everything is nicely formatted all except the html from the url is there anything like this that will work $doc->formatOutput = true;
 
@Epic no really no, not in libxml2 anyway. Typically it's not necessary though.
 
@tereško Do you usually have separate services to do an operation on your in memory objects then persist with another or unify it into one service? Separating them seems difficult to implement, but unifying them seems like it would couple some units of work to persistence which should not be.
 
@Allenph none of this has any impact on how I separate services
as I told you, I build the applications top-down
 
9:48 PM
I think everyone tries to build them top down, I think we just think of the top in different locations.
 
at the moment, when I define a service and its public interface, I do not have any "entities" or persistence logic made
 
What has an impact on how you separate services?
 
I do it based on the purpose of a service and sometimes based on how/which UI layer's elements will use it
 
I see. That does make more sense. You decide how entities should be defined after defining what they should do.
 
1. take the HTML of the landing page
2. set up route for this page
3. define all that is needed to load a view for this page
4. make the html to render
5. pick different html page
6. make links that will lead to it from previously added templates
7. goto 2
when this is done, I define the controllers that seem to match the routes
then I pick a controller/view pair and start to flesh out what services it will need
and so on
 
9:58 PM
Huh. That's almost exactly opposite of what I do.
Shouldn't you understand the domain and then apply that to the view? The view is...messy.
 
a website start out with the design
and the design overrides specification
 
That's true. Maybe it's DDD indoctrination. In the book he describes setting out to define the domain first.
 
that's what I do, when the public methods for all the services has been defined
 
Ahhh. I see now. That does make sense.
 
you could say the I use them as "user stories", because nobody here has time for ever writing those
 
10:02 PM
But only in a project that comes with view constraints. In a project that comes with no constraints it might make more sense to design the entities first, no?
 
you can do that only if you have a 200 page specification where every little thing has been thought through and where everyone (including designers) only do what is written in the spec
otherwise, how do you know, if you user class will need getFirstName() and getLastName() or will it actually only need getFullName()
 
I guess that is more uncommon, but the only MAJOR system I've ever built from scratch was exactly that way. I designed the application and how it was to going to work by defining behaviors with the help of the designers, then they designed views while I build the app.
 
I am not saying that my way is better, but it works for me
you could say that it follows YAGNI
 
I'm very guilty of that, and I see how that could be the case.
 
10:52 PM
@DaveRandom No. JSON doesn't have it. If we can't keep JSON compatibility then it's only worth about 50% as much...
 
@LeviMorrison I meant for the named one
 
It's purely more typing for no reason? Why keep it?
 
It just reads weirdly to instantiate a named class without new
I don't care about stdClass, that name is just an implementation detail
 
If we unify the symbol tables (which I hope we do eventually for a lot of reasons) then we wouldn't even need it for instantiating new objects. This would have one significant improvement as well: can use constructors as callables.
 
I mean obviously I'm completely on board with merging the symtables
The lack of new doesn't matter that much, it just reads a bit strangely to me
 
10:59 PM
Probably a dumb question, but I thought PHP didn't support named arguments...how then could you do that mapping at all @LeviMorrison?
 
It's not named arguments; it's explicit property instantiation:
2 hours ago, by Levi Morrison
class Config {
    public $name;
}

$obj = Config{"name": "Levi"};
Note the "{}".
This syntax doesn't conflict with anything in use.
 
Doesn't that totally bypass the constuctor?
 
no
it's basically shorthand for:
$obj = new Config;
$obj->name = "Levi";
tbh it would be a lot more useful if PHP had property accessors
it's basically a way to avoid having ctors that take 20 args, 18 of which are just set into properties and 15 of which are optional
it's useful in .net, but at the same time it's mostly useful for dealing with bad APIs in the framework
 
@DaveRandom...$obj = (object) json_decode($json);
$obj = (object) [
	"test" => "test"
];
 
yeh idgaf about object literals
people can have them if they want them
I won't use them though
I already don't use stdClass, I will just continue not using it
 
11:07 PM
If the config object has no constructor or behavior how is it worth it when you can just type cast it?
 
clarity of intent, really
it's "I want this thing to have by-ref semantics" vs. "I want this thing to have by-val semantics"
there's no other functional difference
 
I've never tried this, but I assume you could do (Config) json_decode($whatever) too, right?
 
like I say, I don't particularly care, as I try to avoid both things
@Allenph no
that's a whole other can of worms you are opening up there :-P
 
Yeah. I can see how it would be.
If you're going to define a DTO it seems like you should just define a DTO.
Plus if config ever gets a typed property you're going to wish you hadn't done that, won't you?
 
Typically that sort of thing should be implemented as Config::createFromJson(), not least because most of the time those things need additonal logic
it's very rare in my experience that you don't need to, e.g., also turn a string iinto a DateTime from within the data
 
11:11 PM
Static factories. I see people doing the opposite all the time and completely bypassing other structures in place. I.E. $something->toJson.
 
It's not a static factory, it's a named constructor
there is a difference
 
Ahhh. I see.
Wait, how is that a constructor? It's not an instance so that would have to return something? Am I missing something big here?
 
The point really is that in all of the above examples, you are tightly coupled to the Config class, because you are creating a new instance of a concrete class
there is no functional difference, in that case, between new Thing and Thing::create
you shouldn't do Thing::create for the sake of it, but it is a valid way to have multiple constructor signatures for the same thing
imho
 
@Allenph The exact semantics have not been determined but calling the constructor without arguments and then setting the properties could work. It's easiest to permit it only on classes which do not have constructors to avoid such issues.
 
I'm going to go read about that. I don't understand how that would work. That looks like a static method to me and if it's a static method it's called on something not instantiated...
Which makes it a factory as far as I understand.
If you use "named constructors" there is no purpose for factories...which also leads me to believe it is one.
 
11:16 PM
not everything needs a factory
Config is a good example of a thing that probably doesn't
There is no point in having a factory if the implementation is not in some way exchangable
 
Well, yeah. I know. But if you have that method it all it does...I'm not arguing that it needs a factory, just trying to understand why that is not a factory method rather than a "named constructor."
 
Config is typically just a bag of state
 
@LeviMorrison That seems extremely strange.
 
@Allenph Well the alternative is that you have an actual ConfigFactory with named methods. Which means you either have to inject a ConfigFactory, adding more ctor args, or you are doing (new ConfigFactory)->createFromJson(); which would gain you nothing from just getting a Config instance directly
 
@Allenph Howso?
 
11:20 PM
If you can't decouple it (or there is no point in doing so) and what you are doing is still meaningfully testable, jfdi
 
@DaveRandom I understand that...but doesn't that violate SOC? Any expansion in responsibility could lead to multiple methods like that.
 
Yes, but effectively they are just overloads
 
@LeviMorrison Because what if some do-gooder adds a constructor when something needs additional behavior...like loading an additional config file or whatever. What does it do then? Ignore it or throw a new error that comes from seemingly no where?
 
they don't contain logic, they just accept data required to build the object in different formats
 
By the way, I have no idea what I'm talking about. I'm just trying to understand.
 
11:22 PM
@Allenph It breaks the caller. It would break the caller even if we didn't have {}, because any calls to new Config() would now break.
(Since they don't use the new constructor properly)
 
@Allenph I totally get where you are coming from, I went a long way down that road at one point, I have now started to come back the other way a bit in the interests of pragmatism
I'm 100% certain that at least 3 regulars in here will disagree wholeheartedly with me
 
Well, teresko is a given.
It just seems like a very dangerous game to play when it's so little effort to just add a dependency with room for expansion.
 
/me out for a bit, I have to do some maths the requires nicotine, and then concentration
 
@LeviMorrison That's a good point. Couldn't that also be abused AS a constructor though?
 
How would it be abused?
 
11:27 PM
$instance = new \Something($dependency, $someDependency)

$config = Config{
  "something" = "something",
  "somethingInstance" = $instance,
}
 
Specifically what's the abuse?
Also because our grammar sucks you would need as semi-colon at the end, just like anonymous functions :D
 
Because what if Config looks like this...
class Config {
	$something;
	$somethingInstance;
	__construct(String $something, \Something $somethingInstance) {
		$this->something = $something;
		$this-somethingInstance = $somethingInstance;
	}
}
 
If Config has a constructor that does not accept zero arguments it will error because there are too-few parameters.
 
Hmm. I see I guess.
 
@Allenph The rules I work with are 1) is it stateless? 2) is it testable? 3) is it adequately decoupled in the context for which it will be used? If yes to all then it doesn't need to be abstracted, in fact abstraction would be counter-productive, because you are just spreading the logic out more thinly so you end up with a million files to navigate just to find the actual code you want to look at.
Config is a thing that's generally instantiated in exactly one place in the application, so if for whatever reason I do end up with a different implementation 2 years down the line, refactoring to add an abstraction won't be a huge issue.
When it's a thing that is being created a lot, or it's a thing that you can easily conceive of multiple implementations then sure, knock yourself out
otherwise, KISS
ymmv
/me actually out
 
11:35 PM
^ Meh. Yeah.
\o
Out also. Later.
 

« first day (2659 days earlier)      last day (2273 days later) »