@param string $data

@throws \Exception
11295
protected function write($data)
    {
        if ($this->debug) {
            Helper::debugMsg(
                '< [hex]:' . PHP_EOL . Helper::hexdump(
                    $data, false, true, true
                )
            );
        }

        $len = strlen($data);
        while (true) {
            if (false === ($written = fwrite($this->sock, $data))) {
                throw new \Exception ('Error sending data');
            }
            if ($written === 0) {
                throw new \Exception ('Broken pipe or closed connection');
            }
            $info = stream_get_meta_data($this->sock);
            if ($info['timed_out']) {
                throw new \Exception("Error sending data. Socket connection timed out");
            }
            $len = $len - $written;
            if ($len > 0) {
                $data = substr($data, 0 - $len);
            } else {
                break;
            }
        }
    }
429691
protected function bindToActionDatasource(array $data)
    {
        $datasource = strtolower($this->RequestContext->getControls()->getControl('action_datasource'));

        if(empty($datasource))
            throw new Exception('No action_datasource was set');

        $this->setData($data, $datasource, true);
    }
1092146
public function create($data)
    {
    	try {
		    $data = is_object( $data ) ? $data : (object) $data;
		    $id   = 0;
		    try {
			    $entity = new \erdiko\users\entities\Role();
			    $entity->setName( $data->name );
			    $entity->setActive( $data->active );

			    $this->_em->persist( $entity );
			    $this->_em->flush();

			    $id = intval( $entity->getId() );
		    } catch ( \Exception $e ) {
			    \error_log( $e->getMessage() );
			    throw new \Exception( "Could not create Role." );
		    }

		    return (int) $id;
	    } catch (\Exception $e) {
    		throw new \Exception($e->getMessage());
	    }
    }
153001
protected function prepareData($data)
    {
        $data->collector = $data->item['collector'];

        $data->exception = new Data($data->collector['exception']);
    }
1205450
public function dispatchException($exception) {
		if($this->isActive()) {
			if($this->dispatchPreviousExceptions && $exception->getPrevious()) {
				$this->dispatchException($exception->getPrevious());
			}
			$message = new ErrorMessage();
			$message->code = $exception->getCode();
			$message->class = get_class($exception);
			$message->data = $this->dumper->dump($exception->getMessage());
			$message->file = $exception->getFile();
			$message->line = $exception->getLine();
			$message->trace = self::fetchTrace($exception->getTrace(), $message->file, $message->line);
			$this->sendMessage($message);
		}
	}
385594
public function handle( $data )
    {
        $this->data = $data;

        if ( $message = $this->createMessage() )
        {
            $this->getMailer()->send( $message );
        }
    }
760197
protected function createUserInstance($data)
    {
        $config = app('scaffold.config');

        if (!$model = $this->fetchModel($config)) {
            throw new Exception('Could not find a model to create user.');
        }

        try {
            $model::unguard();

            return (new $model())->create($this->dataWithId($data));
        } catch (Exception $e) {
            return (new $model())->create($data);
        }
    }
837896
public function write(string $data) : void
    {
        $this->buffer .= $data;

        if (strlen($this->buffer) >= $this->size) {
            $this->flush();
        }
    }
205941
public function copyFrom($data)
    {
        if (is_array($data) || ($data instanceof \Traversable)) {
            if ($this->_count > 0) {
                $this->clear();
            }
            if ($data instanceof CList) {
                $data = $data->_data;
            }
            foreach ($data as $item) {
                $this->push($item);
            }
        } elseif ($data !== null) {
            throw new Exception('实例化列表参数必须是数组或可遍历的对象', 100100501);
        }
    }
557802
public function load(string $data)
    {
        // we silence error(s) so we can catch them and throw a proper exception after
        $data = @parse_ini_string($data, true);

        // fail if there was an error while processing the specified ini file
        if ($data === false) {
            $error = error_get_last();
            throw new ProcessorException(__CLASS__.' fail to parse data: '.$error['message']);
        }

        // reset the result array
        $this->content = [];

        // loop through each section
        foreach ($data as $section => $contents) {
            $this->processSection($section, $contents);
        }
    }
1350751
public function unread($data)
    {
        $this->readBytes -= strlen($data);
        $this->data = $data . $this->data;
    }
409379
public function setData($data)
    {
        if ($this->getType() == PdfConverter::URL && strpos(substr($data, 0, 5), 'http') === false) {
            throw new \Exception(sprintf('Error : Given URL MUST contain the protocol. Current : %s', $data));
        }
        $this->data = $data;

        return $this;
    }
863450
public function set_data( $data ) {

		$this->instance = 0;
		foreach ( (array) $data[ $this->slug ] as $instance => $instance_data ) {
			foreach ( $this->child as $child ) {
				if ( method_exists( $child, 'set_data' ) ) {
					$child->set_data( $instance_data );
				}
			}
			$this->instance ++;
		}
		$this->instances = $this->instance;
		$this->instance  = 0;

	}
602963
public function sets($data, $params)
    {
        if (empty($params))
        {
            throw new \Exception("Model sets params is empty!");
        }
        $selectdb = new SelectDB($this->db);
        $selectdb->from($this->table);
        $selectdb->put($params);
        return $selectdb->update($data);
	}
806921
protected function init($data)
    {
        if (! isset($data['id'])) {
            throw new DataSift_Exception_InvalidData('No id found');
        }
        $this->_id = $data['id'];

        if (! isset($data['name'])) {
            throw new DataSift_Exception_InvalidData('No name found');
        }
        $this->_name = $data['name'];

        if (! isset($data['created_at'])) {
            throw new DataSift_Exception_InvalidData('No created_at found');
        }
        $this->_created_at = $data['created_at'];

        if (! isset($data['status'])) {
            throw new DataSift_Exception_InvalidData('No status found');
        }
        $this->_status = $data['status'];

        if (! isset($data['hash_type'], $data)) {
            throw new DataSift_Exception_InvalidData('No hash_type found');
        }
        $this->_hash_type = $data['hash_type'];

        if (! isset($data['hash'])) {
            throw new DataSift_Exception_InvalidData('No hash found');
        }
        $this->_hash = $data['hash'];

        if (! isset($data['last_request'])) {
            $this->_last_request = 0;
        } else {
            $this->_last_request = $data['last_request'];
        }

        if (! isset($data['last_success'])) {
            $this->_last_success = 0;
        } else {
            $this->_last_success = $data['last_success'];
        }

        if (! isset($data['output_type'])) {
            throw new DataSift_Exception_InvalidData('No output_type found');
        }
        $this->_output_type = $data['output_type'];

        if (! isset($data['output_params'])) {
            throw new DataSift_Exception_InvalidData('No output_params found');
        }
        $this->_output_params = $this->parseOutputParams($data['output_params']);
    }
1247774
public function write(string $data) : void
    {
        if ($this->closed) {
            throw new IoException('The stream is closed.');
        }

        try {
            $result = ErrorCatcher::run(function() use ($data) {
                return fwrite($this->handle, $data);
            });
        } catch (\ErrorException $e) {
            throw new IoException($e->getMessage(), 0, $e);
        }

        if ($result === false) {
            throw new IoException('Failed to write to stream.');
        }
    }
459172
public function create($data) {

		// Create
		$bean = $this->universalCreate();

		// Catch exception, because bean might already have been created by property method.
		try {
			return $this->set($data, $bean);
		} catch (Exception $e) {
			// Delete bean
			$this->delete($bean->id);
			throw new \Exception( $e->getMessage() );
		}

	}