src/SecurityDefinitions.php
public function generateOpenApi(Collection $documentation, array $securityConfig)
    {
        $components = collect();
        if ($documentation->has('components')) {
            $components = collect($documentation->get('components'));
        }

        $securitySchemes = collect();
        if ($components->has('securitySchemes')) {
            $securitySchemes = collect($components->get('securitySchemes'));
        }

        foreach ($securityConfig as $key => $cfg) {
            $securitySchemes->offsetSet($key, self::arrayToObject($cfg));
        }

        $components->offsetSet('securitySchemes', $securitySchemes);

        $documentation->offsetSet('components', $components);

        return $documentation;
    }
public function generateOpenApi(Collection $documentation, array $securityConfig)
    {
        $components = collect();
        if ($documentation->has('components')) {
            $components = collect($documentation->get('components'));
        }

        $securitySchemes = collect();
        if ($components->has('securitySchemes')) {
            $securitySchemes = collect($components->get('securitySchemes'));
        }

        foreach ($securityConfig as $key => $cfg) {
            $securitySchemes->offsetSet($key, self::arrayToObject($cfg));
        }

        $components->offsetSet('securitySchemes', $securitySchemes);

        $documentation->offsetSet('components', $components);

        return $documentation;
    }
public function generateOpenApi ( Collection $ documentation , array $ securityConfig ) { $ components = collect ( ) ; if ( $ documentation -> has ( 'components' ) ) { $ components = collect ( $ documentation -> get ( 'components' ) ) ; } $ securitySchemes = collect ( ) ; if ( $ components -> has ( 'securitySchemes' ) ) { $ securitySchemes = collect ( $ components -> get ( 'securitySchemes' ) ) ; } foreach ( $ securityConfig as $ key => $ cfg ) { $ securitySchemes -> offsetSet ( $ key , self :: arrayToObject ( $ cfg ) ) ; } $ components -> offsetSet ( 'securitySchemes' , $ securitySchemes ) ; $ documentation -> offsetSet ( 'components' , $ components ) ; return $ documentation ; }
Inject security settings for OpenApi 3.

@param Collection $documentation The parse json
@param array $securityConfig The security settings from l5-swagger

@return Collection
Inject security settings for OpenApi 3 .