Commit 9b17f88d authored by Josh Pollock's avatar Josh Pollock
Browse files

Added lazy-loaded singletons

parent ec7f9876
......@@ -3,7 +3,8 @@
<component name="ChangeListManager">
<list default="true" id="39e46151-e7c1-422c-b495-7bbe1c526bbf" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/Interfaces/ProvidesService.php" afterPath="$PROJECT_DIR$/src/Interfaces/ProvidesService.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/Tests/ServiceServiceContainerTest.php" afterPath="$PROJECT_DIR$/Tests/ServiceServiceContainerTest.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/composer.json" afterPath="$PROJECT_DIR$/composer.json" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/Service/Container.php" afterPath="$PROJECT_DIR$/src/Service/Container.php" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
......@@ -14,7 +15,7 @@
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileEditorManager">
<leaf>
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="bootstrap.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Tests/bootstrap.php">
<provider selected="true" editor-type-id="text-editor">
......@@ -30,7 +31,7 @@
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="210">
<caret line="14" column="7" lean-forward="true" selection-start-line="14" selection-start-column="7" selection-end-line="14" selection-end-column="7" />
<caret line="14" column="7" lean-forward="false" selection-start-line="14" selection-start-column="7" selection-end-line="14" selection-end-column="7" />
<folding />
</first_editor>
<second_editor />
......@@ -41,8 +42,8 @@
<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" />
<state relative-caret-position="191">
<caret line="28" column="35" lean-forward="false" selection-start-line="28" selection-start-column="35" selection-end-line="28" selection-end-column="35" />
<folding />
</state>
</provider>
......@@ -51,8 +52,8 @@
<file leaf-file-name="Container.php" pinned="false" current-in-tab="true">
<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" />
<state relative-caret-position="37">
<caret line="23" column="37" lean-forward="false" selection-start-line="23" selection-start-column="37" selection-end-line="23" selection-end-column="37" />
<folding>
<element signature="e#56#115#0#PHP" expanded="true" />
</folding>
......@@ -60,11 +61,21 @@
</provider>
</entry>
</file>
<file leaf-file-name="ServiceServiceContainerTest.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Tests/ServiceServiceContainerTest.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="286">
<caret line="94" column="25" lean-forward="false" selection-start-line="94" selection-start-column="25" selection-end-line="94" selection-end-column="25" />
<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" />
<caret line="4" column="0" lean-forward="false" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
<folding />
</state>
</provider>
......@@ -73,11 +84,9 @@
<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">
<state relative-caret-position="150">
<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>
<folding />
</state>
</provider>
</entry>
......@@ -119,20 +128,20 @@
<option value="$PROJECT_DIR$/src/Support/Arr.php" />
<option value="$PROJECT_DIR$/Tests/Mocks/Container.php" />
<option value="$PROJECT_DIR$/Tests/bootstrap.php" />
<option value="$PROJECT_DIR$/composer.json" />
<option value="$PROJECT_DIR$/src/Exceptions/ContainerException.php" />
<option value="$PROJECT_DIR$/src/Exceptions/NotImplemented.php" />
<option value="$PROJECT_DIR$/Tests/Mocks/Something.php" />
<option value="$PROJECT_DIR$/Tests/ContainerTest.php" />
<option value="$PROJECT_DIR$/Tests/Mocks/SomethingElse.php" />
<option value="$PROJECT_DIR$/Tests/ServiceServiceContainerTest.php" />
<option value="$PROJECT_DIR$/src/ControlledContainer.php" />
<option value="$PROJECT_DIR$/src/Exceptions/NotFoundException.php" />
<option value="$PROJECT_DIR$/src/Exceptions/Exception.php" />
<option value="$PROJECT_DIR$/src/Container.php" />
<option value="$PROJECT_DIR$/README.MD" />
<option value="$PROJECT_DIR$/src/Service/Container.php" />
<option value="$PROJECT_DIR$/src/Interfaces/ProvidesService.php" />
<option value="$PROJECT_DIR$/composer.json" />
<option value="$PROJECT_DIR$/Tests/ServiceServiceContainerTest.php" />
<option value="$PROJECT_DIR$/src/Service/Container.php" />
</list>
</option>
</component>
......@@ -144,10 +153,10 @@
</component>
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
<component name="ProjectFrameBounds">
<option name="x" value="618" />
<option name="x" value="144" />
<option name="y" value="22" />
<option name="width" value="1296" />
<option name="height" value="1007" />
<option name="height" value="878" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
<ConfirmationsSetting value="2" id="Add" />
......@@ -171,25 +180,13 @@
<subPane>
<expand>
<path>
<item name="caldera-container" type="b2602c69:ProjectViewProjectNode" />
<item name="caldera-container" type="2a2b976b:PhpTreeStructureProvider$1" />
</path>
<path>
<item name="caldera-container" type="b2602c69:ProjectViewProjectNode" />
<item name="caldera-container" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="src" type="2a2b976b:PhpTreeStructureProvider$1" />
</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" />
<item name="caldera-containers" type="b2602c69:ProjectViewProjectNode" />
<item name="caldera-containers" type="2a2b976b:PhpTreeStructureProvider$1" />
</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="Service" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="caldera-containers" type="b2602c69:ProjectViewProjectNode" />
<item name="caldera-containers" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="Tests" type="2a2b976b:PhpTreeStructureProvider$1" />
</path>
</expand>
<select />
......@@ -235,32 +232,33 @@
<option name="presentableId" value="Default" />
<updated>1522953897768</updated>
<workItem from="1522953898944" duration="2929000" />
<workItem from="1525558486917" duration="552000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="2929000" />
<option name="totallyTimeSpent" value="3481000" />
</component>
<component name="ToolWindowManager">
<frame x="618" y="22" width="1296" height="1007" extended-state="0" />
<frame x="144" y="22" width="1296" height="878" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3141946" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.16666667" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32894737" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32894737" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32822478" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32894737" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
</component>
......@@ -275,94 +273,109 @@
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/meta.json">
<entry file="file://$PROJECT_DIR$/Tests/bootstrap.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<state relative-caret-position="300">
<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 />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Tests/TestCase.php">
<entry file="file://$PROJECT_DIR$/composer.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="24" lean-forward="false" selection-start-line="2" selection-start-column="24" selection-end-line="2" selection-end-column="24" />
<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>
<entry file="file://$PROJECT_DIR$/src/Providers/EntityProvider.php">
<entry file="file://$PROJECT_DIR$/README.MD">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="210">
<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 />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Interfaces/ProvidesService.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="210">
<caret line="22" column="45" lean-forward="false" selection-start-line="22" selection-start-column="45" selection-end-line="22" selection-end-column="45" />
<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/Interfaces/CollectionFactory.php">
<entry file="file://$PROJECT_DIR$/src/Interfaces/ServiceContainer.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<state relative-caret-position="150">
<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 />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Interfaces/JsonArrayable.php">
<entry file="file://$PROJECT_DIR$/src/Exceptions/NotFoundException.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="10" column="106" lean-forward="false" selection-start-line="10" selection-start-column="106" selection-end-line="10" selection-end-column="106" />
<caret line="10" column="53" lean-forward="false" selection-start-line="10" selection-start-column="53" selection-end-line="10" selection-end-column="53" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Interfaces/ContainsServices.php">
<entry file="file://$PROJECT_DIR$/src/Service/Container.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="195">
<caret line="13" column="1" lean-forward="false" selection-start-line="13" selection-start-column="1" selection-end-line="13" selection-end-column="1" />
<folding />
<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>
<entry file="file://$PROJECT_DIR$/src/Support/Arr.php">
<entry file="file://$PROJECT_DIR$/meta.json" />
<entry file="file://$PROJECT_DIR$/Tests/TestCase.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="10" column="0" lean-forward="false" selection-start-line="10" selection-start-column="0" selection-end-line="10" selection-end-column="0" />
<state relative-caret-position="30">
<caret line="2" column="24" lean-forward="false" selection-start-line="2" selection-start-column="24" selection-end-line="2" selection-end-column="24" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Tests/Mocks/Container.php">
<entry file="file://$PROJECT_DIR$/src/Providers/EntityProvider.php" />
<entry file="file://$PROJECT_DIR$/src/Interfaces/CollectionFactory.php" />
<entry file="file://$PROJECT_DIR$/src/Interfaces/JsonArrayable.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="62" lean-forward="false" selection-start-line="7" selection-start-column="62" selection-end-line="7" selection-end-column="62" />
<folding />
<state relative-caret-position="150">
<caret line="10" column="106" lean-forward="false" selection-start-line="10" selection-start-column="106" selection-end-line="10" selection-end-column="106" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Service/Factory.php">
<entry file="file://$PROJECT_DIR$/src/Interfaces/ContainsServices.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
<state relative-caret-position="195">
<caret line="13" column="1" lean-forward="false" selection-start-line="13" selection-start-column="1" selection-end-line="13" selection-end-column="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Interfaces/Arrayable.php">
<entry file="file://$PROJECT_DIR$/src/Support/Arr.php" />
<entry file="file://$PROJECT_DIR$/Tests/Mocks/Container.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45">
<caret line="3" column="24" lean-forward="false" selection-start-line="3" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
<folding />
<state relative-caret-position="105">
<caret line="7" column="62" lean-forward="false" selection-start-line="7" selection-start-column="62" selection-end-line="7" selection-end-column="62" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Tests/ServiceFactoryTest.php">
<entry file="file://$PROJECT_DIR$/src/Service/Factory.php" />
<entry file="file://$PROJECT_DIR$/src/Interfaces/Arrayable.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
<state relative-caret-position="45">
<caret line="3" column="24" lean-forward="false" selection-start-line="3" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Tests/ServiceFactoryTest.php" />
<entry file="file://$PROJECT_DIR$/Tests/Mocks/Something.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
......@@ -375,7 +388,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="280">
<caret line="49" column="45" lean-forward="false" selection-start-line="49" selection-start-column="45" selection-end-line="49" selection-end-column="45" />
<folding />
</state>
</provider>
</entry>
......@@ -383,15 +395,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="9" column="17" lean-forward="false" selection-start-line="9" selection-start-column="17" selection-end-line="9" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Tests/ServiceServiceContainerTest.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="400">
<caret line="83" column="5" lean-forward="false" selection-start-line="83" selection-start-column="5" selection-end-line="83" selection-end-column="5" />
<folding />
</state>
</provider>
</entry>
......@@ -399,7 +402,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="59">
<caret line="258" column="6" lean-forward="false" selection-start-line="258" selection-start-column="6" selection-end-line="258" selection-end-column="6" />
<folding />
</state>
</provider>
</entry>
......@@ -415,7 +417,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="210">
<caret line="14" column="0" lean-forward="true" selection-start-line="14" selection-start-column="0" selection-end-line="14" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
......@@ -423,31 +424,15 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="10" column="91" lean-forward="false" selection-start-line="10" selection-start-column="91" selection-end-line="10" selection-end-column="91" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vendor/psr/container/src/ContainerExceptionInterface.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="10" column="37" lean-forward="false" selection-start-line="10" selection-start-column="10" selection-end-line="10" selection-end-column="37" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vendor/psr/container/src/ContainerInterface.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="18" column="36" lean-forward="true" selection-start-line="18" selection-start-column="36" selection-end-line="18" selection-end-column="36" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vendor/psr/container/src/ContainerExceptionInterface.php" />
<entry file="file://$PROJECT_DIR$/vendor/psr/container/src/ContainerInterface.php" />
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
......@@ -463,9 +448,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="225">
<caret line="15" column="53" lean-forward="false" selection-start-line="15" selection-start-column="37" selection-end-line="15" selection-end-column="53" />
<folding>
<element signature="e#47#108#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
......@@ -473,15 +455,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="165">
<caret line="11" column="34" lean-forward="false" selection-start-line="11" selection-start-column="15" selection-end-line="11" selection-end-column="34" />
<folding />
</state>
</provider>
</entry>
<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>
......@@ -489,7 +462,7 @@
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="210">
<caret line="14" column="7" lean-forward="true" selection-start-line="14" selection-start-column="7" selection-end-line="14" selection-end-column="7" />
<caret line="14" column="7" lean-forward="false" selection-start-line="14" selection-start-column="7" selection-end-line="14" selection-end-column="7" />
<folding />
</first_editor>
<second_editor />
......@@ -498,26 +471,40 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/Interfaces/ServiceContainer.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<state relative-caret-position="150">
<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>
<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" />
<caret line="4" column="0" lean-forward="false" 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$/composer.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="191">
<caret line="28" column="35" lean-forward="false" selection-start-line="28" selection-start-column="35" selection-end-line="28" selection-end-column="35" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Tests/ServiceServiceContainerTest.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="286">
<caret line="94" column="25" lean-forward="false" selection-start-line="94" selection-start-column="25" selection-end-line="94" selection-end-column="25" />
<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" />
<state relative-caret-position="37">
<caret line="23" column="37" lean-forward="false" selection-start-line="23" selection-start-column="37" selection-end-line="23" selection-end-column="37" />
<folding>
<element signature="e#56#115#0#PHP" expanded="true" />
</folding>
......
......@@ -80,6 +80,19 @@ class ServiceContainerTest extends TestCase
$container->singleton( $classRef, new \calderawp\CalderaContainers\Tests\Mocks\Something());
$this->assertSame( $container->make($classRef), $container->make($classRef));
}
}
/**
* Test that we can use a function to create a lazy-loaded singleton
*/
public function testLazySingleton()
{
$container = new \calderawp\CalderaContainers\Service\Container();
$container->singleton( 'X', function (){
$x = new stdClass();
$x->sivan = 'Roy';
return $x;
});
$this->assertSame( $container->make('X'), $container->make('X' ) );
}
}
\ No newline at end of file
{
"name": "calderawp/caldera-containers",
"type": "libary",
"license": "GPL-2.0",
"authors": [
{
"name": "josh",
"email": "josh@calderawp.com"
}
],
"minimum-stability": "dev",
"require": {
"php": "^5.6|^7.0",
"pimple/pimple": "^3.2",
"psr/container": "^1.0@dev"
},
"name": "calderawp/caldera-containers",
"type": "libary",
"license": "GPL-2.0",
"authors": [
{
"name": "josh",
"email": "josh@calderawp.com"
}
],
"minimum-stability": "dev",
"require": {
"php": "^5.6|^7.0",
"pimple/pimple": "^3.2",
"psr/container": "^1.0@dev"
},
"autoload": {
"psr-4": {
"calderawp\\CalderaContainers\\": "src"
}
},
"require-dev": {
"phpunit/phpunit": "5.0.*",
"squizlabs/php_codesniffer": "^3.2",
"jakub-onderka/php-parallel-lint": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "5.0.*",
"squizlabs/php_codesniffer": "^3.2",
"jakub-onderka/php-parallel-lint": "^1.0"
},
"autoload-dev": {
"psr-4": {
"calderawp\\CalderaContainers\\Tests\\": "Tests"
}
},
"scripts" : {
"tests" : "composer lints && composer fixes && composer test",
"test" : "phpunit Tests",
"tests-now" : "phpunit Tests --group=now",
"sniffs" : "phpcs src/",
"fixes" : "phpcbf src/",
"lints" : "parallel-lint ./src --blame --exclude vendor && parallel-lint ./Tests --blame --exclude vendor"
}
"scripts": {
"tests": "composer lints && composer fixes && composer test",
"test": "phpunit Tests",
"tests-now": "phpunit Tests --group=now",
"sniffs": "phpcs src/",
"fixes": "phpcbf src/",
"lints": "parallel-lint ./src --blame --exclude vendor && parallel-lint ./Tests --blame --exclude vendor"
}
}
......@@ -18,6 +18,11 @@ use calderawp\CalderaContainers\Interfaces\ServiceContainer;
class Container implements ServiceContainer
{
/**
* @var array
*/
protected $unBoundSingletons = [];
/**
* @var ProvidesService[]