Skip to content

Commit

Permalink
improved coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jun 19, 2015
1 parent 48aa5d2 commit 55d0eb8
Show file tree
Hide file tree
Showing 87 changed files with 1,226 additions and 1,226 deletions.
14 changes: 7 additions & 7 deletions examples/basic-example.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
die('Install packages using `composer install`');
}

use Nette\Forms\Form,
Tracy\Debugger,
Tracy\Dumper,
Nette\Utils\Html;
use Nette\Forms\Form;
use Tracy\Debugger;
use Tracy\Dumper;
use Nette\Utils\Html;

Debugger::enable();

Expand Down Expand Up @@ -73,7 +73,7 @@
'qu' => 'Qumran',
'st' => 'Saint Georges Island',
],
'?' => 'other',
'?' => 'other',
];
$form->addSelect('country', 'Country:', $countries)
->setPrompt('Select your country')
Expand Down Expand Up @@ -107,8 +107,8 @@


$form->setDefaults([
'name' => 'John Doe',
'userid' => 231,
'name' => 'John Doe',
'userid' => 231,
]);


Expand Down
8 changes: 4 additions & 4 deletions examples/bootstrap2-rendering.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
die('Install packages using `composer install`');
}

use Nette\Forms\Form,
Nette\Forms\Controls,
Tracy\Debugger,
Tracy\Dumper;
use Nette\Forms\Form;
use Nette\Forms\Controls;
use Tracy\Debugger;
use Tracy\Dumper;

Debugger::enable();

Expand Down
8 changes: 4 additions & 4 deletions examples/bootstrap3-rendering.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
die('Install packages using `composer install`');
}

use Nette\Forms\Form,
Nette\Forms\Controls,
Tracy\Debugger,
Tracy\Dumper;
use Nette\Forms\Form;
use Nette\Forms\Controls;
use Tracy\Debugger;
use Tracy\Dumper;

Debugger::enable();

Expand Down
6 changes: 3 additions & 3 deletions examples/containers.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
die('Install packages using `composer install`');
}

use Nette\Forms\Form,
Tracy\Debugger,
Tracy\Dumper;
use Nette\Forms\Form;
use Tracy\Debugger;
use Tracy\Dumper;

Debugger::enable();

Expand Down
4 changes: 2 additions & 2 deletions examples/custom-control.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
die('Install packages using `composer install`');
}

use Nette\Forms\Form,
Nette\Utils\Html;
use Nette\Forms\Form;
use Nette\Utils\Html;


class DateInput extends Nette\Forms\Controls\BaseControl
Expand Down
8 changes: 4 additions & 4 deletions examples/custom-rendering.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
die('Install packages using `composer install`');
}

use Nette\Forms\Form,
Tracy\Debugger,
Tracy\Dumper,
Nette\Utils\Html;
use Nette\Forms\Form;
use Tracy\Debugger;
use Tracy\Dumper;
use Nette\Utils\Html;

Debugger::enable();

Expand Down
6 changes: 3 additions & 3 deletions examples/custom-validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
die('Install packages using `composer install`');
}

use Nette\Forms\Form,
Tracy\Debugger,
Tracy\Dumper;
use Nette\Forms\Form;
use Tracy\Debugger;
use Tracy\Dumper;

Debugger::enable();

Expand Down
6 changes: 3 additions & 3 deletions examples/html5.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
die('Install packages using `composer install`');
}

use Nette\Forms\Form,
Tracy\Debugger,
Tracy\Dumper;
use Nette\Forms\Form;
use Tracy\Debugger;
use Tracy\Dumper;

Debugger::enable();

Expand Down
10 changes: 5 additions & 5 deletions examples/localization.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
}


use Nette\Forms\Form,
Tracy\Debugger,
Tracy\Dumper,
Nette\Utils\Html;
use Nette\Forms\Form;
use Tracy\Debugger;
use Tracy\Dumper;
use Nette\Utils\Html;

Debugger::enable();

Expand Down Expand Up @@ -57,7 +57,7 @@ public function translate($message, $count = NULL)
'qu' => 'Qumran',
'st' => 'Saint Georges Island',
],
'?' => 'other',
'?' => 'other',
];
$form->addSelect('country', 'Country:', $countries)
->setPrompt('Select your country');
Expand Down
6 changes: 3 additions & 3 deletions examples/manual-rendering.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
die('Install packages using `composer install`');
}

use Nette\Forms\Form,
Tracy\Debugger,
Tracy\Dumper;
use Nette\Forms\Form;
use Tracy\Debugger;
use Tracy\Dumper;

Debugger::enable();

Expand Down
2 changes: 1 addition & 1 deletion src/Bridges/FormsDI/FormsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class FormsExtension extends Nette\DI\CompilerExtension
{
public $defaults = [
'messages' => []
'messages' => [],
];


Expand Down
14 changes: 7 additions & 7 deletions src/Bridges/FormsLatte/FormMacros.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

namespace Nette\Bridges\FormsLatte;

use Nette,
Latte,
Latte\MacroNode,
Latte\PhpWriter,
Latte\CompileException,
Latte\Macros\MacroSet,
Nette\Forms\Form;
use Nette;
use Latte;
use Latte\MacroNode;
use Latte\PhpWriter;
use Latte\CompileException;
use Latte\Macros\MacroSet;
use Nette\Forms\Form;


/**
Expand Down
6 changes: 3 additions & 3 deletions src/Bridges/FormsLatte/Runtime.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace Nette\Bridges\FormsLatte;

use Nette,
Nette\Utils\Html,
Nette\Forms\Form;
use Nette;
use Nette\Utils\Html;
use Nette\Forms\Form;


/**
Expand Down
8 changes: 4 additions & 4 deletions src/Forms/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
class Container extends Nette\ComponentModel\Container implements \ArrayAccess
{
/** @var callable[] function(Container $sender); Occurs when the form is validated */
/** @var callable[] function (Container $sender); Occurs when the form is validated */
public $onValidate;

/** @var ControlGroup */
Expand Down Expand Up @@ -77,7 +77,7 @@ public function setValues($values, $erase = FALSE)
$control->setValue(NULL);
}

} elseif ($control instanceof Container) {
} elseif ($control instanceof self) {
if (array_key_exists($name, $values)) {
$control->setValues($values[$name], $erase);

Expand All @@ -102,7 +102,7 @@ public function getValues($asArray = FALSE)
if ($control instanceof IControl && !$control->isOmitted()) {
$values[$name] = $control->getValue();

} elseif ($control instanceof Container) {
} elseif ($control instanceof self) {
$values[$name] = $control->getValues($asArray);
}
}
Expand Down Expand Up @@ -429,7 +429,7 @@ public function addImage($name, $src = NULL, $alt = NULL)
*/
public function addContainer($name)
{
$control = new Container;
$control = new self;
$control->currentGroup = $this->currentGroup;
return $this[$name] = $control;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Forms/Controls/BaseControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

namespace Nette\Forms\Controls;

use Nette,
Nette\Forms\IControl,
Nette\Utils\Html,
Nette\Forms\Form;
use Nette;
use Nette\Forms\IControl;
use Nette\Utils\Html;
use Nette\Forms\Form;


/**
Expand Down
4 changes: 2 additions & 2 deletions src/Forms/Controls/CheckboxList.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace Nette\Forms\Controls;

use Nette,
Nette\Utils\Html;
use Nette;
use Nette\Utils\Html;


/**
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Controls/ChoiceControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function loadHttpData()
public function setValue($value)
{
if ($value !== NULL && !array_key_exists((string) $value, $this->items)) {
$range = Nette\Utils\Strings::truncate(implode(', ', array_map(function($s) { return var_export($s, TRUE); }, array_keys($this->items))), 70, '...');
$range = Nette\Utils\Strings::truncate(implode(', ', array_map(function ($s) { return var_export($s, TRUE); }, array_keys($this->items))), 70, '...');
throw new Nette\InvalidArgumentException("Value '$value' is out of allowed range [$range] in field '{$this->name}'.");
}
$this->value = $value === NULL ? NULL : key([(string) $value => NULL]);
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Controls/MultiChoiceControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function setValue($values)
}
$values = array_keys($flip);
if ($diff = array_diff($values, array_keys($this->items))) {
$range = Nette\Utils\Strings::truncate(implode(', ', array_map(function($s) { return var_export($s, TRUE); }, array_keys($this->items))), 70, '...');
$range = Nette\Utils\Strings::truncate(implode(', ', array_map(function ($s) { return var_export($s, TRUE); }, array_keys($this->items))), 70, '...');
$vals = (count($diff) > 1 ? 's' : '') . " '" . implode("', '", $diff) . "'";
throw new Nette\InvalidArgumentException("Value$vals are out of allowed range [$range] in field '{$this->name}'.");
}
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Controls/MultiSelectBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function getControl()
$items,
[
'selected?' => $this->value,
'disabled:' => is_array($this->disabled) ? $this->disabled : NULL
'disabled:' => is_array($this->disabled) ? $this->disabled : NULL,
]
)->addAttributes(parent::getControl()->attrs)->multiple(TRUE);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Forms/Controls/RadioList.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace Nette\Forms\Controls;

use Nette,
Nette\Utils\Html;
use Nette;
use Nette\Utils\Html;


/**
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Controls/SelectBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function getControl()
$items,
[
'selected?' => $this->value,
'disabled:' => is_array($this->disabled) ? $this->disabled : NULL
'disabled:' => is_array($this->disabled) ? $this->disabled : NULL,
]
)->addAttributes(parent::getControl()->attrs);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Forms/Controls/SubmitButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
*/
class SubmitButton extends Button implements Nette\Forms\ISubmitterControl
{
/** @var callable[] function(SubmitButton $sender); Occurs when the button is clicked and form is successfully validated */
/** @var callable[] function (SubmitButton $sender); Occurs when the button is clicked and form is successfully validated */
public $onClick;

/** @var callable[] function(SubmitButton $sender); Occurs when the button is clicked and form is not validated */
/** @var callable[] function (SubmitButton $sender); Occurs when the button is clicked and form is not validated */
public $onInvalidClick;

/** @var array */
Expand Down
6 changes: 3 additions & 3 deletions src/Forms/Controls/TextBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace Nette\Forms\Controls;

use Nette,
Nette\Forms\Form,
Nette\Utils\Strings;
use Nette;
use Nette\Forms\Form;
use Nette\Utils\Strings;


/**
Expand Down
4 changes: 2 additions & 2 deletions src/Forms/Controls/UploadControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace Nette\Forms\Controls;

use Nette,
Nette\Http\FileUpload;
use Nette;
use Nette\Http\FileUpload;


/**
Expand Down
6 changes: 3 additions & 3 deletions src/Forms/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ class Form extends Container implements Nette\Utils\IHtmlString
/** @internal protection token ID */
const PROTECTOR_ID = '_token_';

/** @var callable[] function(Form $sender); Occurs when the form is submitted and successfully validated */
/** @var callable[] function (Form $sender); Occurs when the form is submitted and successfully validated */
public $onSuccess;

/** @var callable[] function(Form $sender); Occurs when the form is submitted and is not valid */
/** @var callable[] function (Form $sender); Occurs when the form is submitted and is not valid */
public $onError;

/** @var callable[] function(Form $sender); Occurs when the form is submitted */
/** @var callable[] function (Form $sender); Occurs when the form is submitted */
public $onSubmit;

/** @var mixed or NULL meaning: not detected yet */
Expand Down
8 changes: 4 additions & 4 deletions src/Forms/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace Nette\Forms;

use Nette,
Nette\Utils\Strings,
Nette\Utils\Html;
use Nette;
use Nette\Utils\Strings;
use Nette\Utils\Html;


/**
Expand Down Expand Up @@ -110,7 +110,7 @@ public static function exportRules(Rules $rules)
$item = [
'op' => ($rule->isNegative ? '~' : '') . $op,
'rules' => static::exportRules($rule->branch),
'control' => $rule->control->getHtmlName()
'control' => $rule->control->getHtmlName(),
];
if ($rule->branch->getToggles()) {
$item['toggle'] = $rule->branch->getToggles();
Expand Down

0 comments on commit 55d0eb8

Please sign in to comment.