public function start() {

		if(!$this->started) {

			// only non-CLI environments are supposed to provide sessions

			if(PHP_SAPI !== 'cli') {
				
				// avoid starting an already started session

				if (
					(PHP_VERSION_ID >= 50400 && session_status() === PHP_SESSION_ACTIVE) ||
					(PHP_VERSION_ID < 50400 && session_id())
				) {
					throw new \RuntimeException('Failed to start the session: Session already started.');
				}

				// allow session only when no headers have been sent

				if (headers_sent($file, $line)) {
					throw new \RuntimeException(sprintf("Cannot start session. Headers have already been sent by file '%s' at line %d.", $file, $line));
				}

				if(!session_start()) {
					throw new \RuntimeException('Session start failed.');
				}
			}

			$this->loadSession();

		}
	}
public function start() {

		if(!$this->started) {

			// only non-CLI environments are supposed to provide sessions

			if(PHP_SAPI !== 'cli') {
				
				// avoid starting an already started session

				if (
					(PHP_VERSION_ID >= 50400 && session_status() === PHP_SESSION_ACTIVE) ||
					(PHP_VERSION_ID < 50400 && session_id())
				) {
					throw new \RuntimeException('Failed to start the session: Session already started.');
				}

				// allow session only when no headers have been sent

				if (headers_sent($file, $line)) {
					throw new \RuntimeException(sprintf("Cannot start session. Headers have already been sent by file '%s' at line %d.", $file, $line));
				}

				if(!session_start()) {
					throw new \RuntimeException('Session start failed.');
				}
			}

			$this->loadSession();

		}
	}
public function start ( ) { if ( ! $ this -> started ) { // only non-CLI environments are supposed to provide sessions if ( PHP_SAPI !== 'cli' ) { // avoid starting an already started session if ( ( PHP_VERSION_ID >= 50400 && session_status ( ) === PHP_SESSION_ACTIVE ) || ( PHP_VERSION_ID < 50400 && session_id ( ) ) ) { throw new \ RuntimeException ( 'Failed to start the session: Session already started.' ) ; } // allow session only when no headers have been sent if ( headers_sent ( $ file , $ line ) ) { throw new \ RuntimeException ( sprintf ( "Cannot start session. Headers have already been sent by file '%s' at line %d." , $ file , $ line ) ) ; } if ( ! session_start ( ) ) { throw new \ RuntimeException ( 'Session start failed.' ) ; } } $ this -> loadSession ( ) ; } }
start session and load session data into SessionDataBag

@throws \RuntimeException
start session and load session data into SessionDataBag