issues take one. I'm Tim Appachell, your host, and today's title is Hawaii Bill introduced to disqualify Trump. This week, the Supreme Court gave the ruling whether or not Colorado could remove Donald Trump from the general election using the 14th Amendment, Section 3, as a basis to put him in the election and that ruling was did not uphold Colorado's request and bill. Additionally, Hawaii, through Senator Carl Rhodes, introduced Senate Bill 2392 to prevent any persons from the definition of Amendment 14, Section 3, and that's primarily insurrection. As I looked at Senate Bill 2392, I noticed the introduction was very interesting. In fact, it was heartwarming. And it said, people have the right to expect public servants to be people of integrity. Ladies and gentlemen, when is the last time we've heard that? And with that, I'd like to go to my guests. With me today is my ever-famous and faithful co-host Jay Fidel and our special esteemed guest, Senator Carl Rhodes and our other special esteemed guests, Governor John Wahey. Good morning, gentlemen. Thank you very much for attending. Good morning. Good morning, Tim. I promise we'll have a fast-paced and interesting discussion and any things on the table, so don't hold back. Hey, Jake, straight to you. The Supreme Court decided to opine and offer a ruling on whether or not Donald Trump should be on the ballot. Let's talk about what they didn't touch. The Supreme Court didn't touch any mention of Trump's involvement with an insurrection. They didn't touch whether or not he qualified as an officer and was that a provision to prevent him from being prohibited from the ballot? They didn't touch whether or not his oath of office was broken or not, and they certainly didn't touch whether or not Donald Trump had received proper due process. So let's talk about what they did touch. That's the question for you. They just went back to Section 5 and said, well, Congress must act, even though it's optional in Section 5. And I think what's said about that is that it affects the whole 14th Amendment, which by its terms is generally self-executing and so Section 3 was self-executing. But now, as one fellow suggested to me, we can save ink and we can save trees because in the future, when we reprint the amendments to the Constitution, we don't have to include this one. It's gone. Well, let me ask you this. I mean, that was the overreach from the Supreme Court. It was to mention that it's both Houses of Congress will have to remedy Amendment 14, Section 3, but wasn't the primary rationale was that no one state can interfere with the general election as far as the construction of candidates on their ballots? Yeah, I think we're concerned and a lot of academics are concerned that if every state has a right to make that determination for a federal office, president, no less, then you could have a patchwork of decisions and chaos. But the problem is the way they left it, Section 3 is gone and it's kind of permanent until some other court reverses it. I think this affects the 14th Amendment generally and maybe other parts of the Constitution. And certainly, it's a really interesting question as to would they have made this decision if they were not conservative? Would they have made this decision if Trump were not running? Would they have made this decision were they not threats of violence if they ruled against Trump? This is a special situation and I judge these things by the man in the street. If you caught somebody at the intersection of Bishop and King and you handed him the language in Section 3 and you said, does this apply? He would say, of course it applies. There was an insurrection. We all saw it with our own eyes and Trump was involved, engaged and giving comfort. You know, that has been also revealed to our own eyes. And if he is not an officer of the United States, what is he? You know, all of this, it seems very clear to the man on the street. So what you get here is something that flies in the face of the ordinary reading of the English language. And the court could not find a way to affirm the Colorado decision, really, with just a sidestep. And it does tremendous damage, not only the Constitution, but to public confidence in the court. Governor Wahey, do you agree with Jay Fidel that you think they overstepped their boundaries? You know, I found that really interesting and I think they were being political. So to that extent, I agree with Jay. In the sense that it's all law that the state can't affect the federal elections. I mean, that's the reason why in Hawaii, for example, and by the way, it was first tested. One of the first states that principle was tested was Hawaii. The way that it affected Hawaii was that we have a resigned to run provision in the Hawaii state constitution. And the one office that the offices that is that's not applied on to other federal offices because there was a ruling very early on that we couldn't do it. I'm not so sure that I would go as far. I think that the Supreme Court, being very political, I think, but I don't know if I'll go as far as Jay. Because what they, I think what they really what they said was, by the way, I don't agree with that. Because what they said was that the only person, the only institution that could define an insurrectionist would be Congress. And what that meant essentially was, in my opinion, that the courts couldn't do it. That you wouldn't, you couldn't take somebody to court to prove that they were an insurrectionist. You have to take the case to Congress. So what they did was they politicized the 14th Amendment. And that is where I think that is an extremely dangerous person. You know, it was a nine to zero decision based on the that states shall not fragment, you know, the federal election process. And then, as far as comedy, excuse me, the Congress providing a remedy, that was more of a five to four split. Were you surprised on the nine to zero? I wasn't. I wasn't surprised because as I said, that's pretty well established law. Okay. I was a little. I'm sorry. Go ahead. Well, to you, Senator Rhodes, I noticed that the bill that you introduced did not mention Trump's name at all. Number one, and number two is, does, is your bills impacted by the Supreme Court decision? Oh, yeah, it's impacted no question about it because we would have, it would have applied to both federal and state offices. But the Supreme Court decision was applies only to federal offices. So the bill is still relevant. And there are people out there who could conceivably get caught up in it even now. The guy, the guy I think his name was last name was Oaks OCHS. He ran against Adrian Tam and Waikiki.  He was at the Capitol on January 6th. I believe he was sentenced. I don't remember whether he's still in prison now or not. But there's the possibility that, you know, if he came back and tried to run for office that. That's a, that's a much more cut and dried case because he was actually convicted of activities on that day. Whether it was, you know, insurrection specifically. I don't, you know, I don't know how that would play out. But that's one reason for having a process is so that you would have judges deciding how it would play out. But it's still a relevant bill. Were you surprised on the nine to zero decision? Yeah, a little bit. I mean, if you look at the section, article two, section one of the Constitution. It, it's just a, it says each, each state shall choose in such manner as the legislature thereof may direct a number of electors. So the founding fathers were certainly not concerned about having like a hodgepodge of stuff. We don't even under the terms of the Constitution, the legislature, we don't even have to let people vote. In fact, the original, the original plan was that we wouldn't let them vote. That we would just pick electors and then those electors, presumably wise men because women weren't allowed to vote at the time. And, and white wise men and they would choose the president. So this whole idea of voting for president, we still don't vote for president. We vote for the electors. So the fact that each state would go its own way. I don't know that seems fairly clear to me that the original, the original intent was that that's exactly what the, the, the various legislatures of the states would do is go their own way. What's interesting on my handy little book of the Constitution. You know, if you look at section three, the last sentence says, but Congress may buy a vote of two thirds of each house removes such a disability. The word is may, yet if you go to section five, it says the following, the Congress shall have the power to enforce by appropriate legislation, the provisions of this article, and the word shall is there. So it looks like the Supreme Court basically inserted the language or the verbiage of of section five to supplant for section three. Your thoughts. Well, I think that typically the way you interpret things like that is the more specific language wins. So the one that's specific to section three, I believe should apply for section three. And if you think about what what they're saying is, okay, so Congress has to put in some law to enforce this disqualification. But then to, to, to take the disability off in a specific case, they have to pass another law to undo the law that they've already passed. And I just, I don't know, I don't think that's a common sense reading of that provision. I think it's pretty clear that the disqualification is, is, is automatic. And then you have to, and then you have to buy two thirds vote undo it if you're going to undo it. Was it really? I agree with Carl. I agree with Carl. The language in section five says shall have the power. That doesn't require it. Right. Either under that section or any other part of the 14th amendment to do. And most of the 14th amendment, if not all of it is self executing. And that's the history of, of that, of that amendment. So I don't think there's really a requirement in that language you read. It only offers Congress the power. On the other hand, you know, what they've done is created a real interesting logical, logical problem here because the relief to the disqualification, which I believe is self executing is that you go back to Congress, or you go to Congress for the first time and you say two thirds vote in each house and you can be excused from your disqualification. And that's the as Carl says, that's the specific provision specific to this section three that should apply. So if you add in a requirement of Congress act in the first place, and then you, you have to abide by the language in the last sentence of section three, you get a real logical, you know, Well, they turned everything backwards. Yes, they flipped it around. Right. They flipped it around. I mean, that's what it did. And that's how they politicized the system. So it flipped it around. Now you need two thirds vote to be excluded as opposed to be placed back on. Well, not only that, but didn't. So you need a majority vote to be excluded, their interpretation. And then you need a two thirds vote to be excused from the exclusion. So, you know, it's really a strange situation. And of course, you have the problem of the we were talking about this yesterday, Tim, the problem of the filibuster, which changes the way that vote work. Well, for for in the Senate, if the bills to get onto the floor, you just need you just need 40 senators to to introduce the concept of a filibuster. So you've created a super majority by by that Senate rule. And then you need I believe it's 60 senators to override the filibuster if I'm not mistaken. So they've added some complexity on how the Senate, at least, would be able to remedy this this issue by adding because we have a standing filibuster rule in place. I was just thinking, though, that, you know, the complexity at the congressional level will be playing itself out. But I think the court was with a sizing process. Nevertheless, I think the bill that the senator introduced here in the legislature still has some validity for Hawaii, you know, on several levels. And, you know, it would be interesting to see how we would apply it. But, you know, the world's getting more and more crazy. So we have, as you pointed out, we have our own patriot boy that was convicted. And if he tries to run again, this is a statute that you would do it. I mean, we don't need to follow it. We don't need the opposite of what they the nine, the nine to zip rule was is that the state can do what it wants with it. It's election short of violating, I guess, equal protection of the process. So we can, you know, we, and we have a very recent history of interpreting a very similar position very differently. There was a, I forgot the name of the case, but there was a gun case that came down from the Hawaii Supreme Court. Hawaii versus Christopher Wilson. Christopher Wilson. Yeah, that's right. And they in the Hawaii Supreme Court said, hey, you know, our, our, the language in our Constitution about guns is almost exactly the same as the Second Amendment. And there's some punctuation and capitalization differences that don't really have any effect on the meaning. And the, our, our Supreme Court interpreted it quite differently and actually took into account the fact that the word militia is in there and said it, you know, the guns have to be connected to militia. So it wouldn't, it would, it would not be a surprise if we interpreted the whole thing quite differently. I would love to see that for one. I would love to see the same kind of analysis where the state Supreme Court effectively rejected the United States Supreme Court decision and was it ruined. And that would be a wonderful thing and we'd be very stiff neck would be reversed. But we would be making a statement for the world that the fellow on Bishop and King, his reading of this language should apply. And I think that the way that we get back into the federal issue, though, is the fact that the senators bill really didn't, for example, didn't talk about the Kennedy, the senators bill of focuses on the behavior of the electors, which, you know, I think is very close call whether those whether electors ultimately, as you pointed out, Senator, creatures of the federal system, or of the of the state. So while you may not be able to exclude Trump from the ballot, for example, I wonder how the, I think the issue is still alive as to the behavior of the electors, if your bill passed. That's a very good question. And because we don't directly vote for the president, we vote for electors. Having said that, though, of course, it has the federal courts of rule that we can enforce the faithful selector rules. So we passed a bill by year or two ago that says, if you said you're going to vote for Donald Trump, you have to vote for Donald Trump if you were to win the state. I don't I just don't know how about that all. Or you'll be able to mend that section by saying, unless, unless they are, you know, insurrectionists, whatever. Exactly. So it's still, it's, there's still some interesting questions there for sure. Senator Rhodes, to what degree did your Senate bill have support? Has that crossed over to the house as yet? It did cross to the house a couple weeks ago. There were some no votes in the Senate. I've forgotten how many it wasn't, it wasn't particularly close vote. But in the Senate, of course, if there's any no votes, that's somewhat noteworthy. So there's some resistance to it. How was public testimony on your bill? My recollection, it was almost entirely opposed because the Republicans hate it. And they're, and they're very well organized. So they come in and flood you with with opposing testimony. Did they cite specific grounds why they're opposed to it? I mean, I really loved how you the the introduction of your bill. Again, I'll read it again. The people have the right to expect public servants to be people of integrity. I, I love that. I think that should be on every bill. So what specifically do they oppose your bill? The most common claim was you're taking away the right for me to vote for who I want to. And my response to that as well, there are several, there are several things. There are several qualifications to warrant for president. You have to be 35, you have to be natural born citizen, whatever that means. And you have to live in the United States for 14 years. And you have to not have until a couple of days ago, you had to have not been involved in an insurrection. So, you know, it's just, it's not, it wouldn't be me taking away your right to vote. If you don't meet the qualifications to run, you don't meet the qualifications to run. Are you disappointed that the Supreme Court didn't take up whether or not Donald Trump was as the finding of facts of Colorado that Donald Trump had participated in insurrection? Are you disappointed that they didn't take that particular issue up? I'm not disappointed is the right word. I, it's a real gnarly, a factual issue. And normally, you know, with a fact pattern that difficult, you would, it would have come up through a trial court, basically, and you'd have a record on appeal, and then you could decide from there. It is kind of an, kind of an unusual situation for the Supreme Court to just, I mean, they had a record from Colorado, but it's, it's not. They had a hearing, they had a hearing. They had a hearing, but an evidentiary hearing in front of Judge Wallace there in the court. Section three doesn't say anything about conviction, it just says you can't have participated. Yeah, but I think they did, in fact, take it up. They just did it by sleight of hand. And what they did was that you couldn't, what they decided was that you, that a court couldn't decide that issue. So it didn't matter what the record was. It didn't matter what happened or what's in the thing. And that I think, or at least they, they suggested. Now, I don't know if the court's going to hold that line or that strict a line, but in this, in their decision, they're basically, as I said, politicized. Because they remove the decision from a court, from any kind of hearing, from any kind of process, and just placed it with Congress. Let me ask you this, because Jay, you and I talked about this yesterday, and that was, what would prevent potentially 50 states from coming up with different findings of fact about the definition of insurrection? Would that be chaotic at least, Governor White? Well, you can, yeah, well, I, yeah, that'll be chaotic. And but it never, that potentiality never really, really happened. You see, there's some, there's a little flawed logic in the Supreme Court decision. I mean, first of all, the basic unanimous holding was, in my opinion, all precedent. And they could have just said that they could have just stopped there and say, well, you know what, you guys shouldn't have anything to do with federal elections. You want to do this for yourself, you do it. So, like, if you're going to run a primary election and use state money, maybe you might have something to say about, but, or whatever. But they reached, and they went beyond the fact that this is the federal election and the state ought not to be interfering in it. And then they suggested which among the federal players should have anything to do with it. And, and that to me was where you get where things start to get shaky, because they're not they're no longer really deciding the issue. They are in fact giving Trump a remedy, which is like, you know, if this is ever to happen to him, you got to make sure that Congress voted on it. Well, you had mentioned that they got into the politics of the issue. And let me just kind of remind everybody what John Robert said. This is a message to Americans that they should take home. Barrett said Barrett Jackson said, not it is this is not a type to ramp things up but to kind of cool things down. So they were concerned about the outcome of their decision. And they did dip their toes in the politics of it versus what I would think is the strict law of it. It was very subtle. I mean, they didn't do it straightforward. It was it was very clever. And they kind of turn it what would have been a tradition and another traditional interpretation on its head. Because as the Sotomayor pointed out in her descent, basically, they removed the court, they seem to have removed the courts from the process. But there's no way for me to challenge Donald Trump and his insurrectionist heritage, except to take it to Congress. The whole idea that somehow they're going to they want to tamp down the divisiveness in the country is just a joke. You just baldly overturned Roe v. Wade, but a year and a half ago, and the Supreme Court and the recent past has gotten directly involved in politics with Bush Gore. You know, absolutely crocodile tears. We have a hearing coming up on the immunity case. You know, the argument for the Supreme Court is set on, I think it's April 25th on the immunity case. And we're going to see what kind of questions they ask and take their temperature on that one. If they wanted to tamp down the to take care of that question, they should have taken it up when Jack Smith asked them to in December. So I mean, it's pretty clear. I mean, it's a very plausible explanation that they are going along with Trump's plan to stall everything by just dragging it out and dragging it out. So but they didn't drag this one out. So I don't know. I think they're they're hopeful. I think I agree with Governor Wahey that they're being very political. But I think the results is actually worse than that this this moment, you know, dealing with the Colorado case and Illinois and New Hampshire and what might have been Hawaii. I think I think you have to consider that this election coming up, which is now clearly going to be a re a rematch between Trump and Biden is probably going to be pretty close. And it's possible, as it was last time, that people will see the truth, see the light, and they will vote against Trump and the result will be a close election where Trump loses. And what do you think? Is he going to do exactly the same thing? Is he going to deny the results of that election? Is he going to try to manipulate the process? Is he going to try to do some insurrection? Well, Section 3 of the 14th Amendment is not available to stop him or to hold him accountable if he does that. I was going to say, I think the answer is yes, he is going to he's going to do exactly the same thing only he's had he's had a trial run to last time. I don't. The reason I mean he's very personally motivated. He's been indicted 91 times and he thinks his best chance of getting out of all those criminal indictments is to be in power. And he thinks he'll be able to stop those investigations. Well, he might be able to. I'm not sure. I don't know if that's a foregone conclusion, but that's that's why he's so interested in winning this race. He doesn't want to go to prison. Yeah, I agree with that. I think that this race with Trump is like a survival race. Which, you know, I don't know whether the sometimes courts tend to do something like this and especially political court and that is they keep giving a little bit and a little bit. They're doing everything they can. But at the end, I think the courts going to hold that he is going to be liable for criminal conduct. But they're going to make it pop. They might throw in at best some sentence, but not while he's in office. You know, something like that. And, and just give him every break they can to see whether he's going to win the election. If he did win the election, we're going to be having a discussion when the when this when there's going to be a decision about whether or not we should amend the Constitution and allow for a third term. Well, what about the question that was asked to his attorney whether or not a political assassination of his opponents would be justified and would he be in a position to be prosecuted. And according to the attorney, the answer was pretty much no. Yeah, at least not while he's in office. He's claiming absolute immunity. He says that no president can function without absolute immunity, even though every single president up to this point has function without absolute immunity. Well, you know, I think it's entirely possible with this court having revealed themselves in so many cases already. We'll find some immunity for how much don't know. But the way they frame the question is, does he have immunity and to what extent and so forth. It's going to be a grayscale on this one. But let me let me go back to your bill Carl. You know, gut reaction. As soon as you see the case, the Supreme Court's action a couple of days ago, you say, well, Carl Rhodes bill is done. It's no longer important. It's no longer, you know, going to happen. And as you said, the Republicans oppose this because they don't want your bill. They like insurrection. I don't know. They anywhere close to insurrection. They like they like that. But so but as a matter of fact, real politic, what are the chances now in view of this, this Supreme Court decision that your bill will pass? And if it doesn't, what does that mean for Hawaii? If it does, what does that mean for Hawaii? Well, I mean, as we discussed before, it's still clearly relevant because the court case, the US Supreme Court case that was just decided says it only applies to federal electors. So our election. So on the state level, it would be a good, it would be a good idea, whether we anticipate any insurrections in the near future or not. It's always good to have a process in place before before the event happens. Having said that, you know, I mean, I think it does make it a lower priority bill in the House. It's it's viewed as controversial. I kind of I've always kind of chuckled at that because all it's trying to do is follow the terms of the Constitution. And when following the terms of the Constitution become controversial, we have a problem. But, you know, I don't know real politic. I just don't know. The bill is not dead yet. But is it a priority compared to line of fires to, you know, a whole host of other issues that we're dealing with? I don't know. We'll see. But there is a there is a kind of hidden issue in there for Hawaii, though. And and and that is what is the definition of an insurrection?  How does the law apply to somebody, let's say like Bumpy Connelly, who is openly and declared that he has his own nation, for example, or any of the Hawaiian nationalists and so on with this? Would this mean it can be, you know, was there a kind of Hawaiian exception? No, there's no there's no Hawaiian exception in the bill as currently drafted. But yeah, I mean, it's a fair question. And I don't know. I mean, it all depends on what the definition of insurrection is. And I, I was of the opinion that I probably wouldn't be able to figure that out on my own. And that's why we punted it to the Hawaii Supreme Court. But I. But I do think this whole the whole it's actually more relevant than people think right at the moment I think because if Trump is reelected and that's not beyond the realm of possibility. I think that there is a it is possible that the United States will start flying apart. Yeah, me too. I think so. If that happens, then I would think that there was going to be a real strong movement in Hawaii in particular, which of course wasn't independent nation not that long ago to fly with it. And then, you know, does the does the insurrectionist clause apply to the United States? Or does it apply to Hawaii as a new nation? I don't know. I don't know. Probably again, probably. Or Texas. Texas is going to fly maybe faster than Hawaii. I mean, they want to. They got more scientists there probably than they have more guns too. Yeah. Oh, I don't know about that. We got more. We got more guns than people. Oh, I didn't know that. Okay, that's that's not good to know. One of the Republican initiatives we haven't talked about is article five of the United States Constitution allows for just as the Hawaii Constitution allows for a constitutional convention. Okay, have a certain vote of a certain number of states and all that and then presto there's a convention to change the Constitution, the United States Constitution. Republicans want that. I think they have a lot of reasons to want that. But the fact is a lot of people in this country are really, they do not understand that they don't particularly, you know, accept various provisions of the Constitution, including Donald Trump. And you mentioned before Carl that he may want another term after, you know, he may want to be an FDR and have lots of lots of terms. And this is one way to get there. He's pretty old too. I think he's only three years younger than Biden. I'm not too worried about that, although he doesn't drink or smoke, which that does. Well, I'm saying is that you talk about the country flying apart, going fragmented. A, I think the country is already coming apart and the rule of law and on respect for the Constitution and the courts and so forth and Congress is locked up. We all have to admit that so that, you know, article five would be would step into the breach. Article five would be a real chaotic experience, as it would be for a constitutional convention in the state of Hawaii, which is coming in what two or three years, right? Well, if we if we if we want one. No, I've always actually, this is a I'm pretty liberal and but I actually part company with my liberal friends on article five convention. I mean, the way it's set up, you have to have, I forget it was three quarters or a whole bunch of states have to agree to do it. But I say, let's go in there. Change the second amendment to be some reasonable thing, fix up, get rid of the electoral college, which is just ridiculous at this point. All the stuff about slavery. Get rid of all that stuff. There's a whole bunch of stuff that needs fixing. And I don't, you know, I'm not I'm not as afraid of an article five convention is a lot of my liberal allies are my I used to fight with my father about this all the time. So what are we losing dad? I mean, it's like, we can control the outcome because you have to have a super majority to approve it, whatever the outcome is. And let's go in and fix some stuff. But yeah, that's probably that's probably ready. I've been talking on that same discussion with people on the local having another convention. Yeah, very true. Hey, we've written out of time so I'm gonna go around the table and ask for your last thoughts. I'm very sad because this reveals more about the Supreme Court. I think it telegraphs what they're going to do on the immunity case. And I think it undermines public confidence in them just as it did in the tops case. So what you have here is a sorry, a plain language statement in section three of article of the 14th amendment. And the average person can say, gee, what happened they they they shunted that to the side. This is that good law when when it says it in English, I believe in the language of English. And here we are, you know, arguing as as has been argued over the past few months, these arcane decision points. I agree, John Roy, hey, that it's a clever thing what the Supreme Court did. But it is not a thing that protects us from dictatorship. It is not a thing that protects us from an autocrat who would undermine the whole Constitution and civil rights. So they call that political, if you want, but I think it's it's real. And I would I would want to, you know, affirm the Colorado decision simply to keep a president out who has been directly and demonstrably involved, if not a planner of the insurrection. So what happened here is we bypass all of that, and we may suffer it again. Okay, thank you, Jay. Governor, Governor Wahey, your your final thoughts, please. Well, as we used to say when I was in the legislature, I don't I don't know if they still do it but I'd like to add those passionate remarks on to as my remarks on the record, you know, except I would change the word clever to diabolical. Other than that. Okay, that's where I am very much. Thank you so much. Senator Rhodes, you get the final word on this topic. Well, thanks. Thanks for having me on. I, you know, I, I don't think the population in general and in Hawaii either is is taking the whole insurrection thing seriously enough. Donald Trump has been indicted on criminal charges 91 times. Prosecutors don't take on former presidents if they don't think they've got the goods on you. If I were on a jury, I would have to look at the record before me and decide accordingly, but I'm not on a jury. I get to look at the whole record about everything that we know about this, this instance. And we can't. I don't know how long the democracy survives if we ignore the kinds of things that happen on January 6. Alrighty, thank you very much. I would like to thank my co-host Jay Fidel. I would like to thank our special esteemed guest, Governor why hey, and I would like to thank Senator Rhodes for your participation this afternoon and thank you for your very sage and wise comments. I like to, I like to thank Senator Rose for putting that bill in. Thank you. That was a mark of courage. He's got a few good bills dealing with elections that I hope people pay attention. Yes, indeed. All right, here, here. I like to conclude and echo Senator Rhodes. Again, I fell madly in love with the introduction to Senate bill 2392, and I'll repeat it again because it's worth repeating. And that is as we head towards the general presidential election in 2024, people have the right to expect their public servants to be people of integrity. So let's all remember that as we move forward. And until then, this is Tim Appichella with American Issues Take One. Won't you join us next week? Aloha.


Asko facilitators of WUZI's 2016 forum, UNCTAD is proud to invite everybody to join us in maximizing the potential of ICT for inclusive and sustainable development. Its unique format and multi-stakeholder dialogue make this forum particularly suited for maximizing our contribution to the creation of a digital world that serves for inclusive prosperity.


on the back, okay good so okay so my talk today is about the dependency injection and I want to introduce about me first I'm Michael Bui I started working with PHP a very long time ago and obviously working for companies in 2008 I like programming I like learning new things and I like building things also like photography chess, traveling, tracking, sports, I like food so every week and if anyone want to join us you are welcome and I'm the father of a lot of daughter okay so today is workshop and I repair one like exercise for us for today so if you go to our pp.com.htr website we will see the list of speakers right so our task today is like we try to pass the website and get the list of the speaker from that it's very simple task only yeah so this is a tool we will use to help us on this one and before going to the workshop I expected everybody to I get our hands dirty try to write some code try to run it and to see the result and you can feel so let me go through the website first so this is the pp.com.htr website and I want to get on the speaker if you go to speaker tab here you will be scorned out to the this section and what I want is I get all of this name even further down and I want to sort it by alphabetical orders so okay let's assume we can anybody can see it clearly or on the screen okay so amazing this is interface of class I want to have a conference time classes we have one method called list speaker and this list speaker will return an array of speaker names okay so anybody have questions so far okay good we are good to go the first thing I prepare the this so this is a basic code for us to start and I will share this link on our event page is here so you guys just go to our Facebook and click on this link you will get the list of the code okay so do you have a composer installed on your machine already okay so if you don't you just go get composer.org and this is how you install composer on your machine so I give you some time to install composer and if you have any difficulty to install it you find any issue or problem feel free to let me know I will come to help okay you don't really need docker yeah yeah you just install pps you know more because this one is very simple one that means I go into my yeah that means as a Windows native yes if they have I'm not sure Windows 10 have it okay I never try in Windows 10 okay but the link is get composer.com also prepare your folder structure like this like this workshop folder and so we're in the same line and we can start easily okay okay okay so composer.com file you can put anywhere where you can access yeah anywhere on your local system yeah but usually you can put it the same same folder with composer.json yeah you can use it okay give me a minute yes this link download and run composer.json no because this is Mac this window okay do you copy it like this yeah you follow this one yeah and copy and run in your terminal yeah okay keep some time to download let's click next next pps version here right okay it's installing see finish already where's your IDE IDE I'm not sure which IDE are you like she's busy with somebody or somebody has a question can you help him to install the composers I think yeah so anyone okay yes yes can you see my folder structure okay I don't know how to zoom it in but let me try okay give me a second sorry I cannot zoom out yeah yes sorry no you don't need for my talk maybe I'm not sure what the other but for my talk you don't need to install just run in the native p8 piece okay I'm not sure you ask yeah yeah sorry currently I tested in pp 5.5 so any above and by 5.5 should be okay yeah sorry json extension because okay so when you install pp you didn't install the json extension so I think you can use them I mean have pp but then you have to find where the pp run run time files okay and then I can yeah yes I think because here you can yeah you are using 16 right so that's why they cannot find any version so if you install zam and I think it's just be able to fight but it would be easier if I'll just install right in my DC and then do the yeah but I think senior is already installed sequins you can just install the pp json yes yes yes just so for 16 pp json installation on Google yeah yet it should be able to run in window 7 as well I'm not sure maybe you do you have permission to install okay okay let's see what happened to see if the have composer installed so you guys can see the photo structure better now yeah can this plus mean anything about this yeah just only on Facebook so everybody can check it out message let's see okay because in pp computer configuration this function is disabled yes yes you can okay let me try for you usually you can just be pp that I for info and you graph dot and I here it should be in the first year this is a lot yeah yeah sorry yes after you when you install the composer dot far I don't have I just don't want to be okay you you have a structure right and then you download the composer get composer the off okay where is that okay do you know where is this look at let me see okay this is the right composer okay we have here it's have a cushion so okay so where is this project so that's top that's top of the ground okay good so CT project and this photo is workshop okay then you can run okay let me check if I should have pp now it's been past the composer rotation fine and one is download the version even get the dot log fine the dot log file is locked the version to his packages yeah so it's more convenient for you to download in the next time okay welcome so whoever downloaded and have composer install can run this comment and you can change this part to your local part to the composer dot far so after you run this comment to install on the dependencies for our projects and this command will generate the composer dot log file here so you don't have to worry about composer dot log for now so just run it and it will pass the composer rotation fine and download on the packet we define in the composer rotation so this is a command because I put in the many on the parents folder yeah yeah you can change this to your local part yeah I think by default it will be inside your user folder if you download the composer dot far thank you so we can't really see what's going on so basically we have already put in the downloader yeah and then we have also installed the composer yeah so what's the next thing that okay you need to follow mark the folder structure give me a second first I think it's okay you can run like this where is your combo okay I think composer is inside here okay your local so where is your project folder my project folder is in my Zen folder okay oh I have to actually write in my yes all right so I think if I can copy this part so you can run the composer is strong because it's already have a composer position here I will you change this structure later okay I just run it you don't have it and you install first give it some time yeah after it's in stone gate and it can run the composers yeah or if you're not running you can just really run the combat yeah this one and then I copy the composer application file in this folder and then also try this one yeah how did you install the ppjization actually oh no this is in the Sam is it a Sam but this one is a sick win they are two different things yeah so like for example pp.i so you see you don't have any Jason library in store yeah so you need to install for six win not for Sam so forget some for now yeah yeah okay yes correct but this part where's your composite of far yeah that's one okay it's a different between map and window yeah so basically this is copy this how to copy here so this is a part your local part it's running fine now okay let me check where how do you install ppj yeah okay where where is your composer rotation fine it's in this directory no this is it different sorry can you see I have a composer rotation yeah no this one don't have a composer rotation you need to generate the composer rotation if you go you have a Facebook here yeah yes I set a link here you still can see I think or maybe each I look in first now this is a system and have you tried installs this pp my friend Jason no no okay you don't have a assist so I'm not sure is the solution where is your six win where you run the six win to install no this is a fine already but where do you extract this one no no you already have a you already have it in store yes but I want to see where is a folder okay you extract the 16 folder here right I'm not sure okay then you can try this one okay just follow this one you see so you make the folder structure like this okay for your pp installation you didn't install the open SSS open SSS extension is not installed how did you install pp because it's missing this one so you cannot it it's a long time I haven't tried in windows so sorry about this one yes you just right yeah no need to run all of this you only need to run pp position only position and paper far yeah don't copy like this this is one comment so have you install up six okay good install pp json and p let's try this it's thin downloading okay so you prepare the folder structure like this also cause interface five inside the folder the conference interface fine yeah they put in this follow this for the structure this one if you install properly then yes you can just run it yes so basically let me check yes now you have json support so you can try to run the composer install it's a bit difficult to run from here okay I think you can ask her she also have window so first thing you need to install sick win yeah this is a package here I think can you have her or install the pp not yet so I think they need to download sick win have you installed the pump on the package right yeah later when everybody install it I will start yeah yes decision is not okay because where is your decision composer rotation right you see I have a composition here and having my you need to update this one first because it's outdated I just update it not self update just a bit self update that means it's updated composer version when you run the composer update you update the package version okay so now you just can compose install yes yeah okay good you are good to go everything is there so basically you make a folder structure like this okay yes yeah sorry no the vendor is here yeah the vendor is a composer folder yeah so don't you don't have to touch it you just put the component interface inside inside the folder yeah it's been setting up yeah okay what is the error you see I can be I can be extension okay very simple you can just run like I have sick install pp I can be and pp mb mb string then you go yes some time in another run you need to install for this will be okay install go to go okay you can go next give it some time okay give it some time to download all the packages so if you need some if you see any missing package you just do a app seek install and pp hyphen the name of the package yes yeah welcome because you are running pp 5.4 owner package now is running pp 5.5 at least yeah yeah I don't know but you have to use pp 5.5 at least which which first with my question and I'm using a big one okay then you use a better vagrant or which OS you are running Ubuntu or what this one is Ubuntu okay which Ubuntu first let me just it's not it's yum install so it's okay I am yes so this fragrance why don't you just install which of your and your local I think you can run it on your local because from here like this can I close this one as well so your local is already being fined fine you can create any folder yeah so you have composite install right yes so you can start thanks to Jason here yeah you know save me okay so you try to figure out how to get the speaker from the website at least of speaker from the website okay yeah yeah so all you need to put the folder structure like this first so let's have in the source and conference and go to conference interface this fine yeah yeah I mean this one is thin in this one is thin in I mean the folder structure the conference interface should be inside the conference folder okay and the conference from the inside the source from the okay yeah so you have a local source in one home conference yes okay yeah just read yeah because this one later is have a some tablet pp standard yeah so one folder inside the soft folder will be a tablet sub namespace yeah yeah is this no you need to install the composer just go to the getcomposer.org no no no no no no website yeah getcomposer.org yeah getcomposer copy and paste this for lice own for lice own on the yeah yeah let me have it yeah and just spaces and the people sometimes too okay it's downloading as anyone is still have composer install okay okay who hasn't installed who hasn't installed composer successfully one two three four five I think own from windows right now it's available here let me see where is this fashion deal you need to specify the directory as well they should have it and it's just extension here yes so basically yes you need to remove this one and let's see install just leave it so far so good right okay it's thin installing because this computer is very weak I mean when it's when you download too many it may cause some conflict or some error yeah so that's why this computer is too small for that usually this one is usually this type of computer you for using for like watching movie browsing website writing some document but it's not for programming yeah this is like a mini computer rather than a real computer not really if you if you want to do the program do a programming you need to get a map highly recommend it because the terminal image is much better yeah and actually the mask they have you have a balance between the graphic in the face and the terminal as well yes you need in Linux right you don't have a graphic the good graphic in the face but in Mac you have a board okay sure so how is this okay wait wait wait yeah okay I think I can you open your terminal okay let's see it's not installed yes ask her ask her how to install app 6 yeah no not this one up sick is another one yeah ask her it should be a very simple comment sorry no you don't need a bunch yeah actually composer is a pp script composer is a pp script so basically you just install pp okay where where you run the command for be a insta composer so is where I run where is a composer but I mean where is a composer the farm I think honey honey where is a composer the fire in window see drive at data actually it depends like one like one of them installed there right it seems he's inside his user folder okay so it really depends on where they run that command okay no but the thing is they run those as a epic as a somewhere I need to run the Composer install no you also have you you have a six-win as well right you install pp by Sam right I try to download the when the installer is corrupted so I just stick to the and then when I after I install the talker I find that my machine always something wrong oh yeah it's just slow okay so where is your composer rotation have you create have you create drum composer rotation fine okay you go to our Facebook okay you go to the our event base I will see the script you just follow okay click on events up here right here happening now you're in oh yeah right you run up get up sick from here this line okay no no not not this doesn't have anything no it don't have sorry okay guys it's time to start now we take a very long time to install on the dependencies so okay so this is a interface and all the our library we base on this control phase interface to get the data from the website so this is a website and I want to get owner this name so anyone have success in how to get this name yes but it's very complex to pass for example if you you know jQuery right usually I want to hike this website sorry but I'm tired here to make sure that we have jQuery yeah the dollar sign dollar sign is very famous for jQuery library so then I will try to see I think it's very difficult for people to see this one yeah yeah so okay so basically when I see when I try to inject the web page I will see that the name inside the H4 tag cannot make a bigger fall from here yeah ah yes yes yes good good good good can you see now can you see from the back okay so basically this is a web inspector from Chrome I think in Firefox we have a five up in Safari you can have a same as well it's also a Chrome web inspector you click on the this button this tune so you mouse over on the element it will show you the structure and from here we can see that the structure the name is inside H4 tag and H4 tags inside the offset L1 class so I try to test to make sure that this selector will get all the name yeah so see so basically I use a I find the class offset L1 and inside the offset L1 I find the tag H4 and here we can we see we see a list of array here so basically maybe this is not fully correct but we can have a concept that this one have the list of the speaker in our website so if I get the name is printed on the name one by one together so basically we can see that by using the query we can get this name easily but we are using pp so how we do that yeah so the first thing I will do I will create a class a concrete class implement this interface I call it pp asia 2016 version one let this is version one later I will have another version to show you what is different between these two so I implement the conference interface here and you see this okay I need to zoom it out can you see now okay so you see they have a red red underline the red underline when you mouse over it is say that I implement the conference interface but I didn't implement the list speaker method so now I have to install the list list speaker method okay you see the red light gone so basically once you implement an interface on the method inside the interface must be implemented inside the concrete class okay so our main function our main code will be happening here so but usually what we're doing now is we try to connect to the other websites get the data get the HTML data and pass the HTML data to get the speaker names okay what that's what we do right so basically I need to have a client to connect to the websites okay this first thing we need to connect to the website and get the content of the website the client class is what was the utility class from Gazzo package the Gazzo package is for HTTP clients to connect to to make a request to any website so once we get the data with the data of the website we need to pass this right and we have a code controller so we create a controller and we put the response inside the controller and we will use this one to find the name so similar to Zequery we will get we will use the same selector from Zequery so this is very convenient for us I think Zequery is quite famous for and we already get used to with Zequery so the note will be the list of array that we see in the web page now is in the web inspector here here is the list here is the note we have so I need to go through the list of this note and extract the names okay so for each note on the text content of the note will be the name of the speaker so I will put this on this name into the array names and now another requirement is we shot it by InfoBad right now shot is a built-in function from PHP so this one is I just use this one for from demonstration only so you don't care much how it works or what is what is this but this is function to shot by InfoBad short alphabetically and after shorting the names we return it any questions so far are you sure this one will work okay how to make sure that this one will work yes we write a test for this now so I create a folder and make sure that the folder in the test folder will be follow the structure in the source folder this will be a mapping that we are when we test a class when we have a test class the test class is for a source class okay so so this is a test class so all the names names play for test classes we start with test and after that it will be exactly like the source class and on the test classes must end it by this suffix the test suffix this one make sure your class name must be exactly same like this otherwise the ppunit will not detect it okay so in a ppunit test this setup method is running before every single test of this class and one test will be prefixed by this name test with a lower case if you don't have this step for example you want to write on name function name like this you need to indicate it in the annotation code this test so ppunit we know that ZIT is a test but for your convenience we just use a prefix and we set up the an object of the class pphcr 2006 versus one and what do you what we test now is we try to get all the names by calling the method from the conference right and here we see this guy right so I know that this guy must be inside the list so so I expected this name is inside this array of names so what are you doing now is we try to run the test to make sure this test is passed so since we already used a composer install so vendor vendor is a composer folder and this is the bin is a binary file ppunit is a library from ppunit package for you to run the test and by default this one will read the ppunit.xml which I provided before okay you see the after running the test we see that all the test paths we only have one test only so the test path mean the name this guy is inside our list so again in order to make sure that job application is running fine you need to write the test because the test is almost instant feedback for you to make sure that your application is running fine or not if you need to deploy it in order to make sure that it's running takes very long a lot of time to go back and forward so come back to this now our program is running fine so like we can say the boss I'm done but it like how okay anybody can see the problem from this code okay just example I close my Wi-Fi connection so there's no internet connection to the website and I try to run the test again boom fail because it's cannot connect and when it cannot connect there's the name array is empty that mean there's no the guy is not inside the list so just say it didn't fail but our program is running five before and our program shouldn't depend on the internet connection right how you how we make sure that the problem from the code is that when we run the test we actually run a connection with another party so in order to write the test we try to avoid that one and how to avoid that is by mocking the request so we don't actually run the request but we still return some data for for us to to run the test okay but if you're doing if you write a code like this we cannot mark anything at all because when we create when we call the this method everything inside this method will be run and it's really out of our controls there's no way for us to make change inside here and here we come with the concept of dependency injection as you can see inside the code we read this code will depends on two dependencies the first one is a TTP client the second one is a drum crawler so I will try to improve this one okay so basically I will leave this method here but I will create a new class the class is thin implement the interface and I still have implement that method public function guest speaker I think so yes no what is this least bigger sorry okay but from here okay watch okay can you speak louder which five okay okay this test fire right okay sorry you want to modify this okay you can copy it I give you for one minute to finish this one yeah okay I give everybody one minute to follow this code and run on your local to see the I sure data yes I was actually I have this on github already but yeah I want people to follow the step by step first eventually you will have it in github and you save it everybody yes so same SGP yeah yeah okay you need to go to ATP this one yes okay I come back because I don't remember symphony component right yeah so I don't guys is let's try that's all right yeah let's try to run it yeah I think component not components sorry yeah you edit yeah yeah no s save it you cannot run business this is class you cannot run this one have you rather have you write a test okay no it's not running the test like this you need to run by vendor oh be in ppunit see oh no test it's cute no you need to put this one you didn't follow the folder structure oh yeah okay I can't see that's why I said on the beginning we need to this because of the names just correct how do you store the composer this one is installing the server yeah but you mean this it cannot put the folder inside here I run as root he's a test server it's okay no I'm not sure if run it no it's usually okay let's try can you run it okay yeah it's okay why it's not output anything here but this time it's not output anything you know the unique thing right yeah try to run just run just run no because that's one is it's not it's not detected anything okay yeah yeah because there's no there's no class yeah let me see this this is okay correct already yeah okay a bit difficult to say because that's not initially when I download all the dependencies it was on the can you try to run the composer no it's okay oh no no can you make this part right table yeah try okay so is this can you run it okay good anybody here have problem running it how to run the test again once again okay just vendor been ppunit yeah vendor the top yeah been ppunit yeah that's all just run it okay like let me check let me check you don't have a pp exam so you need put on the root folder oh yeah just drag it to the root folder yes okay now you can try to run it okay like 13 no comma semi comma yeah no in the source file did a test file so it should be here see no comma okay can't run you know like 10 son is still more like 9 can you go back can you go back you know okay you need to use import class give me angle back to the use statement castle line yes symphony component Dom Kronler Kronler yeah yeah just run it there you go okay no no no you go to this one yeah go to this yes and you copy the whole line open on the web browser even any web browser can do okay and then if we ask you to look in and we display a token for you you copy that token here no cannot you have to it because for security reason yeah I think because many people here download from the gift just it's similar like a recapture yes correct what is this have you tried to install the Composer package this one window I am not sure this is the first test this one okay good can you follow okay you guys can follow it can run the test right I cannot run the test okay test excuse test excuse that's so strange so strange right do you want to sit no it's okay quite strange yeah currently the topic is testing no dependency injection yes yeah but this one is the testing to make sure the code is running fine first yes after that I'll tell you some more yes we are going to we're going to eat now I don't really understand why yes so basically are you edit from here right okay and I'm using kp storm source 24 don't need this yeah you got welcome this one I'm not sure you have to install how do you how you install the sequin can you run the sequin installation again I think haven't installed because it is to be in no I mean no I install the sequin not this one from here right how do you install it I'm not sure previously it's not here so yeah try to ask the lady because I'm not sure about this but sorry are you running yes okay okay this one right first color symphony color conference where is this I think you're putting the wrong one but you need to copy this line under conference you can just run vendor okay okay cannot I think it's related to japan missions test conference I think it's good to the conference it's cannot rate it render try to run in a composite install again just remove the whole vendor okay so you run the composite install again right okay great no it should be the same see it's still running not getting anything no this one is because you run pdp not sure about this composer is running fine can you have him on this one he run the pdp you need but nothing happened at all but if you run hyphen version display something so that means the library is still running actually do this log file right because you run pdp and then inside vendor hyphen version try have pdp pdp nothing it should display something even if the code there is something wrong with code you still display something right no I think this line is wrong in array so have a name let me try to help you how do you say how to escape escape sorry use a name because of that syntax doesn't display anything at all but you have some idea already somewhere else this one is now damn fast explain test content I think there is something wrong with the code so there is some error syntax just now damn fast body it still display something already still have some error but everything look fine copy from me we don't have any other file but there is another one in source of 2 files okay done probably I think it is a syntax issue but if you run it is not for any test maybe it is some permission issue so basically if you put a specific file it can run so leave it like this first ah no need I just have to have the full path so that means I need the full path just leave it for now first I think you haven't installed SSL try to how to install okay guys let's continue we have a problem with our test what we are doing is we find a way to mark the connection so basically the next version I call this version 2 I will do a different with the previous version in previous version we need client ATTP client and also the DOM crawler now I put this dependency in the constructor of the class can see now basically I put this 2 dependency in the constructor so later if I initiate the object of this class I can pass in the client and the crawler as a dependency and before passing I can mark the object mark the ATTP client so we don't have to send the actual request over internet at all I will install these 2 objects as a protected property of the class so I can use later next I will copy this code from version 1 to version 2 and I will modify it so from here we already have a client and crawler we don't need to initiate the object inside this method any more so now we will write the test for this one to make sure that this change work if I am going too fast you cannot feel free to interrupt me so you guys have some time to follow it now what I am doing is I create the test for this file for version 2 so the structure of this test we have a conference object as a protected object in order to reuse this we have a setup to initiate the object of the class and we have a test to actually run the test for our code so I will write the test first and we will come up with own the dependency later so basically what we want to test is make sure that this name is inside the array and here we see that the name is not defined so we will get the result by calling the conference method it's good for now but the conference object is not initiated yet we need to do it in the setup method so in order to initiate the we need to pass in the client and the crawler object so basically what we are doing now is like we initiate the object outside of our class and pass in the object into the constructor I guess this one will work and I am going to run the test now to see if it actually work or not yes both test version 1 or version 2 are working but let's see if I turn off the Wi-Fi what happen both fail you see we have 2 errors here so actually the version 2 haven't made any changes what I am doing now is I will mock the HTTP connection so we don't rely on the internet anymore so PEP unit give us the ability to mock object of a class by using this method get mock builder and we pass in the class name inside and we want to mock only method request why is only method request because inside our code this is the client only code a request and this request will return a response object so once I mock the request object request method like this I need to this is just declaration that I want to mock but I need to write the mock explicitly so client so I expected the request method will run once on the client object and it will return the mock response object but we haven't defied the mock response object yes so we need to defy it before this client here we have 2 method need to be mock the first one is get body and the second one is get contents because I know that the response object need to have some data in the constructor but I don't want to create the data of that so I just ignore the construction the mocking is still running fine since we defy 2 method to mock here we need to declare the mock for these 2 methods so here is the thing happen we don't actually get the content of the page but we know that we want to look for the hash for tag inside the object L1 so we will build a structure similar like this so what I'm doing now is I build a structure html structure I push this guy inside so what this do is like instead of running an actual request to a html server it will return a mock data and our code will run on top of mock data so since this client is a mock it's better if we rename it as mock client instead of client so now instead of passing into the constructor actual client we pass the mock client so when we code this method this one we run this line and this line instead of actually connect to this html it doesn't connect to anything at all but it still return a data for the below code to be run the data is defined here and our code will run on top of this data the crawler will try to find own the name inside the hash for tag inside the object L1 class I guess it will work and let's try you see my wifi connection is still off so what I guess is one test fail one test pass the first one you fail the second one we pass we have two test one error and you see all the error is coming from the first one because there is no connection so if I enable the connection now both test will run and pass so by moving the object inside the method body to the constructor on the dependency to the constructor we abstract the dependency and later we can inject it whatever we want it make our code is loosely coupled and also testable I think I need some more time to talk because we haven't stopped here yet for example this is library but when we go to the website we type the URL on the website the URL will go to the router and the router will find what is controller and what is action for that one the router will be run the controller class will be initiated and then it will pass the dependency into the controller on another framework is done already but we don't know what is happened behind and where is the dependency is stored in the framework so the one who stores the dependency in the framework the code dependency injection containers or DI containers from here I don't actually write the routing but I write a very simple script to dynamically map the request to the controller I create a new file called index one index one we use the version one I will show you the two ways for inject the dependency into the controller the first thing I need to include the autoloader file so on the file we download before we will be used and can be used in our system I need to increase what I'm going to do is I'm going to write some scripts so I can run something like this pp index one dot pp and I put the conference one and action is speaker I will run something like this later and we need to get two arguments in order to run our controller just forget this one first first argument is here indicate the controller class the second one is indicate the controller action and once we get the controller class we initiate the object of that controller and we call the action like this so basically this is very simple mapping with our code to controller but the thing is we haven't write any controller class yet we only write the conference class which is library only now I'm starting write the controller to serve the request I create a directory called controller this one is namespace as well inside controller my common bare practice is like I have an abstract class or I have a class interface so all the there will be a if we have a common things between the class we can put in the abstract class to share the code so we don't have to repeat and rewrite the code anymore this abstract this abstract class do nothing at all because we don't have any common we don't have any share or maybe we won't have but just leave it like this because like our application is not so simple like this for the long run it will have a common code I will write the first controller I call it conference once and this one will extend the abstract controller we just created it few seconds ago and inside here we have a method called speakers so here we have here and once we run this command we try to map this request to our controller so from here I just output something like I return pp for example I put here fuba is very common things and I expected I will get this string output to our my console our controller conference one not found ok you see the error is like the class is not found because our autoloader this file is created after our autoloader file is created so we need to recreate the autoloader file in order to do that we can run the composer install again it will not download again but it just recreate the autoloader file it's just regenerating the autoloader files our controller one is size ok yes correct correct my type of sorry the string is outputted so our routing is working it's very simple routing but here we want to get actually the name so what do we do here we initiate the conference and we call the method list speaker and then we expected we have a list of speakers as we seen before see it's outputted here so everything is working fine but already says we don't want to have this we don't want to have a construct the initiation of the object inside our code so we wanted to move it to our constructor so I will create a constructor here I will create a protected property to store the constructor object and from here I just reuse it everything look fine here and do you think it will run I will try no sorry because in order in our routing we initiate the controller and why initiating the controller we don't pass any agreement to the constructor that's why argument one none given so how you given it one of the thing is like we automated the process because a simple thing here in the index file we can initiate the conference class here and put passes in the thing is like how about another controller the argument is very dynamically we cannot put everything here so what we doing is we use the reflection class to get on the argument and for each argument we initiate the object for the argument and we pass it into the controller and create a right dependency to store on the dependency of this class for each parameter I will get the class name for it and then I will initiate the object for this parameter and I put it in the dependency array and now we cannot use something like this anymore we will use the reflection class to initiate the object for you so this method we create a new instance with the arguments the argument will pass into the constructor and the argument is arrays as we have here so this one we try dynamically find out what is the parameter of the constructor for this class and we automatically create the object for this class and automatically pass that parameter into the controller construction I guess it should work here now it should work let's see so later if we have more dependency we can automatically inject into our controller we can modify our routing but this one has limitation the parameter class should not have any parameter as well so if this one has another parameter and the parameter requires another parameter we have a graph of dependencies so there is some library already written for that I am not writing here but if you want I can recommend later just contact me I will let you know but this is a very simple way to demonstrate how you can automatically inject the dependency into our controller and then form our controller so you can have fully do whatever we want the last one I want to introduce is version 2 of this method how we inject the controller as how we inject the dependency into our controller I will run similar like this but I will create another file called index2 another controller called conference2 with the same action what I am doing is exactly almost the same I copy this file first from here I have a class name this one I will use the DI container to inject the dependency into our controller from here I register a conference and this container we manage on the dependency and we will get dependency dynamically in our code from now I will create a new version of controller exactly like before instead of I store the conference I will store the dependency here inside here and inside the action I will try to get my dependency from the container so this is the ID of the dependency this ID have to match the ID we defined before inside here and from here we will use the dependency we just get okay but let's run this one first to see if it works I guess no but I need to create a controller object here and the controller need to have a container as the parameter for constructor so I pass the container here yeah so let's run it okay here we come to another issue the issue here is we create the conference object already but our conference object requires two parameter client and controller but client we haven't passed the client or controller to this class so that's why this one not given that's why it's true it's wrong now we need to define the dependency and pass into the conference class we can define inside here we register a client and we register the controller and now we add argument to this and we add the second argument for controller now this one should work because own dependency is resolved so this is how DI container works we register own our dependency inside the container and it up to our controller to get whatever it need so by doing like this you don't have to specify the dependency in the constructor of the controller because who know later if we have a new method we need another dependency and some controller have like 10 or 20 method and we have 10 or 20 dependency or even more the constructor will be very big so by using the container the dependency of this controller is only the container and it's method it action it will get the dependency as it needed from the container so by using like this the code will look very cleaner in some framework like Laravel or symphony for Laravel you can define own list of dependency inside I'm not sure it's the provider app service provider and in symphony you can define all of this dependency in the config also service.jamlify I put it here because I just want to make it very simple for us to follow what is the magic inside the framework how they map the URL to our controller the basic thing is like this we will have a more thing like authentication login or catching or something like that but basically it's like this I think I'm done for the dependency injection now anybody have a question to recap this one when you write a code think about the dependency think about how you organize the dependency to inject the dependency into our class you can do it automatically like what Laravel is doing I like it somehow but sometimes I prefer the symphony way to have a container so I just pass the container inside the controller I can use whatever I want I don't have to declare multiple dependencies in my method it have a cross and con but remember try to follow the dependency injection and one more thing you can improve from here is like instead of depends on concreted class you can depend on interface but the thing is like it's not easy to initiate the object for interface here because you cannot create object for interface there is a way to do that by you can do alias like you map for this round you map the conference interface with a concreted class for version 1 or version 2 it's up to you but it's a bit complex so I don't want to introduce it here and by using the dependency we can easily swap the object we can easily test it by making our class decoupling to each other we can easily extend it add more features and we replace for example instead of you don't have to worry about if you use Bicycle or Mongo or Postgres DB you just write abstract class for that or interface for that first and we inject it later so do think about the dependency injection before you start writing your code thank you for listening