예제 #1
0
파일: Env.php 프로젝트: crysalead/env
 /**
  * Sets an array of variables.
  *
  * @param string $collection   The key.
  * @param mixed  $value The value.
  * @param self
  */
 public function set($collection, $value = null)
 {
     if (func_num_args() === 1) {
         return parent::merge($collection, true);
     }
     $this->_data[$collection] = $value;
     return $this;
 }
예제 #2
0
 });
 describe("->count()", function () {
     it("returns 0 on empty", function () {
         $collection = new Collection();
         expect($collection)->toHaveLength(0);
     });
     it("returns the number of items in the collection", function () {
         $collection = new Collection([5, null, 4, true, false, 'bob']);
         expect($collection)->toHaveLength(6);
     });
 });
 describe("->merge()", function () {
     it("merges two collection with key preservation", function () {
         $collection = new Collection([1, 2, 3]);
         $collection2 = new Collection([4, 5, 6, 7]);
         $collection->merge($collection2);
         expect($collection->values())->toBe([4, 5, 6, 7]);
     });
 });
 describe("->append()", function () {
     it("appends two collection with no key preservation", function () {
         $collection = new Collection([1, 2, 3]);
         $collection2 = new Collection([4, 5, 6, 7]);
         $collection->append($collection2);
         expect($collection->values())->toBe([1, 2, 3, 4, 5, 6, 7]);
     });
 });
 describe("->formats()", function () {
     it("gets registered formats", function () {
         Collection::formats('json', function () {
         });