includes/class-freemius.php
function _update_site_license( $new_license ) {
            $this->_logger->entrance();

            $this->_license = $new_license;

            if ( ! is_object( $new_license ) ) {
                $this->_site->license_id = null;
                $this->_sync_site_subscription( null );

                return $this->_license;
            }

            $this->_site->license_id = $this->_license->id;

            if ( ! is_array( $this->_licenses ) ) {
                $this->_licenses = array();
            }

            $is_license_found = false;
            for ( $i = 0, $len = count( $this->_licenses ); $i < $len; $i ++ ) {
                if ( $new_license->id == $this->_licenses[ $i ]->id ) {
                    $this->_licenses[ $i ] = $new_license;

                    $is_license_found = true;
                    break;
                }
            }

            // If new license just append.
            if ( ! $is_license_found ) {
                $this->_licenses[] = $new_license;
            }

            $this->_sync_site_subscription( $new_license );

            return $this->_license;
        }
function _update_site_license( $new_license ) {
            $this->_logger->entrance();

            $this->_license = $new_license;

            if ( ! is_object( $new_license ) ) {
                $this->_site->license_id = null;
                $this->_sync_site_subscription( null );

                return $this->_license;
            }

            $this->_site->license_id = $this->_license->id;

            if ( ! is_array( $this->_licenses ) ) {
                $this->_licenses = array();
            }

            $is_license_found = false;
            for ( $i = 0, $len = count( $this->_licenses ); $i < $len; $i ++ ) {
                if ( $new_license->id == $this->_licenses[ $i ]->id ) {
                    $this->_licenses[ $i ] = $new_license;

                    $is_license_found = true;
                    break;
                }
            }

            // If new license just append.
            if ( ! $is_license_found ) {
                $this->_licenses[] = $new_license;
            }

            $this->_sync_site_subscription( $new_license );

            return $this->_license;
        }
function _update_site_license ( $ new_license ) { $ this -> _logger -> entrance ( ) ; $ this -> _license = $ new_license ; if ( ! is_object ( $ new_license ) ) { $ this -> _site -> license_id = null ; $ this -> _sync_site_subscription ( null ) ; return $ this -> _license ; } $ this -> _site -> license_id = $ this -> _license -> id ; if ( ! is_array ( $ this -> _licenses ) ) { $ this -> _licenses = array ( ) ; } $ is_license_found = false ; for ( $ i = 0 , $ len = count ( $ this -> _licenses ) ; $ i < $ len ; $ i ++ ) { if ( $ new_license -> id == $ this -> _licenses [ $ i ] -> id ) { $ this -> _licenses [ $ i ] = $ new_license ; $ is_license_found = true ; break ; } } // If new license just append.
 if ( ! $ is_license_found ) { $ this -> _licenses [ ] = $ new_license ; } $ this -> _sync_site_subscription ( $ new_license ) ; return $ this -> _license ; }
Sync site's license with user licenses.

@author Vova Feldman (@svovaf)
@since  1.0.6

@param FS_Plugin_License|null $new_license

@return FS_Plugin_License|null
Sync site s license with user licenses .