Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
noptic committed Feb 15, 2013
1 parent 7a5bf01 commit f060a13
Show file tree
Hide file tree
Showing 6 changed files with 212 additions and 11 deletions.
20 changes: 19 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
{
"name": "dalia-it/dalia-inject",
"description": "Turns arrays intpo objects and vice verse. Provides a single interface and a pseudo trait to implement models.",
"license": "MIT",
"autoload": {
"psr-0": { "daliaIT\\dalia\\inject": "src/" }
},
"authors": [
{
"name": "Oliver Anan",
"email": "[email protected]"
}
],
"require": {

"dalia-it/rough": "v0.0.1-alpha1"
},
"minimum-stability": "dev",
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
"extra":{
"dalia-it":{
"rough":{
"build":{
"source": "src/",
"output": "src/"
}
}
}
}
}
160 changes: 160 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{"\/daliaIT\/dalia\/inject\/IInject.php":"\/var\/lib\/stickshift\/f217cd5aca844e4aba361526fe2fb1b6\/app-root\/data\/396154\/src\/daliaIT\/dalia\/inject\/IInject.php",
"\/daliaIT\/dalia\/inject\/Inject.php":"\/var\/lib\/stickshift\/f217cd5aca844e4aba361526fe2fb1b6\/app-root\/data\/396154\/src\/daliaIT\/dalia\/inject\/Inject.php",
"\/daliaIT\/dalia\/inject\/Sample.php":"\/var\/lib\/stickshift\/f217cd5aca844e4aba361526fe2fb1b6\/app-root\/data\/396154\/src\/daliaIT\/dalia\/inject\/Sample.php"}
19 changes: 19 additions & 0 deletions license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2013 Oliver Anan

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
17 changes: 9 additions & 8 deletions src/daliaIT/dalia/inject/IInject.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
================================================================================
IInject
================================================================================
Required to craete class instnaces from arrays and vice versa.
Required to create class instances from arrays and vice versa.
Usage
--------------------------------------------------------------------------------
This interface is intended to be used for models.
Data retived vie JSON or database querries can be turned into objects without
Data retrived vie JSON or database querries can be turned into objects without
creating constructors for each model.
The integrity of the data must be ensured by the calling code
Expand All @@ -22,7 +22,7 @@
Using injectaion allows setting protected object properties when the object is
created.
Methods
--------------------------------------------------------------------------------
Expand All @@ -32,20 +32,20 @@
The properies names are used as array keys
Any additional parameters are passed to the class constructor.
#### Implemantation
- Implementing classes should *not* allow injecting *unknown properties*
- *Private* properties should *not* be injected
- * Always* return an instance of the *class* which was *called*.
- Implementing classes should not allow injecting unknown properties
- Private properties should not be injected
- Always return an instance of the class which was called.
- additional arguments should be passed to the class constructor
#### Parameters
- `array $properties` Associative array containig the desired properties.
- mixed $arg_1 ... $arg_n Arguments for the class constructor.
- `mixed` $arg_1 ... $arg_n Arguments for the class constructor.
#### Returns
`IInject` instance of the called class
### public static array **extract()** ###
### public static array extract()
Returns an objects properties as array.
The properies names are used as array keys.
Expand All @@ -59,6 +59,7 @@
Source
--------------------------------------------------------------------------------
/*/
namespace daliaIT\dalia\inject;
interface IInject
{
#:this
Expand Down
4 changes: 2 additions & 2 deletions src/daliaIT/dalia/inject/Inject.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
Source
--------------------------------------------------------------------------------
/*/
namespace daliaIT\co3;
namespace daliaIT\dalia\inject;
use ReflectionClass;
#@trait Inject#
final class Inject
final class Inject
#@#
{
public static function inject($properties){
Expand Down

0 comments on commit f060a13

Please sign in to comment.