Browse Source

Merge pull request #4732 from cakephp/3.0-extract-collection-function

Extracting the collection function into a new file inside Collection
Mark Story 11 years ago
parent
commit
3ca06b985f
4 changed files with 35 additions and 17 deletions
  1. 4 1
      composer.json
  2. 2 1
      src/Collection/composer.json
  3. 29 0
      src/Collection/functions.php
  4. 0 15
      src/basics.php

+ 4 - 1
composer.json

@@ -34,7 +34,10 @@
 		"psr-4": {
 			"Cake\\": "src"
 		},
-		"files": ["src/Core/functions.php"]
+		"files": [
+			"src/Core/functions.php",
+			"src/Collection/functions.php"
+		]
 	},
 	"autoload-dev": {
 		"psr-4": {

+ 2 - 1
src/Collection/composer.json

@@ -11,7 +11,8 @@
 	"autoload": {
 		"psr-4": {
 			"Cake\\Collection\\": "."
-		}
+		},
+		"files": ["functions.php"]
 	},
 	"minimum-stability": "beta"
 }

+ 29 - 0
src/Collection/functions.php

@@ -0,0 +1,29 @@
+<?php
+/**
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @since         2.0.0
+ * @license       http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+use Cake\Collection\Collection;
+
+if (!function_exists('collection')) {
+
+/**
+ * Returns a new Cake\Collection\Collection object wrapping the passed argument
+ *
+ * @param \Traversable|array $items The items from which the collection will be built
+ * @return \Cake\Collection\Collection
+ */
+	function collection($items) {
+		return new Collection($items);
+	}
+
+}

+ 0 - 15
src/basics.php

@@ -12,7 +12,6 @@
  * @since         0.2.9
  * @license       http://www.opensource.org/licenses/mit-license.php MIT License
  */
-use Cake\Collection\Collection;
 use Cake\Core\Configure;
 use Cake\Error\Debugger;
 use Cake\I18n\I18n;
@@ -244,17 +243,3 @@ if (!function_exists('__x')) {
 	}
 
 }
-
-if (!function_exists('collection')) {
-
-/**
- * Returns a new Cake\Collection\Collection object wrapping the passed argument
- *
- * @param \Traversable|array $items The items from which the collection will be built
- * @return \Cake\Collection\Collection
- */
-	function collection($items) {
-		return new Collection($items);
-	}
-
-}