Skip to content

Commit

Permalink
Fixed commit bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rmolodyko committed Feb 18, 2016
1 parent 880eccf commit d158855
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use samsonphp\core\exception\ControllerActionNotFound;
use samsonphp\core\exception\ViewPathNotFound;
use samsonphp\core\exception\ViewVariableNotFound;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* Модуль системы
Expand Down Expand Up @@ -119,7 +120,7 @@ public function path($value = null)
/** @see iModule::title() */
public function title($title = null)
{
return $this->set('title', $title);
return $this->set($title, 'title');
}

/** @see iModule::set() */
Expand Down Expand Up @@ -335,7 +336,7 @@ public function __call($method, $arguments)
//elapsed($this->id.' - __Call '.$method);

// If value is passed - set it
if (sizeof($arguments)) {
if (count($arguments)) {
// If first argument is object or array - pass method name as second parameter
if (is_object($arguments[0]) || is_array($arguments[0])) {
$this->__set($arguments[0], $method);
Expand Down Expand Up @@ -372,7 +373,7 @@ public function __wakeup()
// TODO: Переделать обработчик в одинаковый вид для объектов и простых

/** Группа методов для доступа к аттрибутам в виде массива */
public function offsetSet($offset, $value)
public function offsetSet($value, $offset)
{
$this->__set($offset, $value);
}
Expand Down Expand Up @@ -400,21 +401,25 @@ public function __get($field)
return $result;
}

public function __set($field, $value = null)
public function __set($value, $field = null)
{
// This is object
if (is_object($field)) {
$implements = class_implements($field);
// If iModuleViewable implements is passed
if (in_array('samsonframework\core\RenderInterface', $implements)) {
$this->_setObject($field, $value);
}
} // If array is passed
else if (is_array($field)) {
$this->_setArray($field, $value);
if (is_object($field) || is_array($field)) {
$tempValue = $field;
$field = $value;
$value = $tempValue;

// TODO: Will be added in next major version
//throw new \Exception('ViewInterface::set($value, $name) has changed, first arg is variable second is name or prefix');
}
// Set view variable
else $this->data[$field] = $value;

// This is object
if (is_object($value) && is_a($value, 'samsonframework\core\RenderInterface')) {
$this->_setObject($value, $field);
} elseif (is_array($value)) { // If array is passed
$this->_setArray($value, $field);
} else { // Set view variable
$this->data[$field] = $value;
}
}

public function offsetUnset($offset)
Expand Down

0 comments on commit d158855

Please sign in to comment.