Add a data source.

@since 1.0

@param \Serializable $source
@param string        $name If passed, listeners specifying that function
argument name will receive this data source.

@return self
169836
public function add_data_source( \Serializable $source, $name = '' ) {

		if ( $name ) {
			$this->data_sources[ $name ] = $source;
		} else {
			$this->data_sources[] = $source;
		}

		$this->regenerate();

		return $this;
	}
1087587
private function initSource($source)
    {
        if (empty($this->source)) {
            $this->source = new Source();
        }

        if (!empty($source)) {
            if (is_array($source)) {
                $this->source->setLines($source);
            } elseif (is_string($source)) {
                $this->source->setString($source);
            }
        }
    }
1071683
public function source($source = null)
    {
        if (!func_num_args()) {
            return $this->_source;
        }
        $this->_source = $source;
        return $this;
    }
833842
public function setSource($source): Method
    {
        if (!empty($source)) {
            if (is_array($source)) {
                $this->source->setLines($source);
            } elseif (is_string($source)) {
                $this->source->setString($source);
            }
        }

        return $this;
    }
481153
def add(source):
    
    new_data = DatasetClient().add_data(source)
    print_data([DataClient().get(new_data['data_id'])])
1021022
public function source($source, $sourceType = 'local')
    {
        $this->sourcePath = $source;
        $this->sourceType = $sourceType;

        return $this;
    }
1055600
public function setSource($source)
    {
        $controller = Controller::curr();
        $code = $controller->data()->Code;
        $updated = [];
        if (is_array($source) && !empty($source)) {
            foreach ($source as $key => $val) {
                $updated[ProductPage::getGeneratedValue($code, $this->getName(), $key, 'value')] = $val;
            }
        }
        $this->source = $updated;

        return $this;
    }
1257719
public function addCustomCompiler($name, $compiler)
    {
        if (!is_callable($compiler)) {
            throw new \InvalidArgumentException('Compiler should be callable.');
        }

        $this->customCompilers[$name] = $compiler;

        return $this;
    }
701873
public function inspiredBySource(string $name, string $url): self
    {
        $this->sources[] = ['name' => $name, 'url' => $url];
        return $this;
    }
1073005
public function setSource($source)
    {
        if ($source instanceof ListSource) {
            $this->source = $source;
        }
        
        if ($source instanceof SS_List) {
            $this->source = ListWrapper::create($source);
        }
        
        return $this->owner;
    }
1237375
function(name, source){
      var oldSource = this.sources[name];

      if (name in this.fields.sources == false)
      {
        /** @cut */ basis.dev.warn('basis.data.object.Merge#setSource: can\'t set source with name `' + name + '` as not specified by fields configuration');
        return;
      }

      // ignore set source for self fields
      if (name == '-')
        return;

      // create context for name if not exists yet
      if (name in this.sourcesContext_ == false)
        this.sourcesContext_[name] = {
          host: this,
          name: name,
          adapter: null
        };

      // resolve object from value
      source = resolveObject(this.sourcesContext_[name], resolveSetSource, source, 'adapter', this);

      // main part
      if (oldSource !== source)
      {
        var listenHandler = this.listen['source:' + name];

        // remove handler from old source if present
        if (oldSource)
        {
          if (listenHandler)
            oldSource.removeHandler(listenHandler, this);

          oldSource.removeHandler(MERGE_SOURCE_HANDLER, this.sourcesContext_[name]);
        }

        // set new source value
        this.sources[name] = source;

        // add handler to new source
        if (source)
        {
          source.addHandler(MERGE_SOURCE_HANDLER, this.sourcesContext_[name]);

          if (listenHandler)
            source.addHandler(listenHandler, this);

          // apply new source data
          var newData = this.fields.sources[name](source.data);

          // reset properties missed in new source if source is defaultSource
          if (this.fields.defaultSource == name)
            for (var key in this.data)
              if (!this.fields.fieldSource.hasOwnProperty(key) && !newData.hasOwnProperty(key))
                newData[key] = undefined;

          this.update(newData);
        }

        this.emit_sourceChanged(name, oldSource);
      }
    }
1193204
public function addFile($name, $data) {
        $file = new File($this->getChild($name));
        $file->write($data);
        return $file;
    }
1220968
public function add(string $name, Table $table)
    {
        $this->tables[$name] = $table;

        return $this;
    }
913828
public function addImage($source)
    {
        $images   = $this->getImages();
        $images[] = $source;
        
        $this->setData('images', $images);
        
        return $this;
    }
185945
protected function &nestedValueRef($name, &$source)
    {
        // Find var to change
        $var = &$source;
        foreach (explode('.', $name) as $namePart) {
            if (!isset($var)) {
                $var = [];
            }
            if (!isset($var[$namePart])) {
                $var[$namePart] = null;
            }
            $var = &$var[$namePart];
        }
        return $var;
    }
57327
public function addFrom( $email, $name = null )
	{
		$this->object->addFrom( $email, $name );
		return $this;
	}
962146
public function loadSource($source)
    {
        $parser = new Parser();

        list($this->headers, $this->content) = $parser->parsePart($source);
    }