{"action":"created","issue":{"url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1564","repository_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel","labels_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1564/labels{/name}","comments_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1564/comments","events_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1564/events","html_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1564","id":128763026,"number":1564,"title":"EZP-25413 ezflow public api","user":{"login":"kuborgh-hgiesenow","id":4929980,"avatar_url":"https://avatars.githubusercontent.com/u/4929980?v=3","gravatar_id":"","url":"https://api.github.com/users/kuborgh-hgiesenow","html_url":"https://github.com/kuborgh-hgiesenow","followers_url":"https://api.github.com/users/kuborgh-hgiesenow/followers","following_url":"https://api.github.com/users/kuborgh-hgiesenow/following{/other_user}","gists_url":"https://api.github.com/users/kuborgh-hgiesenow/gists{/gist_id}","starred_url":"https://api.github.com/users/kuborgh-hgiesenow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuborgh-hgiesenow/subscriptions","organizations_url":"https://api.github.com/users/kuborgh-hgiesenow/orgs","repos_url":"https://api.github.com/users/kuborgh-hgiesenow/repos","events_url":"https://api.github.com/users/kuborgh-hgiesenow/events{/privacy}","received_events_url":"https://api.github.com/users/kuborgh-hgiesenow/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-26T08:59:40Z","updated_at":"2016-02-16T10:23:09Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/pulls/1564","html_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1564","diff_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1564.diff","patch_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1564.patch"},"body":"https://jira.ez.no/browse/EZP-25413"},"comment":{"url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/comments/184612460","html_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1564#issuecomment-184612460","issue_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1564","id":184612460,"user":{"login":"ezrobot","id":681611,"avatar_url":"https://avatars.githubusercontent.com/u/681611?v=3","gravatar_id":"","url":"https://api.github.com/users/ezrobot","html_url":"https://github.com/ezrobot","followers_url":"https://api.github.com/users/ezrobot/followers","following_url":"https://api.github.com/users/ezrobot/following{/other_user}","gists_url":"https://api.github.com/users/ezrobot/gists{/gist_id}","starred_url":"https://api.github.com/users/ezrobot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezrobot/subscriptions","organizations_url":"https://api.github.com/users/ezrobot/orgs","repos_url":"https://api.github.com/users/ezrobot/repos","events_url":"https://api.github.com/users/ezrobot/events{/privacy}","received_events_url":"https://api.github.com/users/ezrobot/received_events","type":"User","site_admin":false},"created_at":"2016-02-16T10:23:09Z","updated_at":"2016-02-16T10:23:09Z","body":"This Pull Request does not respect [PSR-2 Coding Standards](http://www.php-fig.org/psr/psr-2/), please, see the suggested diff below:\n\n```diff\nLoaded config from \"/jenkins/jenkins.std/jobs/PAPI-Pull-Request-code-sniffer/workspace/.php_cs\"\n............................F....\nLegend: ?-unknown, I-invalid file syntax, file ignored, .-no changes, F-fixed, E-error\n   1) eZ/Publish/Core/Persistence/Legacy/Content/FieldValue/Converter/PageConverter.php (parenthesis, braces)\n      ---------- begin diff ----------\n      --- Original\n      +++ New\n      @@ @@\n                       case 'rotation':\n      -                    if ( $attrValue === null )\n      -                    {\n      +                    if ($attrValue === null) {\n                               continue 2;\n                           }\n       \n      -                    $node = $dom->createElement( $attrName );\n      -                    $blockNode->appendChild( $node );\n      +                    $node = $dom->createElement($attrName);\n      +                    $blockNode->appendChild($node);\n       \n      -                    foreach ( $attrValue as $arrayItemKey => $arrayItemValue )\n      -                    {\n      -                        $this->addNewXmlElement( $dom, $node, $arrayItemKey, $arrayItemValue );\n      +                    foreach ($attrValue as $arrayItemKey => $arrayItemValue) {\n      +                        $this->addNewXmlElement($dom, $node, $arrayItemKey, $arrayItemValue);\n                           }\n                           break;\n                       case 'customAttributes':\n      -                    if ( $attrValue === null )\n      -                    {\n      +                    if ($attrValue === null) {\n                               continue 2;\n                           }\n       \n      -                    $node = $dom->createElement( 'custom_attributes' );\n      -                    $blockNode->appendChild( $node );\n      +                    $node = $dom->createElement('custom_attributes');\n      +                    $blockNode->appendChild($node);\n       \n      -                    foreach ( $attrValue as $arrayItemKey => $arrayItemValue )\n      -                    {\n      -                        $this->addNewXmlElement( $dom, $node, $arrayItemKey, $arrayItemValue );\n      +                    foreach ($attrValue as $arrayItemKey => $arrayItemValue) {\n      +                        $this->addNewXmlElement($dom, $node, $arrayItemKey, $arrayItemValue);\n                           }\n                           break;\n                       case 'attributes':\n                           foreach ($attrValue as $arrayItemKey => $arrayItemValue) {\n                               $this->addNewXmlElement($dom, $blockNode, $arrayItemKey, $arrayItemValue);\n                           }\n                           break;\n                       default:\n                           $this->addNewNotEmptyXmlElement($dom, $blockNode, $attrName, $attrValue);\n                           break;\n                   }\n               }\n       \n               return $blockNode;\n           }\n       \n           /**\n            * Generates XML string for a given $item object.\n            *\n            * @param \\eZ\\Publish\\Core\\FieldType\\Page\\Parts\\Item $item\n            * @param \\DOMDocument $dom\n            *\n            * @return bool|\\DOMElement\n            */\n           protected function generateItemXmlString(Parts\\Item $item, DOMDocument $dom)\n           {\n               $itemNode = $dom->createElement('item');\n       \n               foreach ($item->getState() as $attrName => $attrValue) {\n                   switch ($attrName) {\n                       case 'action':\n                           if ($attrValue !== null) {\n                               $itemNode->setAttribute('action', $attrValue);\n                           }\n                           break;\n                       case 'contentId':\n                           $this->addNewNotEmptyXmlElement($dom, $itemNode, 'object_id', $attrValue);\n                           break;\n                       case 'locationId':\n                           $this->addNewNotEmptyXmlElement($dom, $itemNode, 'node_id', $attrValue);\n                           break;\n                       case 'priority':\n                           $this->addNewNotEmptyXmlElement($dom, $itemNode, 'priority', $attrValue);\n                           break;\n                       case 'publicationDate':\n                           $this->addNewNotEmptyXmlElement($dom, $itemNode, 'ts_publication', $attrValue);\n                           break;\n                       case 'visibilityDate':\n                           $this->addNewNotEmptyXmlElement($dom, $itemNode, 'ts_visible', $attrValue);\n                           break;\n                       case 'hiddenDate':\n                           $this->addNewNotEmptyXmlElement($dom, $itemNode, 'ts_hidden', $attrValue);\n                           break;\n                       case 'rotationUntilDate':\n                           $this->addNewNotEmptyXmlElement($dom, $itemNode, 'rotation_until', $attrValue);\n                           break;\n                       case 'movedTo':\n                           $this->addNewNotEmptyXmlElement($dom, $itemNode, 'moved_to', $attrValue);\n                           break;\n                       case 'attributes':\n                           foreach ($attrValue as $arrayItemKey => $arrayItemValue) {\n                               $this->addNewNotEmptyXmlElement($dom, $itemNode, $arrayItemKey, $arrayItemValue);\n                           }\n                           break;\n                   }\n               }\n       \n               return $itemNode;\n           }\n       \n           /**\n            * Utility method to add new elements to an xml node if their value is not empty.\n            *\n            * @param \\DOMDocument $dom xml document\n            * @param \\DOMElement $node where to add the new element\n            * @param string $name of the new element\n            * @param string $value of the new element\n            */\n           private function addNewNotEmptyXmlElement(DOMDocument $dom, DOMElement $node, $name, $value)\n           {\n               if (!empty($value)) {\n                   $this->addNewXmlElement($dom, $node, $name, $value);\n               }\n           }\n       \n           /**\n            * Utility method to add new elements to an xml node.\n            *\n            * @param \\DOMDocument $dom xml document\n            * @param \\DOMElement $node where to add the new element\n            * @param string $name of the new element\n            * @param string $value of the new element\n            */\n           private function addNewXmlElement(DOMDocument $dom, DOMElement $node, $name, $value)\n           {\n               $new = $dom->createElement($name);\n               $new->appendChild($dom->createTextNode($value));\n               $node->appendChild($new);\n           }\n       \n           /**\n            * Restores value from XML string.\n            *\n            * @param string $xmlString\n            *\n            * @return \\eZ\\Publish\\Core\\FieldType\\Page\\Parts\\Page\n            */\n           public function restoreValueFromXmlString($xmlString)\n           {\n               $zones = array();\n               $attributes = array();\n               $layout = null;\n       \n               if ($xmlString) {\n                   $dom = new DOMDocument('1.0', 'utf-8');\n                   $dom->loadXML($xmlString);\n                   $root = $dom->documentElement;\n       \n                   foreach ($root->childNodes as $node) {\n                       if ($node->nodeType !== XML_ELEMENT_NODE) {\n                           continue;\n                       }\n       \n                       switch ($node->nodeName) {\n                           case 'zone':\n                               $zone = $this->restoreZoneFromXml($node);\n                               $zones[] = $zone;\n                               break;\n                           case 'zone_layout':\n                               $layout = $node->nodeValue;\n                               break;\n                           default:\n                               $attributes[$node->nodeName] = $node->nodeValue;\n                               break;\n                       }\n                   }\n       \n                   if ($root->hasAttributes()) {\n                       foreach ($root->attributes as $attr) {\n                           $attributes[$attr->name] = $attr->value;\n                       }\n                   }\n               }\n       \n               return new Parts\\Page(\n                   array(\n                       'zones' => $zones,\n                       'layout' => $layout,\n                       'attributes' => $attributes,\n                   )\n               );\n           }\n       \n           /**\n            * Restores value for a given Zone $node.\n            *\n            * @param \\DOMElement $node\n            *\n            * @return \\eZ\\Publish\\Core\\FieldType\\Page\\Parts\\Zone\n            */\n           protected function restoreZoneFromXml(DOMElement $node)\n           {\n               $zoneId = null;\n               $zoneIdentifier = null;\n               $action = null;\n               $blocks = array();\n               $attributes = array();\n       \n               if ($node->hasAttributes()) {\n                   foreach ($node->attributes as $attr) {\n                       switch ($attr->name) {\n                           case 'id':\n                               // Stored Id has following format : id_<zoneId>, so extract <zoneId>\n                               $zoneId = substr(\n                                   $attr->value,\n                                   strpos($attr->value, '_') + 1\n                               );\n                               break;\n                           case 'action':\n                               $action = $attr->value;\n                               break;\n                           default:\n                               $attributes[$attr->name] = $attr->value;\n                       }\n                   }\n               }\n       \n               foreach ($node->childNodes as $node) {\n                   if ($node->nodeType !== XML_ELEMENT_NODE) {\n                       continue;\n                   }\n       \n                   switch ($node->nodeName) {\n                       case 'block':\n                           $block = $this->restoreBlockFromXml($node);\n                           $blocks[] = $block;\n                           break;\n                       case 'zone_identifier':\n                           $zoneIdentifier = $node->nodeValue;\n                           break;\n                       default:\n                           $attributes[$node->nodeName] = $node->nodeValue;\n                   }\n               }\n       \n               return new Parts\\Zone(\n                   array(\n                       'id' => $zoneId,\n                       'identifier' => $zoneIdentifier,\n                       'attributes' => $attributes,\n                       'action' => $action,\n                       'blocks' => $blocks,\n                   )\n               );\n           }\n       \n           /**\n            * Restores value for a given Block $node.\n            *\n            * @param \\DOMElement $node\n            *\n            * @return \\eZ\\Publish\\Core\\FieldType\\Page\\Parts\\Block\n            */\n           protected function restoreBlockFromXml(DOMElement $node)\n           {\n               $blockId = null;\n               $items = array();\n               $rotation = null;\n               $customAttributes = null;\n               $attributes = array();\n               $name = null;\n               $type = null;\n               $view = null;\n               $overflowId = null;\n               $action = null;\n               $zoneId = null;\n       \n               if ($node->hasAttributes()) {\n                   foreach ($node->attributes as $attr) {\n                       switch ($attr->name) {\n                           case 'id':\n                               // Stored Id has following format : id_<blockId>, so extract <blockId>\n                               $blockId = substr(\n                                   $attr->value,\n                                   strpos($attr->value, '_') + 1\n                               );\n                               break;\n                           case 'action':\n                               $action = $attr->value;\n                               break;\n                           default:\n                               $attributes[$attr->name] = $attr->value;\n                       }\n                   }\n               }\n       \n               foreach ($node->childNodes as $node) {\n                   if ($node->nodeType !== XML_ELEMENT_NODE) {\n                       continue;\n                   }\n       \n                   switch ($node->nodeName) {\n                       case 'item':\n                           $items[] = $this->restoreItemFromXml($node);\n                           break;\n                       case 'rotation':\n                           if ($rotation === null) {\n                               $rotation = array();\n                           }\n       \n                           foreach ($node->childNodes as $subNode) {\n                               if ($subNode->nodeType !== XML_ELEMENT_NODE) {\n                                   continue;\n                               }\n       \n                               $rotation[$subNode->nodeName] = $subNode->nodeValue;\n                           }\n                           break;\n                       case 'custom_attributes':\n                           if ($customAttributes === null) {\n                               $customAttributes = array();\n                           }\n       \n                           foreach ($node->childNodes as $subNode) {\n                               if ($subNode->nodeType !== XML_ELEMENT_NODE) {\n                                   continue;\n                               }\n       \n                               $customAttributes[$subNode->nodeName] = $subNode->nodeValue;\n                           }\n                           break;\n                       case 'name':\n                       case 'type':\n                       case 'view':\n                           ${$node->nodeName} = $node->nodeValue;\n                           break;\n                       case 'overflow_id':\n                           $overflowId = $node->nodeValue;\n                           break;\n                       case 'zone_id':\n                           $zoneId = $node->nodeValue;\n                           break;\n                       default:\n                           $attributes[$node->nodeName] = $node->nodeValue;\n                   }\n               }\n       \n               return new Parts\\Block(\n                   array(\n                       'id' => $blockId,\n                       'action' => $action,\n                       'items' => $items,\n                       'rotation' => $rotation,\n                       'customAttributes' => $customAttributes,\n                       'attributes' => $attributes,\n                       'name' => $name,\n                       'type' => $type,\n                       'view' => $view,\n                       'overflowId' => $overflowId,\n                       'zoneId' => $zoneId,\n                   )\n               );\n           }\n       \n           /**\n            * Restores value for a given Item $node.\n            *\n            * @param \\DOMElement $node\n            *\n            * @return \\eZ\\Publish\\Core\\FieldType\\Page\\Parts\\Item\n            */\n           protected function restoreItemFromXml(DOMElement $node)\n           {\n               $item = array('attributes' => array());\n       \n               if ($node->hasAttributes()) {\n                   foreach ($node->attributes as $attr) {\n                       switch ($attr->name) {\n                           case 'action':\n                               $item['action'] = $attr->value;\n                               break;\n                           default:\n                               $item['attributes'][$attr->name] = $attr->value;\n                       }\n                   }\n               }\n       \n               foreach ($node->childNodes as $node) {\n                   if ($node->nodeType !== XML_ELEMENT_NODE) {\n                       continue;\n                   }\n       \n                   switch ($node->nodeName) {\n                       case 'object_id':\n                           $item['contentId'] = $node->nodeValue;\n                           break;\n                       case 'node_id':\n                           $item['locationId'] = $node->nodeValue;\n                           break;\n                       case 'priority':\n                           $item[$node->nodeName] = $node->nodeValue;\n                           break;\n                       case 'ts_publication':\n                           $item['publicationDate'] = $node->nodeValue;\n                           break;\n                       case 'ts_visible':\n                           $item['visibilityDate'] = $node->nodeValue;\n                           break;\n                       case 'ts_hidden':\n                           $item['hiddenDate'] = $node->nodeValue;\n                           break;\n                       case 'rotation_until':\n                           $item['rotationUntilDate'] = $node->nodeValue;\n                           break;\n                       case 'moved_to':\n                           $item['movedTo'] = $node->nodeValue;\n                           break;\n                   }\n               }\n       \n               return new Parts\\Item($item);\n           }\n       }\n       \n      \n      ---------- end diff ----------\n\nFixed all files in 79.338 seconds, 19.000 MB memory used\n```\n"}}