@@ -59,10 +59,10 @@ |
||
| 59 | 59 | '\Ext\Data\Proxy\Ajax' => ['type'=>'ajax'], |
| 60 | 60 | '\Ext\Data\Proxy\Server' => ['type'=>'server'] |
| 61 | 61 | ]; |
| 62 | - $readers = [ |
|
| 63 | - '\Ext\Data\Reader\Json' => ['type'=>'json'], |
|
| 64 | - '\Ext\Data\Reader\Reader' => ['type'=>'base'], |
|
| 65 | - ]; |
|
| 62 | + $readers = [ |
|
| 63 | + '\Ext\Data\Reader\Json' => ['type'=>'json'], |
|
| 64 | + '\Ext\Data\Reader\Reader' => ['type'=>'base'], |
|
| 65 | + ]; |
|
| 66 | 66 | $plugins = [ |
| 67 | 67 | '\Ext\Grid\Filters\Filters' => ['ptype'=>'gridfilters'], |
| 68 | 68 | '\Ext\Grid\Filters\Filter\Boolean' => ['type'=>'boolean'], |
@@ -13,9 +13,9 @@ |
||
| 13 | 13 | |
| 14 | 14 | class ExtSerializer extends ArraySerializer |
| 15 | 15 | {
|
| 16 | - public function serialize(SerializableObject $object) |
|
| 17 | - {
|
|
| 18 | - return json_encode(parent::serialize($object),JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK); |
|
| 19 | - } |
|
| 16 | + public function serialize(SerializableObject $object) |
|
| 17 | + {
|
|
| 18 | + return json_encode(parent::serialize($object),JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK); |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | 21 | } |
| 22 | 22 | \ No newline at end of file |
@@ -15,70 +15,70 @@ |
||
| 15 | 15 | class ArraySerializer implements Serializer |
| 16 | 16 | {
|
| 17 | 17 | |
| 18 | - protected $resolver; |
|
| 18 | + protected $resolver; |
|
| 19 | 19 | |
| 20 | - public function serialize(SerializableObject $object) |
|
| 21 | - {
|
|
| 22 | - return $this->serializeValue($object); |
|
| 23 | - } |
|
| 20 | + public function serialize(SerializableObject $object) |
|
| 21 | + {
|
|
| 22 | + return $this->serializeValue($object); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @return ExtResolver |
|
| 27 | - */ |
|
| 28 | - protected function getResolver(){
|
|
| 29 | - if(!$this->resolver){
|
|
| 30 | - $this->setResolver(new ExtResolver()); |
|
| 31 | - } |
|
| 32 | - return $this->resolver; |
|
| 33 | - } |
|
| 25 | + /** |
|
| 26 | + * @return ExtResolver |
|
| 27 | + */ |
|
| 28 | + protected function getResolver(){
|
|
| 29 | + if(!$this->resolver){
|
|
| 30 | + $this->setResolver(new ExtResolver()); |
|
| 31 | + } |
|
| 32 | + return $this->resolver; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - public function setResolver(ExtResolver $resolver){
|
|
| 36 | - $this->resolver = $resolver; |
|
| 37 | - } |
|
| 35 | + public function setResolver(ExtResolver $resolver){
|
|
| 36 | + $this->resolver = $resolver; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - protected function serializeAssociativeArray($array) {
|
|
| 40 | - if($array instanceof Serializable){
|
|
| 41 | - $type = $this->getResolver()->resolve($array); |
|
| 42 | - $array = $array->properties(); |
|
| 43 | - if($type){
|
|
| 44 | - $array = $type + $array; |
|
| 45 | - } |
|
| 46 | - } |
|
| 39 | + protected function serializeAssociativeArray($array) {
|
|
| 40 | + if($array instanceof Serializable){
|
|
| 41 | + $type = $this->getResolver()->resolve($array); |
|
| 42 | + $array = $array->properties(); |
|
| 43 | + if($type){
|
|
| 44 | + $array = $type + $array; |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - if(!$array) return new \stdClass(); |
|
| 48 | + if(!$array) return new \stdClass(); |
|
| 49 | 49 | |
| 50 | - $serialized = array(); |
|
| 51 | - foreach ($array as $key => $value) {
|
|
| 52 | - $serialized[$key] = $this->serializeValue($value); |
|
| 53 | - } |
|
| 50 | + $serialized = array(); |
|
| 51 | + foreach ($array as $key => $value) {
|
|
| 52 | + $serialized[$key] = $this->serializeValue($value); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - return $serialized; |
|
| 56 | - } |
|
| 55 | + return $serialized; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - protected function serializeArray(array $array) {
|
|
| 59 | - $out = array(); |
|
| 58 | + protected function serializeArray(array $array) {
|
|
| 59 | + $out = array(); |
|
| 60 | 60 | |
| 61 | - foreach($array as $e){
|
|
| 62 | - $out[] = $this->serializeValue($e); |
|
| 63 | - } |
|
| 64 | - return $out; |
|
| 65 | - } |
|
| 61 | + foreach($array as $e){
|
|
| 62 | + $out[] = $this->serializeValue($e); |
|
| 63 | + } |
|
| 64 | + return $out; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - protected function isAssociativeArray(array $array) {
|
|
| 68 | - return (bool)count(array_filter(array_keys($array), 'is_string')); |
|
| 69 | - } |
|
| 67 | + protected function isAssociativeArray(array $array) {
|
|
| 68 | + return (bool)count(array_filter(array_keys($array), 'is_string')); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - protected function serializeValue($value) {
|
|
| 72 | - if($value instanceof Serializable){
|
|
| 73 | - return $this->serializeAssociativeArray($value); |
|
| 74 | - } elseif(is_array($value)) {
|
|
| 75 | - if ($this->isAssociativeArray($value) || empty($value)) {
|
|
| 76 | - return $this->serializeAssociativeArray($value); |
|
| 77 | - } else {
|
|
| 78 | - return $this->serializeArray($value); |
|
| 79 | - } |
|
| 80 | - }else{
|
|
| 81 | - return $value; |
|
| 82 | - } |
|
| 83 | - } |
|
| 71 | + protected function serializeValue($value) {
|
|
| 72 | + if($value instanceof Serializable){
|
|
| 73 | + return $this->serializeAssociativeArray($value); |
|
| 74 | + } elseif(is_array($value)) {
|
|
| 75 | + if ($this->isAssociativeArray($value) || empty($value)) {
|
|
| 76 | + return $this->serializeAssociativeArray($value); |
|
| 77 | + } else {
|
|
| 78 | + return $this->serializeArray($value); |
|
| 79 | + } |
|
| 80 | + }else{
|
|
| 81 | + return $value; |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | 84 | } |
| 85 | 85 | \ No newline at end of file |
@@ -45,7 +45,9 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if(!$array) return new \stdClass(); |
|
| 48 | + if(!$array) {
|
|
| 49 | + return new \stdClass(); |
|
| 50 | + } |
|
| 49 | 51 | |
| 50 | 52 | $serialized = array(); |
| 51 | 53 | foreach ($array as $key => $value) {
|
@@ -77,7 +79,7 @@ discard block |
||
| 77 | 79 | } else {
|
| 78 | 80 | return $this->serializeArray($value); |
| 79 | 81 | } |
| 80 | - }else{
|
|
| 82 | + } else{
|
|
| 81 | 83 | return $value; |
| 82 | 84 | } |
| 83 | 85 | } |
@@ -12,8 +12,9 @@ |
||
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | public function setItems(array $items){
|
| 15 | - foreach($items as $item) |
|
| 16 | - $this->addItem($item); |
|
| 15 | + foreach($items as $item) {
|
|
| 16 | + $this->addItem($item); |
|
| 17 | + } |
|
| 17 | 18 | return $this; |
| 18 | 19 | } |
| 19 | 20 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | if(is_a($component, $class) and ($property==null or ($property!=null and $component->getProperty($property)==$propertyValue))){
|
| 62 | 62 | if($findFirst){
|
| 63 | 63 | return $component; |
| 64 | - }else{
|
|
| 64 | + } else{
|
|
| 65 | 65 | $return[] = $component; |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | if($foundComponents = static::searchArray($component->properties(),$class,$property,$propertyValue,$findFirst)){
|
| 70 | 70 | if($findFirst){
|
| 71 | 71 | return $foundComponents; |
| 72 | - }else{
|
|
| 72 | + } else{
|
|
| 73 | 73 | $return = array_merge($return,$foundComponents); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $foundComponent = null; |
| 84 | 84 | if($element instanceof SerializableObject){
|
| 85 | 85 | $foundComponent = static::search($element,$class,$property,$propertyValue,$findFirst); |
| 86 | - }elseif(is_array($element)){
|
|
| 86 | + } elseif(is_array($element)){
|
|
| 87 | 87 | $foundComponent = static::searchArray($element,$class,$property,$propertyValue,$findFirst); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | return $this->setProperty('storeId',$storeId);
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function getStoreId(){
|
|
| 39 | - return $this->getProperty('storeId');
|
|
| 40 | - } |
|
| 38 | + public function getStoreId(){
|
|
| 39 | + return $this->getProperty('storeId');
|
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * The number of records considered to form a 'page'. This is used to power the built-in paging using the nextPage |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | return $this->setProperty('pageSize',$pageSize);
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function getPageSize(){
|
|
| 53 | - return $this->getProperty('pageSize');
|
|
| 54 | - } |
|
| 52 | + public function getPageSize(){
|
|
| 53 | + return $this->getProperty('pageSize');
|
|
| 54 | + } |
|
| 55 | 55 | } |
| 56 | 56 | \ No newline at end of file |
@@ -14,19 +14,19 @@ |
||
| 14 | 14 | class Reader extends Base |
| 15 | 15 | {
|
| 16 | 16 | |
| 17 | - public function setRootProperty($rootProperty){
|
|
| 18 | - return $this->setProperty('rootProperty',$rootProperty);
|
|
| 19 | - } |
|
| 17 | + public function setRootProperty($rootProperty){
|
|
| 18 | + return $this->setProperty('rootProperty',$rootProperty);
|
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - public function getRootProperty(){
|
|
| 22 | - return $this->getProperty('rootProperty');
|
|
| 23 | - } |
|
| 21 | + public function getRootProperty(){
|
|
| 22 | + return $this->getProperty('rootProperty');
|
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public function setTotalProperty($totalProperty){
|
|
| 26 | - return $this->setProperty('totalProperty',$totalProperty);
|
|
| 27 | - } |
|
| 25 | + public function setTotalProperty($totalProperty){
|
|
| 26 | + return $this->setProperty('totalProperty',$totalProperty);
|
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - public function getTotalProperty(){
|
|
| 30 | - return $this->getProperty('totalProperty');
|
|
| 31 | - } |
|
| 29 | + public function getTotalProperty(){
|
|
| 30 | + return $this->getProperty('totalProperty');
|
|
| 31 | + } |
|
| 32 | 32 | } |
| 33 | 33 | \ No newline at end of file |
@@ -11,12 +11,12 @@ |
||
| 11 | 11 | |
| 12 | 12 | class Json extends Reader |
| 13 | 13 | {
|
| 14 | - public function setMetadataProperty($metadataProperty){
|
|
| 15 | - return $this->setProperty('metadataProperty',$metadataProperty);
|
|
| 16 | - } |
|
| 14 | + public function setMetadataProperty($metadataProperty){
|
|
| 15 | + return $this->setProperty('metadataProperty',$metadataProperty);
|
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - public function getMetadataProperty(){
|
|
| 19 | - return $this->getProperty('metadataProperty');
|
|
| 20 | - } |
|
| 18 | + public function getMetadataProperty(){
|
|
| 19 | + return $this->getProperty('metadataProperty');
|
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | 22 | } |
| 23 | 23 | \ No newline at end of file |
@@ -7,12 +7,12 @@ |
||
| 7 | 7 | |
| 8 | 8 | class Proxy extends Base |
| 9 | 9 | {
|
| 10 | - public function setReader(Reader $reader){
|
|
| 11 | - return $this->setProperty('reader',$reader);
|
|
| 12 | - } |
|
| 10 | + public function setReader(Reader $reader){
|
|
| 11 | + return $this->setProperty('reader',$reader);
|
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - public function getReader(){
|
|
| 15 | - return $this->getProperty('reader');
|
|
| 16 | - } |
|
| 14 | + public function getReader(){
|
|
| 15 | + return $this->getProperty('reader');
|
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | 18 | } |
| 19 | 19 | \ No newline at end of file |