Commit 66eb8519 authored by Josh Pollock's avatar Josh Pollock
Browse files

use ServiceContainer interface to type hint the Service Container in Providers

parent e8143907
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="39e46151-e7c1-422c-b495-7bbe1c526bbf" name="Default" comment=""> <list default="true" id="39e46151-e7c1-422c-b495-7bbe1c526bbf" name="Default" comment="">
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/README.MD" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/Container.php" afterPath="$PROJECT_DIR$/src/Container.php" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/Interfaces/ProvidesService.php" afterPath="$PROJECT_DIR$/src/Interfaces/ProvidesService.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/Service/Container.php" afterPath="$PROJECT_DIR$/src/Service/Container.php" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" /> <option name="TRACKING_ENABLED" value="true" />
...@@ -19,18 +19,18 @@ ...@@ -19,18 +19,18 @@
<entry file="file://$PROJECT_DIR$/Tests/bootstrap.php"> <entry file="file://$PROJECT_DIR$/Tests/bootstrap.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300"> <state relative-caret-position="300">
<caret line="20" column="0" lean-forward="true" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" /> <caret line="20" column="0" lean-forward="false" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="README.MD" pinned="false" current-in-tab="true"> <file leaf-file-name="README.MD" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/README.MD"> <entry file="file://$PROJECT_DIR$/README.MD">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]"> <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT"> <state split_layout="SPLIT">
<first_editor relative-caret-position="225"> <first_editor relative-caret-position="210">
<caret line="15" column="26" lean-forward="false" selection-start-line="15" selection-start-column="26" selection-end-line="15" selection-end-column="26" /> <caret line="14" column="7" lean-forward="true" selection-start-line="14" selection-start-column="7" selection-end-line="14" selection-end-column="7" />
<folding /> <folding />
</first_editor> </first_editor>
<second_editor /> <second_editor />
...@@ -38,16 +38,50 @@ ...@@ -38,16 +38,50 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="Container.php" pinned="false" current-in-tab="false"> <file leaf-file-name="composer.json" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/composer.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="210">
<caret line="14" column="35" lean-forward="false" selection-start-line="14" selection-start-column="35" selection-end-line="14" selection-end-column="35" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Container.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/Service/Container.php"> <entry file="file://$PROJECT_DIR$/src/Service/Container.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45"> <state relative-caret-position="240">
<caret line="3" column="45" lean-forward="false" selection-start-line="3" selection-start-column="10" selection-end-line="3" selection-end-column="45" /> <caret line="17" column="43" lean-forward="false" selection-start-line="17" selection-start-column="43" selection-end-line="17" selection-end-column="43" />
<folding>
<element signature="e#56#115#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="ProvidesService.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Interfaces/ProvidesService.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="60">
<caret line="4" column="0" lean-forward="true" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="ServiceContainer.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Interfaces/ServiceContainer.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="10" column="26" lean-forward="false" selection-start-line="10" selection-start-column="10" selection-end-line="10" selection-end-column="26" />
<folding>
<marker date="1522954779441" expanded="true" signature="182:933" ph="{...}" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="NotFoundException.php" pinned="false" current-in-tab="false"> <file leaf-file-name="NotFoundException.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Exceptions/NotFoundException.php"> <entry file="file://$PROJECT_DIR$/src/Exceptions/NotFoundException.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
...@@ -81,7 +115,6 @@ ...@@ -81,7 +115,6 @@
<option value="$PROJECT_DIR$/src/Interfaces/Arrayable.php" /> <option value="$PROJECT_DIR$/src/Interfaces/Arrayable.php" />
<option value="$PROJECT_DIR$/src/Interfaces/JsonArrayable.php" /> <option value="$PROJECT_DIR$/src/Interfaces/JsonArrayable.php" />
<option value="$PROJECT_DIR$/src/Interfaces/ContainsServices.php" /> <option value="$PROJECT_DIR$/src/Interfaces/ContainsServices.php" />
<option value="$PROJECT_DIR$/src/Service/Container.php" />
<option value="$PROJECT_DIR$/src/Interfaces/ServiceContainer.php" /> <option value="$PROJECT_DIR$/src/Interfaces/ServiceContainer.php" />
<option value="$PROJECT_DIR$/src/Support/Arr.php" /> <option value="$PROJECT_DIR$/src/Support/Arr.php" />
<option value="$PROJECT_DIR$/Tests/Mocks/Container.php" /> <option value="$PROJECT_DIR$/Tests/Mocks/Container.php" />
...@@ -92,13 +125,14 @@ ...@@ -92,13 +125,14 @@
<option value="$PROJECT_DIR$/Tests/Mocks/Something.php" /> <option value="$PROJECT_DIR$/Tests/Mocks/Something.php" />
<option value="$PROJECT_DIR$/Tests/ContainerTest.php" /> <option value="$PROJECT_DIR$/Tests/ContainerTest.php" />
<option value="$PROJECT_DIR$/Tests/Mocks/SomethingElse.php" /> <option value="$PROJECT_DIR$/Tests/Mocks/SomethingElse.php" />
<option value="$PROJECT_DIR$/src/Interfaces/ProvidesService.php" />
<option value="$PROJECT_DIR$/Tests/ServiceServiceContainerTest.php" /> <option value="$PROJECT_DIR$/Tests/ServiceServiceContainerTest.php" />
<option value="$PROJECT_DIR$/src/ControlledContainer.php" /> <option value="$PROJECT_DIR$/src/ControlledContainer.php" />
<option value="$PROJECT_DIR$/src/Exceptions/NotFoundException.php" /> <option value="$PROJECT_DIR$/src/Exceptions/NotFoundException.php" />
<option value="$PROJECT_DIR$/src/Exceptions/Exception.php" /> <option value="$PROJECT_DIR$/src/Exceptions/Exception.php" />
<option value="$PROJECT_DIR$/src/Container.php" /> <option value="$PROJECT_DIR$/src/Container.php" />
<option value="$PROJECT_DIR$/README.MD" /> <option value="$PROJECT_DIR$/README.MD" />
<option value="$PROJECT_DIR$/src/Service/Container.php" />
<option value="$PROJECT_DIR$/src/Interfaces/ProvidesService.php" />
</list> </list>
</option> </option>
</component> </component>
...@@ -145,6 +179,12 @@ ...@@ -145,6 +179,12 @@
<item name="caldera-container" type="2a2b976b:PhpTreeStructureProvider$1" /> <item name="caldera-container" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="src" type="2a2b976b:PhpTreeStructureProvider$1" /> <item name="src" type="2a2b976b:PhpTreeStructureProvider$1" />
</path> </path>
<path>
<item name="caldera-container" type="b2602c69:ProjectViewProjectNode" />
<item name="caldera-container" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="src" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="Interfaces" type="2a2b976b:PhpTreeStructureProvider$1" />
</path>
<path> <path>
<item name="caldera-container" type="b2602c69:ProjectViewProjectNode" /> <item name="caldera-container" type="b2602c69:ProjectViewProjectNode" />
<item name="caldera-container" type="2a2b976b:PhpTreeStructureProvider$1" /> <item name="caldera-container" type="2a2b976b:PhpTreeStructureProvider$1" />
...@@ -194,12 +234,12 @@ ...@@ -194,12 +234,12 @@
<option name="number" value="Default" /> <option name="number" value="Default" />
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1522953897768</updated> <updated>1522953897768</updated>
<workItem from="1522953898944" duration="2319000" /> <workItem from="1522953898944" duration="2929000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="2319000" /> <option name="totallyTimeSpent" value="2929000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="618" y="22" width="1296" height="1007" extended-state="0" /> <frame x="618" y="22" width="1296" height="1007" extended-state="0" />
...@@ -283,16 +323,6 @@ ...@@ -283,16 +323,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/Interfaces/ServiceContainer.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="2" lean-forward="false" selection-start-line="7" selection-start-column="2" selection-end-line="7" selection-end-column="2" />
<folding>
<marker date="1522954779441" expanded="true" signature="182:933" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Support/Arr.php"> <entry file="file://$PROJECT_DIR$/src/Support/Arr.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150"> <state relative-caret-position="150">
...@@ -309,14 +339,6 @@ ...@@ -309,14 +339,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/composer.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="420">
<caret line="28" column="44" lean-forward="false" selection-start-line="28" selection-start-column="44" selection-end-line="28" selection-end-column="44" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Service/Factory.php"> <entry file="file://$PROJECT_DIR$/src/Service/Factory.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0"> <state relative-caret-position="0">
...@@ -365,18 +387,6 @@ ...@@ -365,18 +387,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/Interfaces/ProvidesService.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="270">
<caret line="18" column="23" lean-forward="false" selection-start-line="18" selection-start-column="23" selection-end-line="18" selection-end-column="23" />
<folding>
<marker date="1522955420122" expanded="true" signature="106:198" ph=" Interface ProvidesService ..." />
<marker date="1522955420122" expanded="true" signature="226:354" ph="{...}" />
<marker date="1522955420122" expanded="true" signature="233:294" ph=" Register provider ..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Tests/ServiceServiceContainerTest.php"> <entry file="file://$PROJECT_DIR$/Tests/ServiceServiceContainerTest.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="400"> <state relative-caret-position="400">
...@@ -444,7 +454,7 @@ ...@@ -444,7 +454,7 @@
<entry file="file://$PROJECT_DIR$/Tests/bootstrap.php"> <entry file="file://$PROJECT_DIR$/Tests/bootstrap.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300"> <state relative-caret-position="300">
<caret line="20" column="0" lean-forward="true" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" /> <caret line="20" column="0" lean-forward="false" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
<folding /> <folding />
</state> </state>
</provider> </provider>
...@@ -467,10 +477,10 @@ ...@@ -467,10 +477,10 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/Service/Container.php"> <entry file="file://$PROJECT_DIR$/composer.json">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45"> <state relative-caret-position="210">
<caret line="3" column="45" lean-forward="false" selection-start-line="3" selection-start-column="10" selection-end-line="3" selection-end-column="45" /> <caret line="14" column="35" lean-forward="false" selection-start-line="14" selection-start-column="35" selection-end-line="14" selection-end-column="35" />
<folding /> <folding />
</state> </state>
</provider> </provider>
...@@ -478,13 +488,41 @@ ...@@ -478,13 +488,41 @@
<entry file="file://$PROJECT_DIR$/README.MD"> <entry file="file://$PROJECT_DIR$/README.MD">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]"> <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT"> <state split_layout="SPLIT">
<first_editor relative-caret-position="225"> <first_editor relative-caret-position="210">
<caret line="15" column="26" lean-forward="false" selection-start-line="15" selection-start-column="26" selection-end-line="15" selection-end-column="26" /> <caret line="14" column="7" lean-forward="true" selection-start-line="14" selection-start-column="7" selection-end-line="14" selection-end-column="7" />
<folding /> <folding />
</first_editor> </first_editor>
<second_editor /> <second_editor />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/Interfaces/ServiceContainer.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="10" column="26" lean-forward="false" selection-start-line="10" selection-start-column="10" selection-end-line="10" selection-end-column="26" />
<folding>
<marker date="1522954779441" expanded="true" signature="182:933" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Interfaces/ProvidesService.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="60">
<caret line="4" column="0" lean-forward="true" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Service/Container.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="17" column="43" lean-forward="false" selection-start-line="17" selection-start-column="43" selection-end-line="17" selection-end-column="43" />
<folding>
<element signature="e#56#115#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component> </component>
</project> </project>
\ No newline at end of file
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
namespace calderawp\CalderaContainers\Interfaces; namespace calderawp\CalderaContainers\Interfaces;
use calderawp\CalderaContainers\Container;
/** /**
* Interface ProvidesService * Interface ProvidesService
* *
...@@ -16,7 +14,7 @@ interface ProvidesService ...@@ -16,7 +14,7 @@ interface ProvidesService
/** /**
* Register provider * Register provider
* *
* @param Container $container * @param ServiceContainer $container
*/ */
public function registerService(Container $container); public function registerService(ServiceContainer $container);
} }
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
namespace calderawp\CalderaContainers\Service; namespace calderawp\CalderaContainers\Service;
use calderawp\CalderaContainers\Interfaces\ProvidesService; use calderawp\CalderaContainers\Interfaces\ProvidesService;
use calderawp\CalderaContainers\Interfaces\ServiceContainer;
/** /**
* Class Container * Class Container
...@@ -14,7 +15,7 @@ use calderawp\CalderaContainers\Interfaces\ProvidesService; ...@@ -14,7 +15,7 @@ use calderawp\CalderaContainers\Interfaces\ProvidesService;
* Cool plugin for managin plugin/ theme installs with git. * Cool plugin for managin plugin/ theme installs with git.
* -> https://wppusher.com/ * -> https://wppusher.com/
*/ */
class Container class Container implements ServiceContainer
{ {
/** /**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment