@@ -12,6 +12,9 @@ discard block |
||
| 12 | 12 | return $this[] = $value; |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | + /** |
|
| 16 | + * @param string $value |
|
| 17 | + */ |
|
| 15 | 18 | public function has($value) |
| 16 | 19 | { |
| 17 | 20 | foreach ($this->getIterator() as $v) { |
@@ -39,6 +42,10 @@ discard block |
||
| 39 | 42 | |
| 40 | 43 | return $this; |
| 41 | 44 | } |
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * @param string $value |
|
| 48 | + */ |
|
| 42 | 49 | public function remove($value) |
| 43 | 50 | { |
| 44 | 51 | $array = $this->toArray(); |
@@ -52,6 +52,10 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | return static::usesTrait($attribute, __TRAIT__); |
| 54 | 54 | } |
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * @param string $trait |
|
| 58 | + */ |
|
| 55 | 59 | public static function usesTrait($attribute, $trait) |
| 56 | 60 | { |
| 57 | 61 | if (!is_object($attribute)) { |
@@ -69,7 +73,7 @@ discard block |
||
| 69 | 73 | * @param object $property the chosen parent property |
| 70 | 74 | * @param string $method the name of the method to call |
| 71 | 75 | * @param array $parameters the arguments to pass to the method |
| 72 | - * @param null $return weather to return the result or the parent object |
|
| 76 | + * @param boolean $return weather to return the result or the parent object |
|
| 73 | 77 | * |
| 74 | 78 | * @return mixed $result the result returned by the method or the $parent itself |
| 75 | 79 | */ |
@@ -106,7 +110,7 @@ discard block |
||
| 106 | 110 | * If the attribute implements the __invoke() magic method, then it may |
| 107 | 111 | * be called directly, ex: $parent->attr(); |
| 108 | 112 | * |
| 109 | - * @param object $parent the object instance that contains the attributes |
|
| 113 | + * @param \Tacone\Bees\Field\Field $parent the object instance that contains the attributes |
|
| 110 | 114 | * @param string $methodName the requested method (i.e.: removeAttr) |
| 111 | 115 | * @param array $parameters the arguments to pass to the method |
| 112 | 116 | * |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | $parameters |
| 119 | 119 | ) { |
| 120 | 120 | $parentProperties = static::getProperties($parent); |
| 121 | - $parentProperties = array_filter($parentProperties, function ($prop) use ($methodName, $parent) { |
|
| 121 | + $parentProperties = array_filter($parentProperties, function($prop) use ($methodName, $parent) { |
|
| 122 | 122 | return stripos($methodName, $prop) !== false |
| 123 | 123 | && is_object($parent->$prop) |
| 124 | 124 | && static::isExposeable($parent->$prop); |
@@ -33,6 +33,9 @@ discard block |
||
| 33 | 33 | return $this->storage[$object->name()] = $object; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | + /** |
|
| 37 | + * @param string $name |
|
| 38 | + */ |
|
| 36 | 39 | public function get($name) |
| 37 | 40 | { |
| 38 | 41 | return $this->storage[$name]; |
@@ -94,6 +97,9 @@ discard block |
||
| 94 | 97 | return !$validator->fails(); |
| 95 | 98 | } |
| 96 | 99 | |
| 100 | + /** |
|
| 101 | + * @param \Tacone\DataSource\AbstractDataSource $source |
|
| 102 | + */ |
|
| 97 | 103 | public function from($source) |
| 98 | 104 | { |
| 99 | 105 | foreach ($this as $name => $field) { |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Tacone\Bees\Demo\Models\Article; |
| 6 | 6 | use Tacone\Bees\Widget\Endpoint; |
| 7 | -use View; |
|
| 8 | 7 | |
| 9 | 8 | class EndpointController extends DemoController |
| 10 | 9 | { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | // add field |
| 71 | 71 | $e->string('name', 'user_name', $sortable) |
| 72 | - ->rules('required|min:4', function ($field) { |
|
| 72 | + ->rules('required|min:4', function($field) { |
|
| 73 | 73 | return 'custom error string for field '.$field->name(); |
| 74 | 74 | }) |
| 75 | 75 | ->options(['enum', 'of', 'choices']); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $field->value(); |
| 92 | 92 | $field->value($newValue); |
| 93 | -$field->onValue(function () { |
|
| 93 | +$field->onValue(function() { |
|
| 94 | 94 | }); |
| 95 | -$field->onGetValue(function () { |
|
| 95 | +$field->onGetValue(function() { |
|
| 96 | 96 | }); |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | $value = (array) $value; |
| 68 | 68 | $return = array(); |
| 69 | 69 | $separator = $this->separator; |
| 70 | - array_walk_recursive($value, function ($item) use (&$return, $separator) { |
|
| 70 | + array_walk_recursive($value, function($item) use (&$return, $separator) { |
|
| 71 | 71 | if (is_string($item)) { |
| 72 | 72 | $item = explode($separator, $item); |
| 73 | 73 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | $namespace = '\\Tacone\\Bees\\Field'; |
| 29 | 29 | $fields = ['string', 'integer', 'float', 'boolean']; |
| 30 | 30 | foreach ($fields as $class) { |
| 31 | - App::bind("bees.$class", function ($app, $arguments) use ($class, $namespace) { |
|
| 31 | + App::bind("bees.$class", function($app, $arguments) use ($class, $namespace) { |
|
| 32 | 32 | $class = Str::studly($class).'Field'; |
| 33 | 33 | $reflect = new ReflectionClass($namespace."\\$class"); |
| 34 | 34 | $instance = $reflect->newInstanceArgs($arguments); |
@@ -16,11 +16,11 @@ discard block |
||
| 16 | 16 | * phpunit |
| 17 | 17 | * ``` |
| 18 | 18 | */ |
| 19 | -chdir(__DIR__ . '/..'); |
|
| 19 | +chdir(__DIR__.'/..'); |
|
| 20 | 20 | |
| 21 | 21 | $laravelVersion = !empty($argv[1]) ? $argv[1] : ''; |
| 22 | 22 | if (!$laravelVersion) { |
| 23 | - echo "You need to supply a Laravel version as the first parameter, for instance: 5.1" . PHP_EOL; |
|
| 23 | + echo "You need to supply a Laravel version as the first parameter, for instance: 5.1".PHP_EOL; |
|
| 24 | 24 | echo PHP_EOL; |
| 25 | 25 | exit(1); |
| 26 | 26 | } |
@@ -29,12 +29,12 @@ discard block |
||
| 29 | 29 | echo PHP_EOL; |
| 30 | 30 | |
| 31 | 31 | if (!file_exists('composer.phar')) { |
| 32 | - echo 'downloading composer:' . PHP_EOL; |
|
| 32 | + echo 'downloading composer:'.PHP_EOL; |
|
| 33 | 33 | passthru('php -r "readfile(\'https://getcomposer.org/installer\');" | php'); |
| 34 | 34 | } |
| 35 | 35 | echo PHP_EOL; |
| 36 | 36 | |
| 37 | -echo "Backupping composer.json" . PHP_EOL; |
|
| 37 | +echo "Backupping composer.json".PHP_EOL; |
|
| 38 | 38 | passthru("cp composer.json composer.json.backup"); |
| 39 | 39 | |
| 40 | 40 | if (strpos($laravelVersion, '.')) { |
@@ -46,17 +46,17 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | if (file_exists('vendor')) { |
| 49 | - echo "Removing vendor folder..." . PHP_EOL; |
|
| 49 | + echo "Removing vendor folder...".PHP_EOL; |
|
| 50 | 50 | passthru("rm vendor -rf"); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | -echo "Installing Orchestral $orchestralVersion: " . PHP_EOL; |
|
| 53 | +echo "Installing Orchestral $orchestralVersion: ".PHP_EOL; |
|
| 54 | 54 | passthru("php composer.phar require orchestra/testbench '$orchestralVersion'"); |
| 55 | 55 | |
| 56 | -echo "Installing Faker" . PHP_EOL; |
|
| 56 | +echo "Installing Faker".PHP_EOL; |
|
| 57 | 57 | passthru("php composer.phar require fzaninotto/faker '@stable'"); |
| 58 | 58 | |
| 59 | -echo "Reverting composer.json" . PHP_EOL; |
|
| 59 | +echo "Reverting composer.json".PHP_EOL; |
|
| 60 | 60 | passthru("cp composer.json composer.json.test"); |
| 61 | 61 | passthru("cp composer.json.backup composer.json"); |
| 62 | 62 | passthru("rm composer.json.backup"); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | { |
| 20 | 20 | error_reporting(-1); |
| 21 | 21 | $me = $this; |
| 22 | - app()['events']->listen('composing:*', function ($view) use ($me) { |
|
| 22 | + app()['events']->listen('composing:*', function($view) use ($me) { |
|
| 23 | 23 | if (!empty($view['form'])) { |
| 24 | 24 | $this->widget = $view['form']; |
| 25 | 25 | } |
@@ -97,14 +97,14 @@ discard block |
||
| 97 | 97 | Schema::dropIfExists('demo_article_category'); |
| 98 | 98 | |
| 99 | 99 | //create all tables |
| 100 | - Schema::table('demo_users', function ($table) { |
|
| 100 | + Schema::table('demo_users', function($table) { |
|
| 101 | 101 | $table->create(); |
| 102 | 102 | $table->increments('id'); |
| 103 | 103 | $table->string('firstname', 100); |
| 104 | 104 | $table->string('lastname', 100); |
| 105 | 105 | $table->timestamps(); |
| 106 | 106 | }); |
| 107 | - Schema::table('demo_articles', function ($table) { |
|
| 107 | + Schema::table('demo_articles', function($table) { |
|
| 108 | 108 | $table->create(); |
| 109 | 109 | $table->increments('id'); |
| 110 | 110 | $table->integer('author_id')->unsigned(); |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | $table->timestamp('publication_date'); |
| 116 | 116 | $table->timestamps(); |
| 117 | 117 | }); |
| 118 | - Schema::table('demo_article_detail', function ($table) { |
|
| 118 | + Schema::table('demo_article_detail', function($table) { |
|
| 119 | 119 | $table->create(); |
| 120 | 120 | $table->increments('id'); |
| 121 | 121 | $table->integer('article_id')->unsigned(); |
| 122 | 122 | $table->text('note'); |
| 123 | 123 | $table->string('note_tags', 200); |
| 124 | 124 | }); |
| 125 | - Schema::table('demo_comments', function ($table) { |
|
| 125 | + Schema::table('demo_comments', function($table) { |
|
| 126 | 126 | $table->create(); |
| 127 | 127 | $table->increments('id'); |
| 128 | 128 | $table->integer('user_id')->unsigned(); |
@@ -130,14 +130,14 @@ discard block |
||
| 130 | 130 | $table->text('comment'); |
| 131 | 131 | $table->timestamps(); |
| 132 | 132 | }); |
| 133 | - Schema::table('demo_categories', function ($table) { |
|
| 133 | + Schema::table('demo_categories', function($table) { |
|
| 134 | 134 | $table->create(); |
| 135 | 135 | $table->increments('id'); |
| 136 | 136 | $table->integer('parent_id')->unsigned(); |
| 137 | 137 | $table->string('name', 100); |
| 138 | 138 | $table->timestamps(); |
| 139 | 139 | }); |
| 140 | - Schema::table('demo_article_category', function ($table) { |
|
| 140 | + Schema::table('demo_article_category', function($table) { |
|
| 141 | 141 | $table->create(); |
| 142 | 142 | $table->integer('article_id')->unsigned(); |
| 143 | 143 | $table->integer('category_id')->unsigned(); |