From a3a44c33c6eeb643727b883db3ef5a4f6b7c3634 Mon Sep 17 00:00:00 2001
From: gloas <gloas@afi-sa.fr>
Date: Fri, 22 Sep 2017 09:58:54 +0200
Subject: [PATCH] dev #65075 fix rt comment

---
 cosmogramme/VERSIONS_WIP/64573  |  1 -
 library/Class/Feature.php       |  5 ++---
 library/Class/User/Settings.php | 18 +++++++++---------
 3 files changed, 11 insertions(+), 13 deletions(-)
 delete mode 100644 cosmogramme/VERSIONS_WIP/64573

diff --git a/cosmogramme/VERSIONS_WIP/64573 b/cosmogramme/VERSIONS_WIP/64573
deleted file mode 100644
index cef84909869..00000000000
--- a/cosmogramme/VERSIONS_WIP/64573
+++ /dev/null
@@ -1 +0,0 @@
- - ticket #64573 : Amélioration de la charte modele
\ No newline at end of file
diff --git a/library/Class/Feature.php b/library/Class/Feature.php
index 4a4da8e0fb8..bfadd212c88 100644
--- a/library/Class/Feature.php
+++ b/library/Class/Feature.php
@@ -29,7 +29,7 @@ class Class_Feature {
 
 
   public function hasNew() {
-    return 1 <= $this->countNew();
+    return 0 < $this->countNew();
   }
 
 
@@ -80,8 +80,7 @@ class Class_Feature {
     if(!$ids)
       return [];
 
-    return array_values((new Storm_Collection(array_map([$this, 'find'], $ids)))
-                        ->getArrayCopy());
+    return array_values(array_map([$this, 'find'], $ids));
   }
 
 
diff --git a/library/Class/User/Settings.php b/library/Class/User/Settings.php
index afc89ca097d..908c4ff3183 100644
--- a/library/Class/User/Settings.php
+++ b/library/Class/User/Settings.php
@@ -195,26 +195,26 @@ class Class_User_Settings {
 
 
   public function addCheckedFeature($id) {
-    $checked_features = $this->get(static::CHECKED_FEATURE);
-    $checked_features = explode('-', $checked_features);
-    $checked_features = array_values(array_unique(array_merge($checked_features,
-                                                              [$id])));
+    $checked_features = $this->_getCheckedFeatures($id);
     $this->set(static::CHECKED_FEATURE, implode('-', $checked_features));
     return $this->_user;
   }
 
 
   public function removeCheckedFeature($id) {
-    $checked_features = $this->get(static::CHECKED_FEATURE);
-    $checked_features = explode('-', $checked_features);
-    $checked_features = array_values(array_unique(array_merge($checked_features,
-                                                              [$id])));
-    $checked_features = array_diff($checked_features, [$id]);
+    $checked_features = array_diff($this->_getCheckedFeatures($id), [$id]);
     $this->set(static::CHECKED_FEATURE, implode('-', $checked_features));
     return $this->_user;
   }
 
 
+  protected function _getCheckedFeatures($id) {
+    $checked_features = explode('-', $this->get(static::CHECKED_FEATURE));
+    return array_values(array_unique(array_merge($checked_features,
+                                                 [$id])));
+  }
+
+
   public function addLibraryToBookmarks($id) {
     if (!static::isBookmarkLibraryReady())
       return $this->_user;
-- 
GitLab