composer.phar 1.6 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078700797008070081700827008370084700857008670087700887008970090700917009270093700947009570096700977009870099701007010170102701037010470105701067010770108701097011070111701127011370114701157011670117701187011970120701217012270123701247012570126701277012870129701307013170132701337013470135701367013770138701397014070141701427014370144701457014670147701487014970150701517015270153701547015570156701577015870159701607016170162701637016470165701667016770168701697017070171701727017370174701757017670177701787017970180701817018270183701847018570186701877018870189701907019170192701937019470195701967019770198701997020070201702027020370204702057020670207702087020970210702117021270213702147021570216702177021870219702207022170222702237022470225702267022770228702297023070231702327023370234702357023670237702387023970240702417024270243702447024570246702477024870249702507025170252702537025470255702567025770258702597026070261702627026370264702657026670267702687026970270702717027270273702747027570276702777027870279702807028170282702837028470285702867028770288702897029070291702927029370294702957029670297702987029970300703017030270303703047030570306703077030870309703107031170312703137031470315703167031770318703197032070321703227032370324703257032670327703287032970330703317033270333703347033570336703377033870339703407034170342703437034470345703467034770348703497035070351703527035370354703557035670357703587035970360703617036270363703647036570366703677036870369703707037170372703737037470375703767037770378703797038070381703827038370384703857038670387703887038970390703917039270393703947039570396703977039870399704007040170402704037040470405704067040770408704097041070411704127041370414704157041670417704187041970420704217042270423704247042570426704277042870429704307043170432704337043470435704367043770438704397044070441704427044370444704457044670447704487044970450704517045270453704547045570456704577045870459704607046170462704637046470465704667046770468704697047070471704727047370474704757047670477704787047970480704817048270483704847048570486704877048870489704907049170492704937049470495704967049770498704997050070501705027050370504705057050670507705087050970510705117051270513705147051570516705177051870519705207052170522705237052470525705267052770528705297053070531705327053370534705357053670537705387053970540705417054270543705447054570546705477054870549705507055170552705537055470555705567055770558705597056070561705627056370564705657056670567705687056970570705717057270573705747057570576705777057870579705807058170582705837058470585705867058770588705897059070591705927059370594705957059670597705987059970600706017060270603706047060570606706077060870609706107061170612706137061470615706167061770618706197062070621706227062370624706257062670627706287062970630706317063270633706347063570636706377063870639706407064170642706437064470645706467064770648706497065070651706527065370654706557065670657706587065970660706617066270663706647066570666706677066870669706707067170672706737067470675706767067770678706797068070681706827068370684706857068670687706887068970690706917069270693706947069570696706977069870699707007070170702707037070470705707067070770708707097071070711707127071370714707157071670717707187071970720707217072270723707247072570726707277072870729707307073170732707337073470735707367073770738707397074070741707427074370744707457074670747707487074970750707517075270753707547075570756707577075870759707607076170762707637076470765707667076770768707697077070771707727077370774707757077670777707787077970780707817078270783707847078570786707877078870789707907079170792707937079470795707967079770798707997080070801708027080370804708057080670807708087080970810708117081270813708147081570816708177081870819708207082170822708237082470825708267082770828708297083070831708327083370834708357083670837708387083970840708417084270843708447084570846708477084870849708507085170852708537085470855708567085770858708597086070861708627086370864708657086670867708687086970870708717087270873708747087570876708777087870879708807088170882708837088470885708867088770888708897089070891708927089370894708957089670897708987089970900709017090270903709047090570906709077090870909709107091170912709137091470915709167091770918709197092070921709227092370924709257092670927709287092970930709317093270933709347093570936709377093870939709407094170942709437094470945709467094770948709497095070951709527095370954709557095670957709587095970960709617096270963709647096570966709677096870969709707097170972709737097470975709767097770978709797098070981709827098370984709857098670987709887098970990709917099270993709947099570996709977099870999710007100171002710037100471005710067100771008710097101071011710127101371014710157101671017710187101971020710217102271023710247102571026710277102871029710307103171032710337103471035710367103771038710397104071041710427104371044710457104671047710487104971050710517105271053710547105571056710577105871059710607106171062710637106471065710667106771068710697107071071710727107371074710757107671077710787107971080710817108271083710847108571086710877108871089710907109171092710937109471095710967109771098710997110071101711027110371104711057110671107711087110971110711117111271113711147111571116711177111871119711207112171122711237112471125711267112771128711297113071131711327113371134711357113671137711387113971140711417114271143711447114571146711477114871149711507115171152711537115471155711567115771158711597116071161711627116371164711657116671167711687116971170711717117271173711747117571176711777117871179711807118171182711837118471185711867118771188711897119071191711927119371194711957119671197711987119971200712017120271203712047120571206712077120871209712107121171212712137121471215712167121771218712197122071221712227122371224712257122671227712287122971230712317123271233712347123571236712377123871239712407124171242712437124471245712467124771248712497125071251712527125371254712557125671257712587125971260712617126271263712647126571266712677126871269712707127171272712737127471275712767127771278712797128071281712827128371284712857128671287712887128971290712917129271293712947129571296712977129871299713007130171302713037130471305713067130771308713097131071311713127131371314713157131671317713187131971320713217132271323713247132571326713277132871329713307133171332713337133471335713367133771338713397134071341713427134371344713457134671347713487134971350713517135271353713547135571356713577135871359713607136171362713637136471365713667136771368713697137071371713727137371374713757137671377713787137971380713817138271383713847138571386713877138871389713907139171392713937139471395713967139771398713997140071401714027140371404714057140671407714087140971410714117141271413714147141571416714177141871419714207142171422714237142471425714267142771428714297143071431714327143371434714357143671437714387143971440714417144271443714447144571446714477144871449714507145171452714537145471455714567145771458714597146071461714627146371464714657146671467714687146971470714717147271473714747147571476714777147871479714807148171482714837148471485714867148771488714897149071491714927149371494714957149671497714987149971500715017150271503715047150571506715077150871509715107151171512715137151471515715167151771518715197152071521715227152371524715257152671527715287152971530715317153271533715347153571536715377153871539715407154171542715437154471545715467154771548715497155071551715527155371554715557155671557715587155971560715617156271563715647156571566715677156871569715707157171572715737157471575715767157771578715797158071581715827158371584715857158671587715887158971590715917159271593715947159571596715977159871599716007160171602716037160471605716067160771608716097161071611716127161371614716157161671617716187161971620716217162271623716247162571626716277162871629716307163171632716337163471635716367163771638716397164071641716427164371644716457164671647716487164971650716517165271653716547165571656716577165871659716607166171662716637166471665716667166771668716697167071671716727167371674716757167671677716787167971680716817168271683716847168571686716877168871689716907169171692716937169471695716967169771698716997170071701717027170371704717057170671707717087170971710717117171271713717147171571716717177171871719717207172171722717237172471725717267172771728717297173071731717327173371734717357173671737717387173971740717417174271743717447174571746717477174871749717507175171752717537175471755717567175771758717597176071761717627176371764717657176671767717687176971770717717177271773717747177571776717777177871779717807178171782717837178471785717867178771788717897179071791717927179371794717957179671797717987179971800718017180271803718047180571806718077180871809718107181171812718137181471815718167181771818718197182071821718227182371824718257182671827718287182971830718317183271833718347183571836718377183871839718407184171842718437184471845718467184771848718497185071851718527185371854718557185671857718587185971860718617186271863718647186571866718677186871869718707187171872718737187471875718767187771878718797188071881718827188371884718857188671887718887188971890718917189271893718947189571896718977189871899719007190171902719037190471905719067190771908719097191071911719127191371914719157191671917719187191971920719217192271923719247192571926719277192871929719307193171932719337193471935719367193771938719397194071941719427194371944719457194671947719487194971950719517195271953719547195571956719577195871959719607196171962719637196471965719667196771968719697197071971719727197371974719757197671977719787197971980719817198271983719847198571986719877198871989719907199171992719937199471995719967199771998719997200072001720027200372004720057200672007720087200972010720117201272013720147201572016720177201872019720207202172022720237202472025720267202772028720297203072031720327203372034720357203672037720387203972040720417204272043720447204572046720477204872049720507205172052720537205472055720567205772058720597206072061720627206372064720657206672067720687206972070720717207272073720747207572076720777207872079720807208172082720837208472085720867208772088720897209072091720927209372094720957209672097720987209972100721017210272103721047210572106721077210872109721107211172112721137211472115721167211772118721197212072121721227212372124721257212672127721287212972130721317213272133721347213572136721377213872139721407214172142721437214472145721467214772148721497215072151721527215372154721557215672157721587215972160721617216272163721647216572166721677216872169721707217172172721737217472175721767217772178721797218072181721827218372184721857218672187721887218972190721917219272193721947219572196721977219872199722007220172202722037220472205722067220772208722097221072211722127221372214722157221672217722187221972220722217222272223722247222572226722277222872229722307223172232722337223472235722367223772238722397224072241722427224372244722457224672247722487224972250722517225272253722547225572256722577225872259722607226172262722637226472265722667226772268722697227072271722727227372274722757227672277722787227972280722817228272283722847228572286722877228872289722907229172292722937229472295722967229772298722997230072301723027230372304723057230672307723087230972310723117231272313723147231572316723177231872319723207232172322723237232472325723267232772328723297233072331723327233372334723357233672337723387233972340723417234272343723447234572346723477234872349723507235172352723537235472355723567235772358723597236072361723627236372364723657236672367723687236972370723717237272373723747237572376723777237872379723807238172382723837238472385723867238772388723897239072391723927239372394723957239672397723987239972400724017240272403724047240572406724077240872409724107241172412724137241472415724167241772418724197242072421724227242372424724257242672427724287242972430724317243272433724347243572436724377243872439724407244172442724437244472445724467244772448724497245072451724527245372454724557245672457724587245972460724617246272463724647246572466724677246872469724707247172472724737247472475724767247772478724797248072481724827248372484724857248672487724887248972490724917249272493724947249572496724977249872499725007250172502725037250472505725067250772508725097251072511725127251372514725157251672517725187251972520725217252272523725247252572526725277252872529725307253172532725337253472535725367253772538725397254072541725427254372544725457254672547725487254972550725517255272553725547255572556725577255872559725607256172562725637256472565725667256772568725697257072571725727257372574725757257672577725787257972580725817258272583725847258572586725877258872589725907259172592725937259472595725967259772598725997260072601726027260372604726057260672607726087260972610726117261272613726147261572616726177261872619726207262172622726237262472625726267262772628726297263072631726327263372634726357263672637726387263972640726417264272643726447264572646726477264872649726507265172652726537265472655726567265772658726597266072661726627266372664726657266672667726687266972670726717267272673726747267572676726777267872679726807268172682726837268472685726867268772688726897269072691726927269372694726957269672697726987269972700727017270272703727047270572706727077270872709727107271172712727137271472715727167271772718727197272072721727227272372724727257272672727727287272972730727317273272733727347273572736727377273872739727407274172742727437274472745727467274772748727497275072751727527275372754727557275672757727587275972760727617276272763727647276572766727677276872769727707277172772727737277472775727767277772778727797278072781727827278372784727857278672787727887278972790727917279272793727947279572796727977279872799728007280172802728037280472805728067280772808728097281072811728127281372814728157281672817728187281972820728217282272823728247282572826728277282872829728307283172832728337283472835728367283772838728397284072841728427284372844728457284672847728487284972850728517285272853728547285572856728577285872859728607286172862728637286472865728667286772868728697287072871728727287372874728757287672877728787287972880728817288272883728847288572886728877288872889728907289172892728937289472895728967289772898728997290072901729027290372904729057290672907729087290972910729117291272913729147291572916729177291872919729207292172922729237292472925729267292772928729297293072931729327293372934729357293672937729387293972940729417294272943729447294572946729477294872949729507295172952729537295472955729567295772958729597296072961729627296372964729657296672967729687296972970729717297272973729747297572976729777297872979729807298172982729837298472985729867298772988729897299072991729927299372994729957299672997729987299973000730017300273003730047300573006730077300873009730107301173012730137301473015730167301773018730197302073021730227302373024730257302673027730287302973030730317303273033730347303573036730377303873039730407304173042730437304473045730467304773048730497305073051730527305373054730557305673057730587305973060730617306273063730647306573066730677306873069730707307173072730737307473075730767307773078730797308073081730827308373084730857308673087730887308973090730917309273093730947309573096730977309873099731007310173102731037310473105731067310773108731097311073111731127311373114731157311673117731187311973120731217312273123731247312573126731277312873129731307313173132731337313473135731367313773138731397314073141731427314373144731457314673147731487314973150731517315273153731547315573156731577315873159731607316173162731637316473165731667316773168731697317073171731727317373174731757317673177731787317973180731817318273183731847318573186731877318873189731907319173192731937319473195731967319773198731997320073201732027320373204732057320673207732087320973210732117321273213732147321573216732177321873219732207322173222732237322473225732267322773228732297323073231732327323373234732357323673237732387323973240732417324273243732447324573246732477324873249732507325173252732537325473255732567325773258732597326073261732627326373264732657326673267732687326973270732717327273273732747327573276732777327873279732807328173282732837328473285732867328773288732897329073291732927329373294732957329673297732987329973300733017330273303733047330573306733077330873309733107331173312733137331473315733167331773318733197332073321733227332373324733257332673327733287332973330733317333273333733347333573336733377333873339733407334173342733437334473345733467334773348733497335073351733527335373354733557335673357733587335973360733617336273363733647336573366733677336873369733707337173372733737337473375733767337773378733797338073381733827338373384733857338673387733887338973390733917339273393733947339573396733977339873399734007340173402734037340473405734067340773408734097341073411734127341373414734157341673417734187341973420734217342273423734247342573426734277342873429734307343173432734337343473435734367343773438734397344073441734427344373444734457344673447734487344973450734517345273453734547345573456734577345873459734607346173462734637346473465734667346773468734697347073471734727347373474734757347673477734787347973480734817348273483734847348573486734877348873489734907349173492734937349473495734967349773498734997350073501735027350373504735057350673507735087350973510735117351273513735147351573516735177351873519735207352173522735237352473525735267352773528735297353073531735327353373534735357353673537735387353973540735417354273543735447354573546735477354873549735507355173552735537355473555735567355773558735597356073561735627356373564735657356673567735687356973570735717357273573735747357573576735777357873579735807358173582735837358473585735867358773588735897359073591735927359373594735957359673597735987359973600736017360273603736047360573606736077360873609736107361173612736137361473615736167361773618736197362073621736227362373624736257362673627736287362973630736317363273633736347363573636736377363873639736407364173642736437364473645736467364773648736497365073651736527365373654736557365673657736587365973660736617366273663736647366573666736677366873669736707367173672736737367473675736767367773678736797368073681736827368373684736857368673687736887368973690736917369273693736947369573696736977369873699737007370173702737037370473705737067370773708737097371073711737127371373714737157371673717737187371973720737217372273723737247372573726737277372873729737307373173732737337373473735737367373773738737397374073741737427374373744737457374673747737487374973750737517375273753737547375573756737577375873759737607376173762737637376473765737667376773768737697377073771737727377373774737757377673777737787377973780737817378273783737847378573786737877378873789737907379173792737937379473795737967379773798737997380073801738027380373804738057380673807738087380973810738117381273813738147381573816738177381873819738207382173822738237382473825738267382773828738297383073831738327383373834738357383673837738387383973840738417384273843738447384573846738477384873849738507385173852738537385473855738567385773858738597386073861738627386373864738657386673867738687386973870738717387273873738747387573876738777387873879738807388173882738837388473885738867388773888738897389073891738927389373894738957389673897738987389973900739017390273903739047390573906739077390873909739107391173912739137391473915739167391773918739197392073921739227392373924739257392673927739287392973930739317393273933739347393573936739377393873939739407394173942739437394473945739467394773948739497395073951739527395373954739557395673957739587395973960739617396273963739647396573966739677396873969739707397173972739737397473975739767397773978739797398073981739827398373984739857398673987739887398973990739917399273993739947399573996739977399873999740007400174002740037400474005740067400774008740097401074011740127401374014740157401674017740187401974020740217402274023740247402574026740277402874029740307403174032740337403474035740367403774038740397404074041740427404374044740457404674047740487404974050740517405274053740547405574056740577405874059740607406174062740637406474065740667406774068740697407074071740727407374074740757407674077740787407974080740817408274083740847408574086740877408874089740907409174092740937409474095740967409774098740997410074101741027410374104741057410674107741087410974110741117411274113741147411574116741177411874119741207412174122741237412474125741267412774128741297413074131741327413374134741357413674137741387413974140741417414274143741447414574146741477414874149741507415174152741537415474155741567415774158741597416074161741627416374164741657416674167741687416974170741717417274173741747417574176741777417874179741807418174182741837418474185741867418774188741897419074191741927419374194741957419674197741987419974200742017420274203742047420574206742077420874209742107421174212742137421474215742167421774218742197422074221742227422374224742257422674227742287422974230742317423274233742347423574236742377423874239742407424174242742437424474245742467424774248742497425074251742527425374254742557425674257742587425974260742617426274263742647426574266742677426874269742707427174272742737427474275742767427774278742797428074281742827428374284742857428674287742887428974290742917429274293742947429574296742977429874299743007430174302743037430474305743067430774308743097431074311743127431374314743157431674317743187431974320743217432274323743247432574326743277432874329743307433174332743337433474335743367433774338743397434074341743427434374344743457434674347743487434974350743517435274353743547435574356743577435874359743607436174362743637436474365743667436774368743697437074371743727437374374743757437674377743787437974380743817438274383743847438574386743877438874389743907439174392743937439474395743967439774398743997440074401744027440374404744057440674407744087440974410744117441274413744147441574416744177441874419744207442174422744237442474425744267442774428744297443074431744327443374434744357443674437744387443974440744417444274443744447444574446744477444874449744507445174452744537445474455744567445774458744597446074461744627446374464744657446674467744687446974470744717447274473744747447574476744777447874479744807448174482744837448474485744867448774488744897449074491744927449374494744957449674497744987449974500745017450274503745047450574506745077450874509745107451174512745137451474515745167451774518745197452074521745227452374524745257452674527745287452974530745317453274533745347453574536745377453874539745407454174542745437454474545745467454774548745497455074551745527455374554745557455674557745587455974560745617456274563745647456574566745677456874569745707457174572745737457474575745767457774578745797458074581745827458374584745857458674587745887458974590745917459274593745947459574596745977459874599746007460174602746037460474605746067460774608746097461074611746127461374614746157461674617746187461974620746217462274623746247462574626746277462874629746307463174632746337463474635746367463774638746397464074641746427464374644746457464674647746487464974650746517465274653746547465574656746577465874659746607466174662746637466474665746667466774668746697467074671746727467374674746757467674677746787467974680746817468274683746847468574686746877468874689746907469174692746937469474695746967469774698746997470074701747027470374704747057470674707747087470974710747117471274713747147471574716747177471874719747207472174722747237472474725747267472774728747297473074731747327473374734747357473674737747387473974740747417474274743747447474574746747477474874749747507475174752747537475474755747567475774758747597476074761747627476374764747657476674767747687476974770747717477274773747747477574776747777477874779747807478174782747837478474785747867478774788747897479074791747927479374794747957479674797747987479974800748017480274803748047480574806748077480874809748107481174812748137481474815748167481774818748197482074821748227482374824748257482674827748287482974830748317483274833748347483574836748377483874839748407484174842748437484474845748467484774848748497485074851748527485374854748557485674857748587485974860748617486274863748647486574866748677486874869748707487174872748737487474875748767487774878748797488074881748827488374884748857488674887748887488974890748917489274893748947489574896748977489874899749007490174902749037490474905749067490774908749097491074911749127491374914749157491674917749187491974920749217492274923749247492574926749277492874929749307493174932749337493474935749367493774938749397494074941749427494374944749457494674947749487494974950749517495274953749547495574956749577495874959749607496174962749637496474965749667496774968749697497074971749727497374974749757497674977749787497974980749817498274983749847498574986749877498874989749907499174992749937499474995749967499774998749997500075001750027500375004750057500675007750087500975010750117501275013750147501575016750177501875019750207502175022750237502475025750267502775028750297503075031750327503375034750357503675037750387503975040750417504275043750447504575046750477504875049750507505175052750537505475055750567505775058750597506075061750627506375064750657506675067750687506975070750717507275073750747507575076750777507875079750807508175082750837508475085750867508775088750897509075091750927509375094750957509675097750987509975100751017510275103751047510575106751077510875109751107511175112751137511475115751167511775118751197512075121751227512375124751257512675127751287512975130751317513275133751347513575136751377513875139751407514175142751437514475145751467514775148751497515075151751527515375154751557515675157751587515975160751617516275163751647516575166751677516875169751707517175172751737517475175751767517775178751797518075181751827518375184751857518675187751887518975190751917519275193751947519575196751977519875199752007520175202752037520475205752067520775208752097521075211752127521375214752157521675217752187521975220752217522275223752247522575226752277522875229752307523175232752337523475235752367523775238752397524075241752427524375244752457524675247752487524975250752517525275253752547525575256752577525875259752607526175262752637526475265752667526775268752697527075271752727527375274752757527675277752787527975280752817528275283752847528575286752877528875289752907529175292752937529475295752967529775298752997530075301753027530375304753057530675307753087530975310753117531275313753147531575316753177531875319753207532175322753237532475325753267532775328753297533075331753327533375334753357533675337753387533975340753417534275343753447534575346753477534875349753507535175352753537535475355753567535775358753597536075361753627536375364753657536675367753687536975370753717537275373753747537575376753777537875379753807538175382753837538475385753867538775388753897539075391753927539375394753957539675397753987539975400754017540275403754047540575406754077540875409754107541175412754137541475415754167541775418754197542075421754227542375424754257542675427754287542975430754317543275433754347543575436754377543875439754407544175442754437544475445754467544775448754497545075451754527545375454754557545675457754587545975460754617546275463754647546575466754677546875469754707547175472754737547475475754767547775478754797548075481754827548375484754857548675487754887548975490754917549275493754947549575496754977549875499755007550175502755037550475505755067550775508755097551075511755127551375514755157551675517755187551975520755217552275523755247552575526755277552875529755307553175532755337553475535755367553775538755397554075541755427554375544755457554675547755487554975550755517555275553755547555575556755577555875559755607556175562755637556475565755667556775568755697557075571755727557375574755757557675577755787557975580755817558275583755847558575586755877558875589755907559175592755937559475595755967559775598755997560075601756027560375604756057560675607756087560975610756117561275613756147561575616756177561875619756207562175622756237562475625756267562775628756297563075631756327563375634756357563675637756387563975640756417564275643756447564575646756477564875649756507565175652756537565475655756567565775658756597566075661756627566375664756657566675667756687566975670756717567275673756747567575676756777567875679756807568175682756837568475685756867568775688756897569075691756927569375694756957569675697756987569975700757017570275703757047570575706757077570875709757107571175712757137571475715757167571775718757197572075721757227572375724757257572675727757287572975730757317573275733757347573575736757377573875739757407574175742757437574475745757467574775748757497575075751757527575375754757557575675757757587575975760757617576275763757647576575766757677576875769757707577175772757737577475775757767577775778757797578075781757827578375784757857578675787757887578975790757917579275793757947579575796757977579875799758007580175802758037580475805758067580775808758097581075811758127581375814758157581675817758187581975820758217582275823758247582575826758277582875829758307583175832758337583475835758367583775838758397584075841758427584375844758457584675847758487584975850758517585275853758547585575856758577585875859758607586175862758637586475865758667586775868758697587075871758727587375874758757587675877758787587975880758817588275883758847588575886758877588875889758907589175892758937589475895758967589775898758997590075901759027590375904759057590675907759087590975910759117591275913759147591575916759177591875919759207592175922759237592475925759267592775928759297593075931759327593375934759357593675937759387593975940759417594275943759447594575946759477594875949759507595175952759537595475955759567595775958759597596075961759627596375964759657596675967759687596975970759717597275973759747597575976759777597875979759807598175982759837598475985759867598775988759897599075991759927599375994759957599675997759987599976000760017600276003760047600576006760077600876009760107601176012760137601476015760167601776018760197602076021760227602376024760257602676027760287602976030760317603276033760347603576036760377603876039760407604176042760437604476045760467604776048760497605076051760527605376054760557605676057760587605976060760617606276063760647606576066760677606876069760707607176072760737607476075760767607776078760797608076081760827608376084760857608676087760887608976090760917609276093760947609576096760977609876099761007610176102761037610476105761067610776108761097611076111761127611376114761157611676117761187611976120761217612276123761247612576126761277612876129761307613176132761337613476135761367613776138761397614076141761427614376144761457614676147761487614976150761517615276153761547615576156761577615876159761607616176162761637616476165761667616776168761697617076171761727617376174761757617676177761787617976180761817618276183761847618576186761877618876189761907619176192761937619476195761967619776198761997620076201762027620376204762057620676207762087620976210762117621276213762147621576216762177621876219762207622176222762237622476225762267622776228762297623076231762327623376234762357623676237762387623976240762417624276243762447624576246762477624876249762507625176252762537625476255762567625776258762597626076261762627626376264762657626676267762687626976270762717627276273762747627576276762777627876279762807628176282762837628476285762867628776288762897629076291762927629376294762957629676297762987629976300763017630276303763047630576306763077630876309763107631176312763137631476315763167631776318763197632076321763227632376324763257632676327763287632976330763317633276333763347633576336763377633876339763407634176342763437634476345763467634776348763497635076351763527635376354763557635676357763587635976360763617636276363763647636576366763677636876369763707637176372763737637476375763767637776378763797638076381763827638376384763857638676387763887638976390763917639276393763947639576396763977639876399764007640176402764037640476405764067640776408764097641076411764127641376414764157641676417764187641976420764217642276423764247642576426764277642876429764307643176432764337643476435764367643776438764397644076441764427644376444764457644676447764487644976450764517645276453764547645576456764577645876459764607646176462764637646476465764667646776468764697647076471764727647376474764757647676477764787647976480764817648276483764847648576486764877648876489764907649176492764937649476495764967649776498764997650076501765027650376504765057650676507765087650976510765117651276513765147651576516765177651876519765207652176522765237652476525765267652776528765297653076531765327653376534765357653676537765387653976540765417654276543765447654576546765477654876549765507655176552765537655476555765567655776558765597656076561765627656376564765657656676567765687656976570765717657276573765747657576576765777657876579765807658176582765837658476585765867658776588765897659076591765927659376594765957659676597765987659976600766017660276603766047660576606766077660876609766107661176612766137661476615766167661776618766197662076621766227662376624766257662676627766287662976630766317663276633766347663576636766377663876639766407664176642766437664476645766467664776648766497665076651766527665376654766557665676657766587665976660766617666276663766647666576666766677666876669766707667176672766737667476675766767667776678766797668076681766827668376684766857668676687766887668976690766917669276693766947669576696766977669876699767007670176702767037670476705767067670776708767097671076711767127671376714767157671676717767187671976720767217672276723767247672576726767277672876729767307673176732767337673476735767367673776738767397674076741767427674376744767457674676747767487674976750767517675276753767547675576756767577675876759767607676176762767637676476765767667676776768767697677076771767727677376774767757677676777767787677976780767817678276783767847678576786767877678876789767907679176792767937679476795767967679776798767997680076801768027680376804768057680676807768087680976810768117681276813768147681576816768177681876819768207682176822768237682476825768267682776828768297683076831768327683376834768357683676837768387683976840768417684276843768447684576846768477684876849768507685176852768537685476855768567685776858768597686076861768627686376864768657686676867768687686976870768717687276873768747687576876768777687876879768807688176882768837688476885768867688776888768897689076891768927689376894768957689676897768987689976900769017690276903769047690576906769077690876909769107691176912769137691476915769167691776918769197692076921769227692376924769257692676927769287692976930769317693276933769347693576936769377693876939769407694176942769437694476945769467694776948769497695076951769527695376954769557695676957769587695976960769617696276963769647696576966769677696876969769707697176972769737697476975769767697776978769797698076981769827698376984769857698676987769887698976990769917699276993769947699576996769977699876999770007700177002770037700477005770067700777008770097701077011770127701377014770157701677017770187701977020770217702277023770247702577026770277702877029770307703177032770337703477035770367703777038770397704077041770427704377044770457704677047770487704977050770517705277053770547705577056770577705877059770607706177062770637706477065770667706777068770697707077071770727707377074770757707677077770787707977080770817708277083770847708577086770877708877089770907709177092770937709477095770967709777098770997710077101771027710377104771057710677107771087710977110771117711277113771147711577116771177711877119771207712177122771237712477125771267712777128771297713077131771327713377134771357713677137771387713977140771417714277143771447714577146771477714877149771507715177152771537715477155771567715777158771597716077161771627716377164771657716677167771687716977170771717717277173771747717577176771777717877179771807718177182771837718477185771867718777188771897719077191771927719377194771957719677197771987719977200772017720277203772047720577206772077720877209772107721177212772137721477215772167721777218772197722077221772227722377224772257722677227772287722977230772317723277233772347723577236772377723877239772407724177242772437724477245772467724777248772497725077251772527725377254772557725677257772587725977260772617726277263772647726577266772677726877269772707727177272772737727477275772767727777278772797728077281772827728377284772857728677287772887728977290772917729277293772947729577296772977729877299773007730177302773037730477305773067730777308773097731077311773127731377314773157731677317773187731977320773217732277323773247732577326773277732877329773307733177332773337733477335773367733777338773397734077341773427734377344773457734677347773487734977350773517735277353773547735577356773577735877359773607736177362773637736477365773667736777368773697737077371773727737377374773757737677377773787737977380773817738277383773847738577386773877738877389773907739177392773937739477395773967739777398773997740077401774027740377404774057740677407774087740977410774117741277413774147741577416774177741877419774207742177422774237742477425774267742777428774297743077431774327743377434774357743677437774387743977440774417744277443774447744577446774477744877449774507745177452774537745477455774567745777458774597746077461774627746377464774657746677467774687746977470774717747277473774747747577476774777747877479774807748177482774837748477485774867748777488774897749077491774927749377494774957749677497774987749977500775017750277503775047750577506775077750877509775107751177512775137751477515775167751777518775197752077521775227752377524775257752677527775287752977530775317753277533775347753577536775377753877539775407754177542775437754477545775467754777548775497755077551775527755377554775557755677557775587755977560775617756277563775647756577566775677756877569775707757177572775737757477575775767757777578775797758077581775827758377584775857758677587775887758977590775917759277593775947759577596775977759877599776007760177602776037760477605776067760777608776097761077611776127761377614776157761677617776187761977620776217762277623776247762577626776277762877629776307763177632776337763477635776367763777638776397764077641776427764377644776457764677647776487764977650776517765277653776547765577656776577765877659776607766177662776637766477665776667766777668776697767077671776727767377674776757767677677776787767977680776817768277683776847768577686776877768877689776907769177692776937769477695776967769777698776997770077701777027770377704777057770677707777087770977710777117771277713777147771577716777177771877719777207772177722777237772477725777267772777728777297773077731777327773377734777357773677737777387773977740777417774277743777447774577746777477774877749777507775177752777537775477755777567775777758777597776077761777627776377764777657776677767777687776977770777717777277773777747777577776777777777877779777807778177782777837778477785777867778777788777897779077791777927779377794777957779677797777987779977800778017780277803778047780577806778077780877809778107781177812778137781477815778167781777818778197782077821778227782377824778257782677827778287782977830778317783277833778347783577836778377783877839778407784177842778437784477845778467784777848778497785077851778527785377854778557785677857778587785977860778617786277863778647786577866778677786877869778707787177872778737787477875778767787777878778797788077881778827788377884778857788677887778887788977890778917789277893778947789577896778977789877899779007790177902779037790477905779067790777908779097791077911779127791377914779157791677917779187791977920779217792277923779247792577926779277792877929779307793177932779337793477935779367793777938779397794077941779427794377944779457794677947779487794977950779517795277953779547795577956779577795877959779607796177962779637796477965779667796777968779697797077971779727797377974779757797677977779787797977980779817798277983779847798577986779877798877989779907799177992779937799477995779967799777998779997800078001780027800378004780057800678007780087800978010780117801278013780147801578016780177801878019780207802178022780237802478025780267802778028780297803078031780327803378034780357803678037780387803978040780417804278043780447804578046780477804878049780507805178052780537805478055780567805778058780597806078061780627806378064780657806678067780687806978070780717807278073780747807578076780777807878079780807808178082780837808478085780867808778088780897809078091780927809378094780957809678097780987809978100781017810278103781047810578106781077810878109781107811178112781137811478115781167811778118781197812078121781227812378124781257812678127781287812978130781317813278133781347813578136781377813878139781407814178142781437814478145781467814778148781497815078151781527815378154781557815678157781587815978160781617816278163781647816578166781677816878169781707817178172781737817478175781767817778178781797818078181781827818378184781857818678187781887818978190781917819278193781947819578196781977819878199782007820178202782037820478205782067820778208782097821078211782127821378214782157821678217782187821978220782217822278223782247822578226782277822878229782307823178232782337823478235782367823778238782397824078241782427824378244782457824678247782487824978250782517825278253782547825578256782577825878259782607826178262782637826478265782667826778268782697827078271782727827378274782757827678277782787827978280782817828278283782847828578286782877828878289782907829178292782937829478295782967829778298782997830078301783027830378304783057830678307783087830978310783117831278313783147831578316783177831878319783207832178322783237832478325783267832778328783297833078331783327833378334783357833678337783387833978340783417834278343783447834578346783477834878349783507835178352783537835478355783567835778358783597836078361783627836378364783657836678367783687836978370783717837278373783747837578376783777837878379783807838178382783837838478385783867838778388783897839078391783927839378394783957839678397783987839978400784017840278403784047840578406784077840878409784107841178412784137841478415784167841778418784197842078421784227842378424784257842678427784287842978430784317843278433784347843578436784377843878439784407844178442784437844478445784467844778448784497845078451784527845378454784557845678457784587845978460784617846278463784647846578466784677846878469784707847178472784737847478475784767847778478784797848078481784827848378484784857848678487784887848978490784917849278493784947849578496784977849878499785007850178502785037850478505785067850778508785097851078511785127851378514785157851678517785187851978520785217852278523785247852578526785277852878529785307853178532785337853478535785367853778538785397854078541785427854378544785457854678547785487854978550785517855278553785547855578556785577855878559785607856178562785637856478565785667856778568785697857078571785727857378574785757857678577785787857978580785817858278583785847858578586785877858878589785907859178592785937859478595785967859778598785997860078601786027860378604786057860678607786087860978610786117861278613786147861578616786177861878619786207862178622786237862478625786267862778628786297863078631786327863378634786357863678637786387863978640786417864278643786447864578646786477864878649786507865178652786537865478655786567865778658786597866078661786627866378664786657866678667786687866978670786717867278673786747867578676786777867878679786807868178682786837868478685786867868778688786897869078691786927869378694786957869678697786987869978700787017870278703787047870578706787077870878709787107871178712787137871478715787167871778718787197872078721787227872378724787257872678727787287872978730787317873278733787347873578736787377873878739787407874178742787437874478745787467874778748787497875078751787527875378754787557875678757787587875978760787617876278763787647876578766787677876878769787707877178772787737877478775787767877778778787797878078781787827878378784787857878678787787887878978790787917879278793787947879578796787977879878799788007880178802788037880478805788067880778808788097881078811788127881378814788157881678817788187881978820788217882278823788247882578826788277882878829788307883178832788337883478835788367883778838788397884078841788427884378844788457884678847788487884978850788517885278853788547885578856788577885878859788607886178862788637886478865788667886778868788697887078871788727887378874788757887678877788787887978880788817888278883788847888578886788877888878889788907889178892788937889478895788967889778898788997890078901789027890378904789057890678907789087890978910789117891278913789147891578916789177891878919789207892178922789237892478925789267892778928789297893078931789327893378934789357893678937789387893978940789417894278943789447894578946789477894878949789507895178952789537895478955789567895778958789597896078961789627896378964789657896678967789687896978970789717897278973789747897578976789777897878979789807898178982789837898478985789867898778988789897899078991789927899378994789957899678997789987899979000790017900279003790047900579006790077900879009790107901179012790137901479015790167901779018790197902079021790227902379024790257902679027790287902979030790317903279033790347903579036790377903879039790407904179042790437904479045790467904779048790497905079051790527905379054790557905679057790587905979060790617906279063790647906579066790677906879069790707907179072790737907479075790767907779078790797908079081790827908379084790857908679087790887908979090790917909279093790947909579096790977909879099791007910179102791037910479105791067910779108791097911079111791127911379114791157911679117791187911979120791217912279123791247912579126791277912879129791307913179132791337913479135791367913779138791397914079141791427914379144791457914679147791487914979150791517915279153791547915579156791577915879159791607916179162791637916479165791667916779168791697917079171791727917379174791757917679177791787917979180791817918279183791847918579186791877918879189791907919179192791937919479195791967919779198791997920079201792027920379204792057920679207792087920979210792117921279213792147921579216792177921879219792207922179222792237922479225792267922779228792297923079231792327923379234792357923679237792387923979240792417924279243792447924579246792477924879249792507925179252792537925479255792567925779258792597926079261792627926379264792657926679267792687926979270792717927279273792747927579276792777927879279792807928179282792837928479285792867928779288792897929079291792927929379294792957929679297792987929979300793017930279303793047930579306793077930879309793107931179312793137931479315793167931779318793197932079321793227932379324793257932679327793287932979330793317933279333793347933579336793377933879339793407934179342793437934479345793467934779348793497935079351793527935379354793557935679357793587935979360793617936279363793647936579366793677936879369793707937179372793737937479375793767937779378793797938079381793827938379384793857938679387793887938979390793917939279393793947939579396793977939879399794007940179402794037940479405794067940779408794097941079411794127941379414794157941679417794187941979420794217942279423794247942579426794277942879429794307943179432794337943479435794367943779438794397944079441794427944379444794457944679447794487944979450794517945279453794547945579456794577945879459794607946179462794637946479465794667946779468794697947079471794727947379474794757947679477794787947979480794817948279483794847948579486794877948879489794907949179492794937949479495794967949779498794997950079501795027950379504795057950679507795087950979510795117951279513795147951579516795177951879519795207952179522795237952479525795267952779528795297953079531795327953379534795357953679537795387953979540795417954279543795447954579546795477954879549795507955179552795537955479555795567955779558795597956079561795627956379564795657956679567795687956979570795717957279573795747957579576795777957879579795807958179582795837958479585795867958779588795897959079591795927959379594795957959679597795987959979600796017960279603796047960579606796077960879609796107961179612796137961479615796167961779618796197962079621796227962379624796257962679627796287962979630796317963279633796347963579636796377963879639796407964179642796437964479645796467964779648796497965079651796527965379654796557965679657796587965979660796617966279663796647966579666796677966879669796707967179672796737967479675796767967779678796797968079681796827968379684796857968679687796887968979690796917969279693796947969579696796977969879699797007970179702797037970479705797067970779708797097971079711797127971379714797157971679717797187971979720797217972279723797247972579726797277972879729797307973179732797337973479735797367973779738797397974079741797427974379744797457974679747797487974979750797517975279753797547975579756797577975879759797607976179762797637976479765797667976779768797697977079771797727977379774797757977679777797787977979780797817978279783797847978579786797877978879789797907979179792797937979479795797967979779798797997980079801798027980379804798057980679807798087980979810798117981279813798147981579816798177981879819798207982179822798237982479825798267982779828798297983079831798327983379834798357983679837798387983979840798417984279843798447984579846798477984879849798507985179852798537985479855798567985779858798597986079861798627986379864798657986679867798687986979870798717987279873798747987579876798777987879879798807988179882798837988479885798867988779888798897989079891798927989379894798957989679897798987989979900799017990279903799047990579906799077990879909799107991179912799137991479915799167991779918799197992079921799227992379924799257992679927799287992979930799317993279933799347993579936799377993879939799407994179942
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of Composer.
  5. *
  6. * (c) Nils Adermann <naderman@naderman.de>
  7. * Jordi Boggiano <j.boggiano@seld.be>
  8. *
  9. * For the full copyright and license information, please view
  10. * the license that is located at the bottom of this file.
  11. */
  12. // Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264
  13. if (extension_loaded('apc') && ini_get('apc.enable_cli') && ini_get('apc.cache_by_default')) {
  14. if (version_compare(phpversion('apc'), '3.0.12', '>=')) {
  15. ini_set('apc.cache_by_default', 0);
  16. } else {
  17. fwrite(STDERR, 'Warning: APC <= 3.0.12 may cause fatal errors when running composer commands.'.PHP_EOL);
  18. fwrite(STDERR, 'Update APC, or set apc.enable_cli or apc.cache_by_default to 0 in your php.ini.'.PHP_EOL);
  19. }
  20. }
  21. Phar::mapPhar('composer.phar');
  22. require 'phar://composer.phar/bin/composer';
  23. __HALT_COMPILER(); ?>
  24. í„��Ä������ ���composer.phar����+���src/Composer/Autoload/AutoloadGenerator.php_��øtÖW_��¤F=¶������+���src/Composer/Autoload/ClassMapGenerator.php•��øtÖW•��î$»'¶���������src/Composer/Cache.php÷��øtÖW÷��;�¿à¶������%���src/Composer/Command/AboutCommand.phpÀ��øtÖWÀ��ÄiWR¶������'���src/Composer/Command/ArchiveCommand.php ��øtÖW ��ò±Ü›¶������$���src/Composer/Command/BaseCommand.php´��øtÖW´��çŽ_¶������.���src/Composer/Command/BaseDependencyCommand.phpÉ��øtÖWÉ��D{²Ð¶������*���src/Composer/Command/ClearCacheCommand.php^��øtÖW^��ƒ÷�¶������&���src/Composer/Command/ConfigCommand.php G��øtÖW G��p}b¶������-���src/Composer/Command/CreateProjectCommand.php97��øtÖW97��Ÿç€t¶������'���src/Composer/Command/DependsCommand.php¶��øtÖW¶��á0¶������(���src/Composer/Command/DiagnoseCommand.phpZF��øtÖWZF��Bð&¶������,���src/Composer/Command/DumpAutoloadCommand.phpß��øtÖWß��¬xxK¶������$���src/Composer/Command/ExecCommand.phpÜ��øtÖWÜ��êm3î¶������&���src/Composer/Command/GlobalCommand.phpw��øtÖWw��c¡/ï¶������$���src/Composer/Command/HomeCommand.php��øtÖW��c¼±¶������$���src/Composer/Command/InitCommand.php5=��øtÖW5=��À“,'¶������'���src/Composer/Command/InstallCommand.phpM��øtÖWM��K3b¶������(���src/Composer/Command/LicensesCommand.php$��øtÖW$��²Jïë¶������(���src/Composer/Command/OutdatedCommand.php<��øtÖW<��b²{¶������)���src/Composer/Command/ProhibitsCommand.phpÊ��øtÖWÊ��—ÕÓ€¶������&���src/Composer/Command/RemoveCommand.phpÂ��øtÖWÂ��† bn¶������'���src/Composer/Command/RequireCommand.phpa��øtÖWa��ß�̶������)���src/Composer/Command/RunScriptCommand.phph ��øtÖWh ��õÀçÓ¶������+���src/Composer/Command/ScriptAliasCommand.php��øtÖW��®%þ›¶������&���src/Composer/Command/SearchCommand.phpà��øtÖWà��à2ó^¶������*���src/Composer/Command/SelfUpdateCommand.php0��øtÖW0��ÿ¯®¶������$���src/Composer/Command/ShowCommand.php¼V��øtÖW¼V��PÌ–¶������&���src/Composer/Command/StatusCommand.php2��øtÖW2��Š­X¶������(���src/Composer/Command/SuggestsCommand.php§ ��øtÖW§ ��Ìxî]¶������&���src/Composer/Command/UpdateCommand.php«"��øtÖW«"��Õ�'õ¶������(���src/Composer/Command/ValidateCommand.php��øtÖW��tN¹¶���������src/Composer/Composer.phpÿ��øtÖWÿ���Ë®"¶���������src/Composer/Config.php!��øtÖW!��-8\\¶������-���src/Composer/Config/ConfigSourceInterface.php��øtÖW��³ [/¶������(���src/Composer/Config/JsonConfigSource.php«��øtÖW«��,sÐ@¶������$���src/Composer/Console/Application.php1��øtÖW1��‰èˆ|¶������,���src/Composer/Console/HtmlOutputFormatter.php3��øtÖW3��Ú�Eu¶������-���src/Composer/DependencyResolver/Decisions.phpQ��øtÖWQ��?˜¬$¶������1���src/Composer/DependencyResolver/DefaultPolicy.php��øtÖW��õÝv¶������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpC��øtÖWC��´\õ*¶������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷��øtÖW÷��ïÎà÷¶������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpý��øtÖWý��3#†¶������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpÓ���øtÖWÓ���Ùâ&ä¶������=���src/Composer/DependencyResolver/Operation/SolverOperation.php¹��øtÖW¹��&¢e
  25. ¶������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpI��øtÖWI��FûÂɶ������=���src/Composer/DependencyResolver/Operation/UpdateOperation.phph��øtÖWh��öSÕ]¶������3���src/Composer/DependencyResolver/PolicyInterface.php­��øtÖW­��Ÿ‹R¶������(���src/Composer/DependencyResolver/Pool.php°"��øtÖW°"�� Ž%¶������+���src/Composer/DependencyResolver/Problem.php™��øtÖW™��´‡Ä¶������+���src/Composer/DependencyResolver/Request.phpƒ��øtÖWƒ��åVP„¶������(���src/Composer/DependencyResolver/Rule.php��øtÖW��Ê%û¶������+���src/Composer/DependencyResolver/RuleSet.php
  26. ��øtÖW
  27. ��:Z�E¶������4���src/Composer/DependencyResolver/RuleSetGenerator.php]��øtÖW]��4“Ñ9¶������3���src/Composer/DependencyResolver/RuleSetIterator.php��øtÖW��}õÇù¶������2���src/Composer/DependencyResolver/RuleWatchChain.phpi��øtÖWi��hïš,¶������2���src/Composer/DependencyResolver/RuleWatchGraph.phpÜ��øtÖWÜ��‰8¶������1���src/Composer/DependencyResolver/RuleWatchNode.phpç��øtÖWç��—Þȶ������*���src/Composer/DependencyResolver/Solver.php78��øtÖW78��¾f:þ¶������6���src/Composer/DependencyResolver/SolverBugException.php˜��øtÖW˜��"qN¶������;���src/Composer/DependencyResolver/SolverProblemsException.php[��øtÖW[��bQgJ¶������/���src/Composer/DependencyResolver/Transaction.phpó��øtÖWó��óö«¶������-���src/Composer/Downloader/ArchiveDownloader.php¢��øtÖW¢��vmtO¶������1���src/Composer/Downloader/ChangeReportInterface.phpÌ���øtÖWÌ���¯à¨¿¶������+���src/Composer/Downloader/DownloadManager.phpG��øtÖWG��Š(í»¶������/���src/Composer/Downloader/DownloaderInterface.phpÊ��øtÖWÊ��gs!l¶������3���src/Composer/Downloader/DvcsDownloaderInterface.phpÑ���øtÖWÑ���&Áœ¿¶������*���src/Composer/Downloader/FileDownloader.phpÎ��øtÖWÎ��èêÄ—¶������/���src/Composer/Downloader/FilesystemException.php
  28. ��øtÖW
  29. ��.-‹¶������,���src/Composer/Downloader/FossilDownloader.phpp ��øtÖWp ��=ˆU¶������)���src/Composer/Downloader/GitDownloader.php$2��øtÖW$2��¢×&&¶������*���src/Composer/Downloader/GzipDownloader.phpó��øtÖWó��}Úo¶������(���src/Composer/Downloader/HgDownloader.php? ��øtÖW? ��<v2¶������*���src/Composer/Downloader/PathDownloader.php��øtÖW��ë‘é¶������0���src/Composer/Downloader/PearPackageExtractor.phpu��øtÖWu��z„‡¶������.���src/Composer/Downloader/PerforceDownloader.phpÇ��øtÖWÇ��vxV=¶������*���src/Composer/Downloader/PharDownloader.phpå���øtÖWå���ÞÉç¶������)���src/Composer/Downloader/RarDownloader.php%��øtÖW%��û¥ .¶������)���src/Composer/Downloader/SvnDownloader.phpM��øtÖWM��·¸r¶������)���src/Composer/Downloader/TarDownloader.phpã���øtÖWã���Í’X?¶������.���src/Composer/Downloader/TransportException.php=��øtÖW=��ZÎÈÞ¶������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpÕ���øtÖWÕ���RFἶ������)���src/Composer/Downloader/VcsDownloader.php>��øtÖW>��SÚàc¶������(���src/Composer/Downloader/XzDownloader.php§��øtÖW§��W$;á¶������)���src/Composer/Downloader/ZipDownloader.phpo ��øtÖWo ��;R‹'¶������&���src/Composer/EventDispatcher/Event.php ��øtÖW ��±™jï¶������0���src/Composer/EventDispatcher/EventDispatcher.phpË+��øtÖWË+��ÖÆOO¶������9���src/Composer/EventDispatcher/EventSubscriberInterface.php©���øtÖW©���h·0¶������9���src/Composer/EventDispatcher/ScriptExecutionException.phpv���øtÖWv���wZ8S¶������)���src/Composer/Exception/NoSslException.phpf���øtÖWf���ËíM�¶���������src/Composer/Factory.php`;��øtÖW`;�� »<¶���������src/Composer/IO/BaseIO.phpÞ��øtÖWÞ��ÂŒµÓ¶���������src/Composer/IO/BufferIO.php*��øtÖW*��¢®hT¶���������src/Composer/IO/ConsoleIO.php1��øtÖW1��……éi¶���������src/Composer/IO/IOInterface.phpì��øtÖWì���Õ�¶���������src/Composer/IO/NullIO.phpÀ��øtÖWÀ��F`sʶ���������src/Composer/Installer.phpÌ���øtÖWÌ���t¤_p¶������*���src/Composer/Installer/BinaryInstaller.php¸��øtÖW¸��zJy¶������2���src/Composer/Installer/BinaryPresenceInterface.phpË���øtÖWË���À5š¨¶������.���src/Composer/Installer/InstallationManager.php-��øtÖW-��¾}Œ7¶������)���src/Composer/Installer/InstallerEvent.php��øtÖW��lÔzi¶������*���src/Composer/Installer/InstallerEvents.phpÞ���øtÖWÞ���ìŸ@G¶������-���src/Composer/Installer/InstallerInterface.phpã��øtÖWã��^ƒ“ʶ������+���src/Composer/Installer/LibraryInstaller.php^��øtÖW^��Ír¶������/���src/Composer/Installer/MetapackageInstaller.phpœ��øtÖWœ��ÆÅ!¶������(���src/Composer/Installer/NoopInstaller.php+��øtÖW+��À·M}¶������'���src/Composer/Installer/PackageEvent.phpe��øtÖWe��;° ¶������(���src/Composer/Installer/PackageEvents.php¸��øtÖW¸��dbØs¶������.���src/Composer/Installer/PearBinaryInstaller.phpâ ��øtÖWâ ��;øiU¶������(���src/Composer/Installer/PearInstaller.php¢��øtÖW¢��È‚¶Ñ¶������*���src/Composer/Installer/PluginInstaller.phpŸ��øtÖWŸ��<tú,¶������+���src/Composer/Installer/ProjectInstaller.php��øtÖW��*0@P¶������4���src/Composer/Installer/SuggestedPackagesReporter.phpª��øtÖWª��àGö���������src/Composer/Json/JsonFile.php°��øtÖW°���°žc¶������#���src/Composer/Json/JsonFormatter.php��øtÖW��Ðqu¶������%���src/Composer/Json/JsonManipulator.php /��øtÖW /��zlŽ¶������-���src/Composer/Json/JsonValidationException.php\��øtÖW\��.Xóܶ������%���src/Composer/Package/AliasPackage.php��øtÖW��¹—~š¶������7���src/Composer/Package/Archiver/ArchivableFilesFilter.php��øtÖW��jø¾å¶������7���src/Composer/Package/Archiver/ArchivableFilesFinder.php���øtÖW���MŸ2¶������0���src/Composer/Package/Archiver/ArchiveManager.phpz ��øtÖWz ��!sK™¶������3���src/Composer/Package/Archiver/ArchiverInterface.phpï���øtÖWï���<ʸ¶������3���src/Composer/Package/Archiver/BaseExcludeFilter.php–��øtÖW–��y¶=ƶ������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php��øtÖW��‹SZ0¶������2���src/Composer/Package/Archiver/GitExcludeFilter.phpq��øtÖWq��5¾i&¶������1���src/Composer/Package/Archiver/HgExcludeFilter.php��øtÖW��~”¸¶������.���src/Composer/Package/Archiver/PharArchiver.php��øtÖW��£´£¶������-���src/Composer/Package/Archiver/ZipArchiver.php”��øtÖW”��*K *¶������$���src/Composer/Package/BasePackage.php= ��øtÖW= ��Î�ç¶������(���src/Composer/Package/CompletePackage.phpÿ��øtÖWÿ��o+ã ¶������1���src/Composer/Package/CompletePackageInterface.phpõ��øtÖWõ��¦Ê�ò¶������+���src/Composer/Package/Dumper/ArrayDumper.phpì ��øtÖWì ��ª–æ¶���������src/Composer/Package/Link.phpˆ��øtÖWˆ��å¶Y«¶������7���src/Composer/Package/LinkConstraint/EmptyConstraint.php‚��øtÖW‚��é~‹¶������?���src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpd��øtÖWd��¤ôLn¶������7���src/Composer/Package/LinkConstraint/MultiConstraint.php‚��øtÖW‚��ób`ý¶������:���src/Composer/Package/LinkConstraint/SpecificConstraint.phpi��øtÖWi��Þ”š%¶������9���src/Composer/Package/LinkConstraint/VersionConstraint.phpX��øtÖWX��}`y¶������+���src/Composer/Package/Loader/ArrayLoader.phpÖ��øtÖWÖ��¦š¡X¶������7���src/Composer/Package/Loader/InvalidPackageException.phpE��øtÖWE��xb¾¶������*���src/Composer/Package/Loader/JsonLoader.phpù��øtÖWù��!~ˆ{¶������/���src/Composer/Package/Loader/LoaderInterface.php²���øtÖW²���¦}úζ������1���src/Composer/Package/Loader/RootPackageLoader.php½��øtÖW½��I¢�i¶������5���src/Composer/Package/Loader/ValidatingArrayLoader.php½1��øtÖW½1��ÅnÚѶ���������src/Composer/Package/Locker.php�!��øtÖW�!��=-w’¶������ ���src/Composer/Package/Package.phpÉ��øtÖWÉ��cÃ�h¶������)���src/Composer/Package/PackageInterface.php ��øtÖW ��ûÇ^ƶ������)���src/Composer/Package/RootAliasPackage.php ��øtÖW �� _€ø¶������$���src/Composer/Package/RootPackage.php��øtÖW��ŽÎ_¶������-���src/Composer/Package/RootPackageInterface.php¹��øtÖW¹��"maV¶������/���src/Composer/Package/Version/VersionGuesser.phpy��øtÖWy��wí­>¶������.���src/Composer/Package/Version/VersionParser.phpø��øtÖWø��¾3l¶������0���src/Composer/Package/Version/VersionSelector.phpÌ ��øtÖWÌ ��ÈQ|¶������-���src/Composer/Plugin/Capability/Capability.phpW���øtÖWW���æ_¨1¶������2���src/Composer/Plugin/Capability/CommandProvider.php—���øtÖW—���ûOâ>¶���������src/Composer/Plugin/Capable.php���øtÖW���Æq+¶������$���src/Composer/Plugin/CommandEvent.phpâ��øtÖWâ��³ÆÇW¶������$���src/Composer/Plugin/PluginEvents.phpÂ���øtÖWÂ���^Íþ¶������'���src/Composer/Plugin/PluginInterface.phpô���øtÖWô���)'*ض������%���src/Composer/Plugin/PluginManager.php$��øtÖW$��sv P¶������,���src/Composer/Plugin/PreFileDownloadEvent.php`��øtÖW`���9-ζ������+���src/Composer/Repository/ArrayRepository.php��øtÖW��éÌt�¶������.���src/Composer/Repository/ArtifactRepository.php® ��øtÖW® ��ž—Ñ϶������*���src/Composer/Repository/BaseRepository.php_ ��øtÖW_ ��–û߶������.���src/Composer/Repository/ComposerRepository.phppM��øtÖWpM��ýa¶������/���src/Composer/Repository/CompositeRepository.php;��øtÖW;��¤¯S¶������;���src/Composer/Repository/ConfigurableRepositoryInterface.php…���øtÖW…���±Ÿ_¶������0���src/Composer/Repository/FilesystemRepository.php×��øtÖW×��Iœª¶������4���src/Composer/Repository/InstalledArrayRepository.php£���øtÖW£���/ö~>¶������9���src/Composer/Repository/InstalledFilesystemRepository.php£���øtÖW£���V
  30. •_¶������8���src/Composer/Repository/InstalledRepositoryInterface.php‡���øtÖW‡���£9p¶������6���src/Composer/Repository/InvalidRepositoryException.phpn���øtÖWn���à“똶������-���src/Composer/Repository/PackageRepository.phpj��øtÖWj��¥ôò̶������*���src/Composer/Repository/PathRepository.phpY ��øtÖWY ��(—¾3¶������2���src/Composer/Repository/Pear/BaseChannelReader.phpI��øtÖWI��c6³¶������,���src/Composer/Repository/Pear/ChannelInfo.phpÄ��øtÖWÄ��:T*ɶ������.���src/Composer/Repository/Pear/ChannelReader.phpí��øtÖWí��?ÈYT¶������4���src/Composer/Repository/Pear/ChannelRest10Reader.phpÁ ��øtÖWÁ ��O€ë¶������4���src/Composer/Repository/Pear/ChannelRest11Reader.php& ��øtÖW& ��òUb¶������5���src/Composer/Repository/Pear/DependencyConstraint.phpq��øtÖWq��9=¶������/���src/Composer/Repository/Pear/DependencyInfo.phpq��øtÖWq��fºTò¶������8���src/Composer/Repository/Pear/PackageDependencyParser.php%��øtÖW%��j?“¶������,���src/Composer/Repository/Pear/PackageInfo.php°��øtÖW°��Ÿ ¸ ¶������,���src/Composer/Repository/Pear/ReleaseInfo.php’��øtÖW’��o“ŠÃ¶������*���src/Composer/Repository/PearRepository.phpª��øtÖWª��)Ÿƒ}¶������.���src/Composer/Repository/PlatformRepository.php!��øtÖW!��Ûì‹»¶������-���src/Composer/Repository/RepositoryFactory.phpP��øtÖWP�� K˜¶������/���src/Composer/Repository/RepositoryInterface.phpÛ��øtÖWÛ��’âÁ¶������-���src/Composer/Repository/RepositoryManager.php,
  31. ��øtÖW,
  32. ��¾…\•¶������7���src/Composer/Repository/RepositorySecurityException.phpo���øtÖWo���pÕ«ª¶������,���src/Composer/Repository/Vcs/FossilDriver.phpü��øtÖWü��7øK¶������2���src/Composer/Repository/Vcs/GitBitbucketDriver.php_��øtÖW_��HÖÑ€¶������)���src/Composer/Repository/Vcs/GitDriver.php–��øtÖW–��¬°¶������,���src/Composer/Repository/Vcs/GitHubDriver.php…*��øtÖW…*��]¶á¶������,���src/Composer/Repository/Vcs/GitLabDriver.phpè��øtÖWè��75Ô“¶������1���src/Composer/Repository/Vcs/HgBitbucketDriver.php­��øtÖW­��š÷ÖT¶������(���src/Composer/Repository/Vcs/HgDriver.php��øtÖW��ô&ª»¶������.���src/Composer/Repository/Vcs/PerforceDriver.php"
  33. ��øtÖW"
  34. ��°`ìE¶������)���src/Composer/Repository/Vcs/SvnDriver.php²��øtÖW²��Ë W¶������)���src/Composer/Repository/Vcs/VcsDriver.phpÿ��øtÖWÿ��*ßÙ¶������2���src/Composer/Repository/Vcs/VcsDriverInterface.phpˆ��øtÖWˆ��ŽP©Î¶������)���src/Composer/Repository/VcsRepository.php´��øtÖW´��ªÖG¶������3���src/Composer/Repository/WritableArrayRepository.php��øtÖW��¾G*¶������7���src/Composer/Repository/WritableRepositoryInterface.php‰��øtÖW‰��‘/sï¶������$���src/Composer/Script/CommandEvent.phpW���øtÖWW���£VZt¶���������src/Composer/Script/Event.phpµ��øtÖWµ��lt¦M¶������$���src/Composer/Script/PackageEvent.phpœ���øtÖWœ���§ÿÉ ¶������$���src/Composer/Script/ScriptEvents.phpP��øtÖWP��‡�¶¶������ ���src/Composer/SelfUpdate/Keys.php���øtÖW��� îÊN¶������$���src/Composer/SelfUpdate/Versions.phpì��øtÖWì��͵‘ƒ¶������ ���src/Composer/Util/AuthHelper.phpË��øtÖWË��>zx–¶���������src/Composer/Util/Bitbucket.phpµ��øtÖWµ��Z±%N¶������$���src/Composer/Util/ComposerMirror.php±��øtÖW±��­½øض������%���src/Composer/Util/ConfigValidator.php&��øtÖW&��î:äü¶������"���src/Composer/Util/ErrorHandler.php‡��øtÖW‡��He"¶������ ���src/Composer/Util/Filesystem.phpP.��øtÖWP.��O¸˜ ¶���������src/Composer/Util/Git.php$��øtÖW$��ߢ
  35. ¶���������src/Composer/Util/GitHub.php¯
  36. ��øtÖW¯
  37. ��àÏ ¶���������src/Composer/Util/GitLab.php´ ��øtÖW´ ��`˜ïd¶������$���src/Composer/Util/NoProxyPattern.php¾��øtÖW¾��Z+°m¶���������src/Composer/Util/Perforce.phpí2��øtÖWí2���ÆóÔ¶���������src/Composer/Util/Platform.phpø��øtÖWø��V¨È‚¶������%���src/Composer/Util/ProcessExecutor.phps��øtÖWs��Ø÷“¶������&���src/Composer/Util/RemoteFilesystem.php7^��øtÖW7^��Ï’�¶���������src/Composer/Util/Silencer.phpñ��øtÖWñ��mvý¶������!���src/Composer/Util/SpdxLicense.php��øtÖW��¾7
  38. ñ¶������*���src/Composer/Util/StreamContextFactory.phpY��øtÖWY��úòµ¶���������src/Composer/Util/Svn.php¾��øtÖW¾��Ík“ܶ���������src/Composer/Util/TlsHelper.phpš
  39. ��øtÖWš
  40. ��û±‘ø¶���������src/bootstrap.php¹��øtÖW¹��I}œ¶������%���src/Composer/Autoload/ClassLoader.php1��øtÖW1��g¡ç¶���������res/composer-schema.json¨b��øtÖW¨b���\�¶������6���vendor/composer/spdx-licenses/res/spdx-exceptions.jsoní��øtÖWí��ÆÅz±¶������4���vendor/composer/spdx-licenses/res/spdx-licenses.jsonoc��øtÖWoc��ÈÐÙ߶������*���vendor/seld/cli-prompt/res/hiddeninput.exe�$��øtÖW�$��•�¥v¶������&���vendor/symfony/console/Application.phpºU��øtÖWºU��Ýߢ¢¶������*���vendor/symfony/console/Command/Command.php¯!��øtÖW¯!��UgÏ‹¶������.���vendor/symfony/console/Command/HelpCommand.phpÝ��øtÖWÝ��.Ø™u¶������.���vendor/symfony/console/Command/ListCommand.phpZ��øtÖWZ��É£ ¶������(���vendor/symfony/console/ConsoleEvents.phpï���øtÖWï��� ÕH¸¶������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpß��øtÖWß��µŒ°7¶������0���vendor/symfony/console/Descriptor/Descriptor.php���øtÖW���;~Ķ������9���vendor/symfony/console/Descriptor/DescriptorInterface.phpü���øtÖWü���±Qµ¶������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpš ��øtÖWš ��l¬¶������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.php��øtÖW��?wn¶������4���vendor/symfony/console/Descriptor/TextDescriptor.phpç��øtÖWç��ÜÁ`¶������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��øtÖW��‹P$¶������4���vendor/symfony/console/Event/ConsoleCommandEvent.php²��øtÖW²��Zk‰2¶������-���vendor/symfony/console/Event/ConsoleEvent.phpÅ��øtÖWÅ��ÒxÛ\¶������6���vendor/symfony/console/Event/ConsoleExceptionEvent.php��øtÖW��á2é¶������6���vendor/symfony/console/Event/ConsoleTerminateEvent.phpz��øtÖWz��³,îL¶������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÔ��øtÖWÔ��È÷ L¶������7���vendor/symfony/console/Exception/ExceptionInterface.phpf���øtÖWf���¡ABª¶������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���øtÖW¦���Ö̽Z¶������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���øtÖW¦���Ë×H¶������3���vendor/symfony/console/Exception/LogicException.php’���øtÖW’���ÍO\e¶������5���vendor/symfony/console/Exception/RuntimeException.php–���øtÖW–���Ùí,6¶������4���vendor/symfony/console/Formatter/OutputFormatter.php° ��øtÖW° ��æ�q@¶������=���vendor/symfony/console/Formatter/OutputFormatterInterface.phpŠ��øtÖWŠ��:߶������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpL��øtÖWL��Š�8<¶������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php†��øtÖW†��ÝRÚ­¶������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.phpL��øtÖWL��.=b¶������6���vendor/symfony/console/Helper/DebugFormatterHelper.phpx��øtÖWx��N©Ø¼¶������2���vendor/symfony/console/Helper/DescriptorHelper.phpz��øtÖWz��fÉÚý¶������.���vendor/symfony/console/Helper/DialogHelper.phpú��øtÖWú��hX�ö������1���vendor/symfony/console/Helper/FormatterHelper.phpc��øtÖWc��“ý«N¶������(���vendor/symfony/console/Helper/Helper.php��øtÖW��‡Â<£¶������1���vendor/symfony/console/Helper/HelperInterface.phpç���øtÖWç��� Çã¶������+���vendor/symfony/console/Helper/HelperSet.phpÐ��øtÖWÐ��aˆ~ ¶������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��øtÖWc��ñø�|¶������/���vendor/symfony/console/Helper/ProcessHelper.phpÑ ��øtÖWÑ ��@±ã�¶������-���vendor/symfony/console/Helper/ProgressBar.phps%��øtÖWs%��鯦�¶������0���vendor/symfony/console/Helper/ProgressHelper.phpp��øtÖWp��ï,lζ������3���vendor/symfony/console/Helper/ProgressIndicator.php,��øtÖW,��Öìlt¶������0���vendor/symfony/console/Helper/QuestionHelper.phpV��øtÖWV��£­Þ�¶������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.php¶ ��øtÖW¶ ��h§�¶������'���vendor/symfony/console/Helper/Table.php¤)��øtÖW¤)��`fRƒ¶������+���vendor/symfony/console/Helper/TableCell.php:��øtÖW:��7®�¶������-���vendor/symfony/console/Helper/TableHelper.php ��øtÖW ��¦pm‡¶������0���vendor/symfony/console/Helper/TableSeparator.phpÍ���øtÖWÍ���Qßa²¶������,���vendor/symfony/console/Helper/TableStyle.php
  41. ��øtÖW
  42. ��PÞµ¦¶������*���vendor/symfony/console/Input/ArgvInput.phpÇ��øtÖWÇ��BáѨ¶������+���vendor/symfony/console/Input/ArrayInput.php_
  43. ��øtÖW_
  44. ��[µðɶ������&���vendor/symfony/console/Input/Input.phpª ��øtÖWª ��¶¶������.���vendor/symfony/console/Input/InputArgument.php��øtÖW��ÁÜ�¶������4���vendor/symfony/console/Input/InputAwareInterface.phpš���øtÖWš���‡jTŸ¶������0���vendor/symfony/console/Input/InputDefinition.php“��øtÖW“��Éÿÿã¶������/���vendor/symfony/console/Input/InputInterface.phpŸ��øtÖWŸ��¥R6Û¶������,���vendor/symfony/console/Input/InputOption.php ��øtÖW ��‡¹§¶������,���vendor/symfony/console/Input/StringInput.php˜��øtÖW˜�� Ú¤¶���������vendor/symfony/console/LICENSE)��øtÖW)��¹ô¶������/���vendor/symfony/console/Logger/ConsoleLogger.php< ��øtÖW< ��:âÇl¶������0���vendor/symfony/console/Output/BufferedOutput.php_��øtÖW_��ûBÍ·¶������/���vendor/symfony/console/Output/ConsoleOutput.phpµ��øtÖWµ��
  45. ¢S\¶������8���vendor/symfony/console/Output/ConsoleOutputInterface.phpå���øtÖWå���rNô�¶������,���vendor/symfony/console/Output/NullOutput.phpÏ��øtÖWÏ��®˜‹Z¶������(���vendor/symfony/console/Output/Output.phpš ��øtÖWš ��01 ý¶������1���vendor/symfony/console/Output/OutputInterface.php��øtÖW��ÓÚ>¶������.���vendor/symfony/console/Output/StreamOutput.phpÄ��øtÖWÄ��õ핶������2���vendor/symfony/console/Question/ChoiceQuestion.php"
  46. ��øtÖW"
  47. ��_౶������8���vendor/symfony/console/Question/ConfirmationQuestion.phpé��øtÖWé��ƒQ@¶������,���vendor/symfony/console/Question/Question.php#
  48. ��øtÖW#
  49. ��e¯ ¶������ ���vendor/symfony/console/Shell.phpé��øtÖWé��½fü‘¶������,���vendor/symfony/console/Style/OutputStyle.php_��øtÖW_��ûµ¶������/���vendor/symfony/console/Style/StyleInterface.phpÔ��øtÖWÔ�� ßÊj¶������-���vendor/symfony/console/Style/SymfonyStyle.phph��øtÖWh��ŠGѶ������3���vendor/symfony/console/Tester/ApplicationTester.phpÔ��øtÖWÔ��¬ì¤d¶������/���vendor/symfony/console/Tester/CommandTester.php®��øtÖW®��EÙš|¶������:���vendor/symfony/filesystem/Exception/ExceptionInterface.phpi���øtÖWi���$ ÿ›¶������=���vendor/symfony/filesystem/Exception/FileNotFoundException.php¼��øtÖW¼��pí\¶¶������3���vendor/symfony/filesystem/Exception/IOException.php‡��øtÖW‡��€ü#Ѷ������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���øtÖW¦���jÙwM¶������(���vendor/symfony/filesystem/Filesystem.php�.��øtÖW�.��l+ñ‚¶������!���vendor/symfony/filesystem/LICENSE)��øtÖW)��¹ô¶������)���vendor/symfony/filesystem/LockHandler.phpŽ��øtÖWŽ��ü Å¶������1���vendor/symfony/finder/Adapter/AbstractAdapter.php\ ��øtÖW\ ��Æ“É€¶������5���vendor/symfony/finder/Adapter/AbstractFindAdapter.php‘��øtÖW‘��ao¦È¶������2���vendor/symfony/finder/Adapter/AdapterInterface.php±��øtÖW±��ä»Ê&¶������0���vendor/symfony/finder/Adapter/BsdFindAdapter.php2��øtÖW2��Q/ÇC¶������0���vendor/symfony/finder/Adapter/GnuFindAdapter.php��øtÖW�� ¡¾¶������,���vendor/symfony/finder/Adapter/PhpAdapter.phpô��øtÖWô��:?¶������/���vendor/symfony/finder/Comparator/Comparator.phpŒ��øtÖWŒ��wþT¶������3���vendor/symfony/finder/Comparator/DateComparator.php%��øtÖW%��L¿EǶ������5���vendor/symfony/finder/Comparator/NumberComparator.php~��øtÖW~��”‡ x¶������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���øtÖW„���½¾sœ¶������;���vendor/symfony/finder/Exception/AdapterFailureException.php¯��øtÖW¯��œôÔÁ¶������6���vendor/symfony/finder/Exception/ExceptionInterface.php„���øtÖW„���Gz-¶������A���vendor/symfony/finder/Exception/OperationNotPermitedException.php)��øtÖW)��ìcj=¶������@���vendor/symfony/finder/Exception/ShellCommandFailureException.phpÂ��øtÖWÂ��v‚ȶ������/���vendor/symfony/finder/Expression/Expression.php��øtÖW��µoÔ¶������)���vendor/symfony/finder/Expression/Glob.phpi��øtÖWi��@Šº¶������*���vendor/symfony/finder/Expression/Regex.php��øtÖW��p8�\¶������3���vendor/symfony/finder/Expression/ValueInterface.phpÍ��øtÖWÍ��²~øb¶������ ���vendor/symfony/finder/Finder.phpÂ-��øtÖWÂ-��˜f´¶���������vendor/symfony/finder/Glob.phpK��øtÖWK��já±n¶������7���vendor/symfony/finder/Iterator/CustomFilterIterator.php]��øtÖW]��tà±µ¶������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpz��øtÖWz��}¢¶������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpð��øtÖWð��ß0™¶������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpÊ��øtÖWÊ���96†¶������4���vendor/symfony/finder/Iterator/FilePathsIterator.php ��øtÖW ��fQCe¶������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.php\��øtÖW\��p‘'˜¶������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5��øtÖW5��ší¶������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.phpr��øtÖWr��tu¶������1���vendor/symfony/finder/Iterator/FilterIterator.phpÀ��øtÖWÀ��E™½Œ¶������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php/��øtÖW/��»ÇY¶������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpÏ��øtÖWÏ��ºªÇ¶������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.phpÌ��øtÖWÌ��bÁ�ܶ������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpg��øtÖWg��!Ô—é¶������3���vendor/symfony/finder/Iterator/SortableIterator.phpØ��øtÖWØ��`‹>c¶���������vendor/symfony/finder/LICENSE)��øtÖW)��¹ô¶������'���vendor/symfony/finder/Shell/Command.phpS ��øtÖWS ��cC…™¶������%���vendor/symfony/finder/Shell/Shell.phpp��øtÖWp��Ó}g¶������%���vendor/symfony/finder/SplFileInfo.phpÿ��øtÖWÿ��Ë OÀ¶������(���vendor/symfony/polyfill-mbstring/LICENSE)��øtÖW)��î*L¶������-���vendor/symfony/polyfill-mbstring/Mbstring.php0��øtÖW0��‘ߥ¶������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php2A��øtÖW2A��½=¨¶������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php¡A��øtÖW¡A��Ú Í¶������.���vendor/symfony/polyfill-mbstring/bootstrap.phpo��øtÖWo��c×5¶������7���vendor/symfony/process/Exception/ExceptionInterface.phpf���øtÖWf���]ö>T¶������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���øtÖW¨���ÐÀ+_¶������3���vendor/symfony/process/Exception/LogicException.php”���øtÖW”��� ³ãñ¶������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��øtÖWx��¨Ìzy¶������=���vendor/symfony/process/Exception/ProcessTimedOutException.php��øtÖW��. Ãá¶������5���vendor/symfony/process/Exception/RuntimeException.php˜���øtÖW˜���¢Ø:¶������+���vendor/symfony/process/ExecutableFinder.php‚��øtÖW‚��³0¶���������vendor/symfony/process/LICENSE)��øtÖW)��¹ô¶������.���vendor/symfony/process/PhpExecutableFinder.phpg��øtÖWg���絶������%���vendor/symfony/process/PhpProcess.phpü��øtÖWü��_—9¶������.���vendor/symfony/process/Pipes/AbstractPipes.php^��øtÖW^��%s…ï¶������/���vendor/symfony/process/Pipes/PipesInterface.phpD��øtÖWD��vØ������*���vendor/symfony/process/Pipes/UnixPipes.phpå��øtÖWå��È¥¶������-���vendor/symfony/process/Pipes/WindowsPipes.php� ��øtÖW� ��…®h¶������"���vendor/symfony/process/Process.phpýQ��øtÖWýQ��˜<*N¶������)���vendor/symfony/process/ProcessBuilder.phpã
  50. ��øtÖWã
  51. ��ʧ°ˆ¶������'���vendor/symfony/process/ProcessUtils.php8��øtÖW8��ž�uš¶���������vendor/seld/jsonlint/LICENSE"��øtÖW"��aƒsy¶������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php*��øtÖW*��•pñ¶������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php“1��øtÖW“1���P¦¶������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php��øtÖW��‰„m!¶������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php��øtÖW��‰²ñ¶������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���øtÖW>���ÿqŸŸ¶���������vendor/seld/cli-prompt/LICENSE"��øtÖW"��ˆñ?e¶������&���vendor/seld/cli-prompt/res/example.php'��øtÖW'��I£¶������(���vendor/seld/cli-prompt/src/CliPrompt.php ��øtÖW ��l½`߶������(���vendor/justinrainbow/json-schema/LICENSE ��øtÖW ��ºç©¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.phpù ��øtÖWù ��ð&•Ø¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php›��øtÖW›��˜‘(c¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.phpr��øtÖWr��ã{s6¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.phpv��øtÖWv��˜Ïåd¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpè��øtÖWè��C9�S¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php‚��øtÖW‚��^ah¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.phpY
  52. ��øtÖWY
  53. ��§Ì(µ¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpß��øtÖWß��$Kþ¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php ��øtÖW ��ÈÌÕâ¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.phpQ��øtÖWQ��xÐø¼¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.phpÆ��øtÖWÆ��ÜòÚŠ¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.phpÌ��øtÖWÌ��øQ�à¶������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.php}��øtÖW}��ê[ò~¶������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.phpv���øtÖWv���¬ «"¶������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpv���øtÖWv���ŠCÓ¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���øtÖWw���N-ò[¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞ��øtÖWÞ��†¾©‘¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo���øtÖWo���Æ$"Ŷ������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€���øtÖW€����³á¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj���øtÖWj���SÓdz¶������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpü��øtÖWü��à‘o–¶������?���vendor/justinrainbow/json-schema/src/JsonSchema/RefResolver.phpÀ ��øtÖWÀ ��›Óh¶������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.phpD��øtÖWD��,‘þ¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpÜ���øtÖWÜ���]j¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.phpt��øtÖWt��I·ý�¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php"��øtÖW"��ÖTÕ¾¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php*��øtÖW*��-3ÿ¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php©���øtÖW©���CO¶������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php“ ��øtÖW“ ��0÷ô¶������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.phpç��øtÖWç��‹I?!¶������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.php‚���øtÖW‚���’û/¡¶������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php„���øtÖW„���ÄLkd¶������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phpÛ��øtÖWÛ�� zD4¶������%���vendor/composer/spdx-licenses/LICENSE��øtÖW��Bhí¶������2���vendor/composer/spdx-licenses/src/SpdxLicenses.phpç��øtÖWç��·–U ¶���������vendor/composer/semver/LICENSE��øtÖW��Bhí¶������)���vendor/composer/semver/src/Comparator.php��øtÖW��wlƒï¶������<���vendor/composer/semver/src/Constraint/AbstractConstraint.php×��øtÖW×��õî>Ž¶������4���vendor/composer/semver/src/Constraint/Constraint.phpª ��øtÖWª ��ÇO7²¶������=���vendor/composer/semver/src/Constraint/ConstraintInterface.phpß���øtÖWß���0C,‡¶������9���vendor/composer/semver/src/Constraint/EmptyConstraint.phpé��øtÖWé��!-Ø™¶������9���vendor/composer/semver/src/Constraint/MultiConstraint.php1��øtÖW1��í xU¶������%���vendor/composer/semver/src/Semver.phpv��øtÖWv��‹×È›¶������,���vendor/composer/semver/src/VersionParser.php¿*��øtÖW¿*��)mƶ������!���vendor/composer/ca-bundle/LICENSE��øtÖW��*!^`¶������*���vendor/composer/ca-bundle/src/CaBundle.php½��øtÖW½��e¶���������vendor/psr/log/LICENSE=��øtÖW=��p±ŽO¶������)���vendor/psr/log/Psr/Log/AbstractLogger.php3��øtÖW3��s�K¶������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`���øtÖW`��� ˆX1¶������#���vendor/psr/log/Psr/Log/LogLevel.phpû���øtÖWû���jðñ8¶������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php{���øtÖW{���(»‚@¶������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php£���øtÖW£���ñºeÿ¶������*���vendor/psr/log/Psr/Log/LoggerInterface.php½��øtÖW½��ø
  54. ä}¶������&���vendor/psr/log/Psr/Log/LoggerTrait.php`��øtÖW`���òC¶������%���vendor/psr/log/Psr/Log/NullLogger.php����øtÖW����¥=‡¶������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.phpÙ
  55. ��øtÖWÙ
  56. ��Çû›»¶���������vendor/autoload.php‡���øtÖW‡���BQ£ˆ¶������'���vendor/composer/autoload_namespaces.php”���øtÖW”���N>O¶������!���vendor/composer/autoload_psr4.php��øtÖW��ëiù~¶������%���vendor/composer/autoload_classmap.phpd���øtÖWd���Z¡¦H¶������"���vendor/composer/autoload_files.phpÃ���øtÖWÃ���ÒÂür¶������!���vendor/composer/autoload_real.phpø��øtÖWø��Ã92߶������#���vendor/composer/autoload_static.php‘ ��øtÖW‘ ��î€Eå¶���������vendor/composer/ClassLoader.php›��øtÖW›�� k€¶������(���vendor/composer/ca-bundle/res/cacert.pemˆ×�øtÖWˆ×�?í±–¶������ ���bin/composerl��øtÖWl��Ԛà ¶���������LICENSE3��øtÖW3��û·þ¶������<?php
  57. namespace Composer\Autoload;
  58. use Composer\Config;
  59. use Composer\EventDispatcher\EventDispatcher;
  60. use Composer\Installer\InstallationManager;
  61. use Composer\IO\IOInterface;
  62. use Composer\Package\AliasPackage;
  63. use Composer\Package\PackageInterface;
  64. use Composer\Repository\InstalledRepositoryInterface;
  65. use Composer\Util\Filesystem;
  66. use Composer\Script\ScriptEvents;
  67. class AutoloadGenerator
  68. {
  69. private $eventDispatcher;
  70. private $io;
  71. private $devMode = false;
  72. private $classMapAuthoritative = false;
  73. private $runScripts = false;
  74. public function __construct(EventDispatcher $eventDispatcher, IOInterface $io = null)
  75. {
  76. $this->eventDispatcher = $eventDispatcher;
  77. $this->io = $io;
  78. }
  79. public function setDevMode($devMode = true)
  80. {
  81. $this->devMode = (boolean) $devMode;
  82. }
  83. public function setClassMapAuthoritative($classMapAuthoritative)
  84. {
  85. $this->classMapAuthoritative = (boolean) $classMapAuthoritative;
  86. }
  87. public function setRunScripts($runScripts = true)
  88. {
  89. $this->runScripts = (boolean) $runScripts;
  90. }
  91. public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
  92. {
  93. if ($this->classMapAuthoritative) {
  94. $scanPsr0Packages = true;
  95. }
  96. if ($this->runScripts) {
  97. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
  98. 'optimize' => (bool) $scanPsr0Packages,
  99. ));
  100. }
  101. $filesystem = new Filesystem();
  102. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  103. $basePath = $filesystem->normalizePath(realpath(getcwd()));
  104. $vendorPath = $filesystem->normalizePath(realpath($config->get('vendor-dir')));
  105. $useGlobalIncludePath = (bool) $config->get('use-include-path');
  106. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  107. $targetDir = $vendorPath.'/'.$targetDir;
  108. $filesystem->ensureDirectoryExists($targetDir);
  109. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  110. $vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
  111. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  112. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  113. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  114. $namespacesFile = <<<EOF
  115. <?php
  116. // autoload_namespaces.php @generated by Composer
  117. \$vendorDir = $vendorPathCode52;
  118. \$baseDir = $appBaseDirCode;
  119. return array(
  120. EOF;
  121. $psr4File = <<<EOF
  122. <?php
  123. // autoload_psr4.php @generated by Composer
  124. \$vendorDir = $vendorPathCode52;
  125. \$baseDir = $appBaseDirCode;
  126. return array(
  127. EOF;
  128. $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
  129. $autoloads = $this->parseAutoloads($packageMap, $mainPackage);
  130. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  131. $exportedPaths = array();
  132. foreach ($paths as $path) {
  133. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  134. }
  135. $exportedPrefix = var_export($namespace, true);
  136. $namespacesFile .= " $exportedPrefix => ";
  137. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  138. }
  139. $namespacesFile .= ");\n";
  140. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  141. $exportedPaths = array();
  142. foreach ($paths as $path) {
  143. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  144. }
  145. $exportedPrefix = var_export($namespace, true);
  146. $psr4File .= " $exportedPrefix => ";
  147. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  148. }
  149. $psr4File .= ");\n";
  150. $classmapFile = <<<EOF
  151. <?php
  152. // autoload_classmap.php @generated by Composer
  153. \$vendorDir = $vendorPathCode52;
  154. \$baseDir = $appBaseDirCode;
  155. return array(
  156. EOF;
  157. $targetDirLoader = null;
  158. $mainAutoload = $mainPackage->getAutoload();
  159. if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  160. $levels = count(explode('/', $filesystem->normalizePath($mainPackage->getTargetDir())));
  161. $prefixes = implode(', ', array_map(function ($prefix) {
  162. return var_export($prefix, true);
  163. }, array_keys($mainAutoload['psr-0'])));
  164. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  165. $targetDirLoader = <<<EOF
  166. public static function autoload(\$class)
  167. {
  168. \$dir = $baseDirFromTargetDirCode . '/';
  169. \$prefixes = array($prefixes);
  170. foreach (\$prefixes as \$prefix) {
  171. if (0 !== strpos(\$class, \$prefix)) {
  172. continue;
  173. }
  174. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  175. if (!\$path = stream_resolve_include_path(\$path)) {
  176. return false;
  177. }
  178. require \$path;
  179. return true;
  180. }
  181. }
  182. EOF;
  183. }
  184. $blacklist = null;
  185. if (!empty($autoloads['exclude-from-classmap'])) {
  186. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  187. }
  188. $classMap = array();
  189. if ($scanPsr0Packages) {
  190. $namespacesToScan = array();
  191. foreach (array('psr-0', 'psr-4') as $psrType) {
  192. foreach ($autoloads[$psrType] as $namespace => $paths) {
  193. $namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
  194. }
  195. }
  196. krsort($namespacesToScan);
  197. foreach ($namespacesToScan as $namespace => $groups) {
  198. foreach ($groups as $group) {
  199. $psrType = $group['type'];
  200. foreach ($group['paths'] as $dir) {
  201. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  202. if (!is_dir($dir)) {
  203. continue;
  204. }
  205. $namespaceFilter = $namespace === '' ? null : $namespace;
  206. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, $namespaceFilter, $classMap);
  207. }
  208. }
  209. }
  210. }
  211. foreach ($autoloads['classmap'] as $dir) {
  212. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, null, $classMap);
  213. }
  214. ksort($classMap);
  215. foreach ($classMap as $class => $code) {
  216. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  217. }
  218. $classmapFile .= ");\n";
  219. if (!$suffix) {
  220. if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
  221. $content = file_get_contents($vendorPath.'/autoload.php');
  222. if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  223. $suffix = $match[1];
  224. }
  225. }
  226. if (!$suffix) {
  227. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  228. }
  229. }
  230. file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
  231. file_put_contents($targetDir.'/autoload_psr4.php', $psr4File);
  232. file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile);
  233. $includePathFilePath = $targetDir.'/include_paths.php';
  234. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  235. file_put_contents($includePathFilePath, $includePathFileContents);
  236. } elseif (file_exists($includePathFilePath)) {
  237. unlink($includePathFilePath);
  238. }
  239. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  240. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  241. file_put_contents($includeFilesFilePath, $includeFilesFileContents);
  242. } elseif (file_exists($includeFilesFilePath)) {
  243. unlink($includeFilesFilePath);
  244. }
  245. file_put_contents($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
  246. file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  247. file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
  248. $this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  249. $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  250. if ($this->runScripts) {
  251. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  252. 'optimize' => (bool) $scanPsr0Packages,
  253. ));
  254. }
  255. }
  256. private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist = null, $namespaceFilter = null, array $classMap = array())
  257. {
  258. foreach ($this->generateClassMap($dir, $blacklist, $namespaceFilter) as $class => $path) {
  259. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  260. if (!isset($classMap[$class])) {
  261. $classMap[$class] = $pathCode;
  262. } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
  263. $this->io->writeError(
  264. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  265. ' was found in both "'.str_replace(array('$vendorDir . \'', "',\n"), array($vendorPath, ''), $classMap[$class]).'" and "'.$path.'", the first will be used.</warning>'
  266. );
  267. }
  268. }
  269. return $classMap;
  270. }
  271. private function generateClassMap($dir, $blacklist = null, $namespaceFilter = null, $showAmbiguousWarning = true)
  272. {
  273. return ClassMapGenerator::createMap($dir, $blacklist, $showAmbiguousWarning ? $this->io : null, $namespaceFilter);
  274. }
  275. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
  276. {
  277. $packageMap = array(array($mainPackage, ''));
  278. foreach ($packages as $package) {
  279. if ($package instanceof AliasPackage) {
  280. continue;
  281. }
  282. $this->validatePackage($package);
  283. $packageMap[] = array(
  284. $package,
  285. $installationManager->getInstallPath($package),
  286. );
  287. }
  288. return $packageMap;
  289. }
  290. protected function validatePackage(PackageInterface $package)
  291. {
  292. $autoload = $package->getAutoload();
  293. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  294. $name = $package->getName();
  295. $package->getTargetDir();
  296. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  297. }
  298. if (!empty($autoload['psr-4'])) {
  299. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  300. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  301. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  302. }
  303. }
  304. }
  305. }
  306. public function parseAutoloads(array $packageMap, PackageInterface $mainPackage)
  307. {
  308. $mainPackageMap = array_shift($packageMap);
  309. $sortedPackageMap = $this->sortPackageMap($packageMap);
  310. $sortedPackageMap[] = $mainPackageMap;
  311. array_unshift($packageMap, $mainPackageMap);
  312. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $mainPackage);
  313. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $mainPackage);
  314. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $mainPackage);
  315. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
  316. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $mainPackage);
  317. krsort($psr0);
  318. krsort($psr4);
  319. return array(
  320. 'psr-0' => $psr0,
  321. 'psr-4' => $psr4,
  322. 'classmap' => $classmap,
  323. 'files' => $files,
  324. 'exclude-from-classmap' => $exclude,
  325. );
  326. }
  327. public function createLoader(array $autoloads)
  328. {
  329. $loader = new ClassLoader();
  330. if (isset($autoloads['psr-0'])) {
  331. foreach ($autoloads['psr-0'] as $namespace => $path) {
  332. $loader->add($namespace, $path);
  333. }
  334. }
  335. if (isset($autoloads['psr-4'])) {
  336. foreach ($autoloads['psr-4'] as $namespace => $path) {
  337. $loader->addPsr4($namespace, $path);
  338. }
  339. }
  340. if (isset($autoloads['classmap'])) {
  341. foreach ($autoloads['classmap'] as $dir) {
  342. try {
  343. $loader->addClassMap($this->generateClassMap($dir, null, null, false));
  344. } catch (\RuntimeException $e) {
  345. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  346. }
  347. }
  348. }
  349. return $loader;
  350. }
  351. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  352. {
  353. $includePaths = array();
  354. foreach ($packageMap as $item) {
  355. list($package, $installPath) = $item;
  356. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  357. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  358. }
  359. foreach ($package->getIncludePaths() as $includePath) {
  360. $includePath = trim($includePath, '/');
  361. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  362. }
  363. }
  364. if (!$includePaths) {
  365. return;
  366. }
  367. $includePathsCode = '';
  368. foreach ($includePaths as $path) {
  369. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  370. }
  371. return <<<EOF
  372. <?php
  373. // include_paths.php @generated by Composer
  374. \$vendorDir = $vendorPathCode;
  375. \$baseDir = $appBaseDirCode;
  376. return array(
  377. $includePathsCode);
  378. EOF;
  379. }
  380. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  381. {
  382. $filesCode = '';
  383. foreach ($files as $fileIdentifier => $functionFile) {
  384. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
  385. . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
  386. }
  387. if (!$filesCode) {
  388. return false;
  389. }
  390. return <<<EOF
  391. <?php
  392. // autoload_files.php @generated by Composer
  393. \$vendorDir = $vendorPathCode;
  394. \$baseDir = $appBaseDirCode;
  395. return array(
  396. $filesCode);
  397. EOF;
  398. }
  399. protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
  400. {
  401. if (!$filesystem->isAbsolutePath($path)) {
  402. $path = $basePath . '/' . $path;
  403. }
  404. $path = $filesystem->normalizePath($path);
  405. $baseDir = '';
  406. if (strpos($path.'/', $vendorPath.'/') === 0) {
  407. $path = substr($path, strlen($vendorPath));
  408. $baseDir = '$vendorDir';
  409. if ($path !== false) {
  410. $baseDir .= " . ";
  411. }
  412. } else {
  413. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  414. if (!$filesystem->isAbsolutePath($path)) {
  415. $baseDir = '$baseDir . ';
  416. $path = '/' . $path;
  417. }
  418. }
  419. if (preg_match('/\.phar$/', $path)) {
  420. $baseDir = "'phar://' . " . $baseDir;
  421. }
  422. return $baseDir . (($path !== false) ? var_export($path, true) : "");
  423. }
  424. protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
  425. {
  426. return <<<AUTOLOAD
  427. <?php
  428. // autoload.php @generated by Composer
  429. require_once $vendorPathToTargetDirCode . '/autoload_real.php';
  430. return ComposerAutoloaderInit$suffix::getLoader();
  431. AUTOLOAD;
  432. }
  433. protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)
  434. {
  435. $file = <<<HEADER
  436. <?php
  437. // autoload_real.php @generated by Composer
  438. class ComposerAutoloaderInit$suffix
  439. {
  440. private static \$loader;
  441. public static function loadClassLoader(\$class)
  442. {
  443. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  444. require __DIR__ . '/ClassLoader.php';
  445. }
  446. }
  447. public static function getLoader()
  448. {
  449. if (null !== self::\$loader) {
  450. return self::\$loader;
  451. }
  452. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  453. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
  454. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  455. HEADER;
  456. if ($useIncludePath) {
  457. $file .= <<<'INCLUDE_PATH'
  458. $includePaths = require __DIR__ . '/include_paths.php';
  459. array_push($includePaths, get_include_path());
  460. set_include_path(join(PATH_SEPARATOR, $includePaths));
  461. INCLUDE_PATH;
  462. }
  463. $file .= <<<STATIC_INIT
  464. \$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION');
  465. if (\$useStaticLoader) {
  466. require_once __DIR__ . '/autoload_static.php';
  467. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  468. } else {
  469. STATIC_INIT;
  470. if (!$this->classMapAuthoritative) {
  471. $file .= <<<'PSR04'
  472. $map = require __DIR__ . '/autoload_namespaces.php';
  473. foreach ($map as $namespace => $path) {
  474. $loader->set($namespace, $path);
  475. }
  476. $map = require __DIR__ . '/autoload_psr4.php';
  477. foreach ($map as $namespace => $path) {
  478. $loader->setPsr4($namespace, $path);
  479. }
  480. PSR04;
  481. }
  482. if ($useClassMap) {
  483. $file .= <<<'CLASSMAP'
  484. $classMap = require __DIR__ . '/autoload_classmap.php';
  485. if ($classMap) {
  486. $loader->addClassMap($classMap);
  487. }
  488. CLASSMAP;
  489. }
  490. $file .= " }\n\n";
  491. if ($this->classMapAuthoritative) {
  492. $file .= <<<'CLASSMAPAUTHORITATIVE'
  493. $loader->setClassMapAuthoritative(true);
  494. CLASSMAPAUTHORITATIVE;
  495. }
  496. if ($useGlobalIncludePath) {
  497. $file .= <<<'INCLUDEPATH'
  498. $loader->setUseIncludePath(true);
  499. INCLUDEPATH;
  500. }
  501. if ($targetDirLoader) {
  502. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  503. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  504. REGISTER_TARGET_DIR_AUTOLOAD;
  505. }
  506. $file .= <<<REGISTER_LOADER
  507. \$loader->register($prependAutoloader);
  508. REGISTER_LOADER;
  509. if ($useIncludeFiles) {
  510. $file .= <<<INCLUDE_FILES
  511. if (\$useStaticLoader) {
  512. \$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
  513. } else {
  514. \$includeFiles = require __DIR__ . '/autoload_files.php';
  515. }
  516. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  517. composerRequire$suffix(\$fileIdentifier, \$file);
  518. }
  519. INCLUDE_FILES;
  520. }
  521. $file .= <<<METHOD_FOOTER
  522. return \$loader;
  523. }
  524. METHOD_FOOTER;
  525. $file .= $targetDirLoader;
  526. if ($useIncludeFiles) {
  527. return $file . <<<FOOTER
  528. }
  529. function composerRequire$suffix(\$fileIdentifier, \$file)
  530. {
  531. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  532. require \$file;
  533. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  534. }
  535. }
  536. FOOTER;
  537. }
  538. return $file . <<<FOOTER
  539. }
  540. FOOTER;
  541. }
  542. protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
  543. {
  544. $staticPhpVersion = 50600;
  545. $file = <<<HEADER
  546. <?php
  547. // autoload_static.php @generated by Composer
  548. namespace Composer\Autoload;
  549. class ComposerStaticInit$suffix
  550. {
  551. HEADER;
  552. $loader = new ClassLoader();
  553. $map = require $targetDir . '/autoload_namespaces.php';
  554. foreach ($map as $namespace => $path) {
  555. $loader->set($namespace, $path);
  556. }
  557. $map = require $targetDir . '/autoload_psr4.php';
  558. foreach ($map as $namespace => $path) {
  559. $loader->setPsr4($namespace, $path);
  560. }
  561. $classMap = require $targetDir . '/autoload_classmap.php';
  562. if ($classMap) {
  563. $loader->addClassMap($classMap);
  564. }
  565. $filesystem = new Filesystem();
  566. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  567. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  568. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  569. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  570. $initializer = '';
  571. $prefix = "\0Composer\Autoload\ClassLoader\0";
  572. $prefixLen = strlen($prefix);
  573. if (file_exists($targetDir . '/autoload_files.php')) {
  574. $maps = array('files' => require $targetDir . '/autoload_files.php');
  575. } else {
  576. $maps = array();
  577. }
  578. foreach ((array) $loader as $prop => $value) {
  579. if ($value && 0 === strpos($prop, $prefix)) {
  580. $maps[substr($prop, $prefixLen)] = $value;
  581. }
  582. }
  583. foreach ($maps as $prop => $value) {
  584. if (count($value) > 32767) {
  585. $staticPhpVersion = 70000;
  586. }
  587. $value = var_export($value, true);
  588. $value = str_replace($absoluteVendorPathCode, $vendorPathCode, $value);
  589. $value = str_replace($absoluteAppBaseDirCode, $appBaseDirCode, $value);
  590. $value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
  591. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  592. if ('files' !== $prop) {
  593. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  594. }
  595. }
  596. return $file . <<<INITIALIZER
  597. public static function getInitializer(ClassLoader \$loader)
  598. {
  599. return \Closure::bind(function () use (\$loader) {
  600. $initializer
  601. }, null, ClassLoader::class);
  602. }
  603. }
  604. INITIALIZER;
  605. }
  606. protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
  607. {
  608. $autoloads = array();
  609. foreach ($packageMap as $item) {
  610. list($package, $installPath) = $item;
  611. $autoload = $package->getAutoload();
  612. if ($this->devMode && $package === $mainPackage) {
  613. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  614. }
  615. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  616. continue;
  617. }
  618. if (null !== $package->getTargetDir() && $package !== $mainPackage) {
  619. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  620. }
  621. foreach ($autoload[$type] as $namespace => $paths) {
  622. foreach ((array) $paths as $path) {
  623. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
  624. if ($package === $mainPackage) {
  625. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  626. $path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  627. } else {
  628. $path = $package->getTargetDir() . '/' . $path;
  629. }
  630. }
  631. if ($type === 'exclude-from-classmap') {
  632. $path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  633. $path = str_replace('\\*\\*', '.+?', $path);
  634. $path = str_replace('\\*', '[^/]+?', $path);
  635. $updir = null;
  636. $path = preg_replace_callback(
  637. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  638. function ($matches) use (&$updir) {
  639. if (isset($matches[1])) {
  640. $updir = str_replace('\\.', '.', $matches[1]);
  641. }
  642. return '';
  643. },
  644. $path
  645. );
  646. if (empty($installPath)) {
  647. $installPath = strtr(getcwd(), '\\', '/');
  648. }
  649. $resolvedPath = realpath($installPath . '/' . $updir);
  650. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path;
  651. continue;
  652. }
  653. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  654. if ($type === 'files') {
  655. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  656. continue;
  657. } elseif ($type === 'classmap') {
  658. $autoloads[] = $relativePath;
  659. continue;
  660. }
  661. $autoloads[$namespace][] = $relativePath;
  662. }
  663. }
  664. }
  665. return $autoloads;
  666. }
  667. protected function getFileIdentifier(PackageInterface $package, $path)
  668. {
  669. return md5($package->getName() . ':' . $path);
  670. }
  671. protected function sortPackageMap(array $packageMap)
  672. {
  673. $packages = array();
  674. $paths = array();
  675. $usageList = array();
  676. foreach ($packageMap as $item) {
  677. list($package, $path) = $item;
  678. $name = $package->getName();
  679. $packages[$name] = $package;
  680. $paths[$name] = $path;
  681. foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
  682. $target = $link->getTarget();
  683. $usageList[$target][] = $name;
  684. }
  685. }
  686. $computing = array();
  687. $computed = array();
  688. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
  689. if (isset($computed[$name])) {
  690. return $computed[$name];
  691. }
  692. if (isset($computing[$name])) {
  693. return 0;
  694. }
  695. $computing[$name] = true;
  696. $weight = 0;
  697. if (isset($usageList[$name])) {
  698. foreach ($usageList[$name] as $user) {
  699. $weight -= 1 - $computeImportance($user);
  700. }
  701. }
  702. unset($computing[$name]);
  703. $computed[$name] = $weight;
  704. return $weight;
  705. };
  706. $weightList = array();
  707. foreach ($packages as $name => $package) {
  708. $weight = $computeImportance($name);
  709. $weightList[$name] = $weight;
  710. }
  711. $stable_sort = function (&$array) {
  712. static $transform, $restore;
  713. $i = 0;
  714. if (!$transform) {
  715. $transform = function (&$v, $k) use (&$i) {
  716. $v = array($v, ++$i, $k, $v);
  717. };
  718. $restore = function (&$v, $k) {
  719. $v = $v[3];
  720. };
  721. }
  722. array_walk($array, $transform);
  723. asort($array);
  724. array_walk($array, $restore);
  725. };
  726. $stable_sort($weightList);
  727. $sortedPackageMap = array();
  728. foreach (array_keys($weightList) as $name) {
  729. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  730. }
  731. return $sortedPackageMap;
  732. }
  733. protected function safeCopy($source, $target)
  734. {
  735. $source = fopen($source, 'r');
  736. $target = fopen($target, 'w+');
  737. stream_copy_to_stream($source, $target);
  738. fclose($source);
  739. fclose($target);
  740. }
  741. }
  742. <?php
  743. namespace Composer\Autoload;
  744. use Symfony\Component\Finder\Finder;
  745. use Composer\IO\IOInterface;
  746. use Composer\Util\Filesystem;
  747. class ClassMapGenerator
  748. {
  749. public static function dump($dirs, $file)
  750. {
  751. $maps = array();
  752. foreach ($dirs as $dir) {
  753. $maps = array_merge($maps, static::createMap($dir));
  754. }
  755. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  756. }
  757. public static function createMap($path, $blacklist = null, IOInterface $io = null, $namespace = null)
  758. {
  759. if (is_string($path)) {
  760. if (is_file($path)) {
  761. $path = array(new \SplFileInfo($path));
  762. } elseif (is_dir($path)) {
  763. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  764. } else {
  765. throw new \RuntimeException(
  766. 'Could not scan for classes inside "'.$path.
  767. '" which does not appear to be a file nor a folder'
  768. );
  769. }
  770. }
  771. $map = array();
  772. $filesystem = new Filesystem();
  773. $cwd = getcwd();
  774. foreach ($path as $file) {
  775. $filePath = $file->getPathname();
  776. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  777. continue;
  778. }
  779. if (!$filesystem->isAbsolutePath($filePath)) {
  780. $filePath = $cwd . '/' . $filePath;
  781. $filePath = $filesystem->normalizePath($filePath);
  782. } else {
  783. $filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath);
  784. }
  785. if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) {
  786. continue;
  787. }
  788. $classes = self::findClasses($filePath);
  789. foreach ($classes as $class) {
  790. if (null !== $namespace && 0 !== strpos($class, $namespace)) {
  791. continue;
  792. }
  793. if (!isset($map[$class])) {
  794. $map[$class] = $filePath;
  795. } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  796. $io->writeError(
  797. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  798. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  799. );
  800. }
  801. }
  802. }
  803. return $map;
  804. }
  805. private static function findClasses($path)
  806. {
  807. $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
  808. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
  809. $extraTypes .= '|enum';
  810. }
  811. $contents = @php_strip_whitespace($path);
  812. if (!$contents) {
  813. if (!file_exists($path)) {
  814. $message = 'File at "%s" does not exist, check your classmap definitions';
  815. } elseif (!is_readable($path)) {
  816. $message = 'File at "%s" is not readable, check its permissions';
  817. } elseif ('' === trim(file_get_contents($path))) {
  818. return array();
  819. } else {
  820. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  821. }
  822. $error = error_get_last();
  823. if (isset($error['message'])) {
  824. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  825. }
  826. throw new \RuntimeException(sprintf($message, $path));
  827. }
  828. if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
  829. return array();
  830. }
  831. $contents = preg_replace('{<<<\s*(\'?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)\\2(?=\r\n|\n|\r|;)}s', 'null', $contents);
  832. $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
  833. if (substr($contents, 0, 2) !== '<?') {
  834. $contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
  835. if ($replacements === 0) {
  836. return array();
  837. }
  838. }
  839. $contents = preg_replace('{\?>.+<\?}s', '?><?', $contents);
  840. $pos = strrpos($contents, '?>');
  841. if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
  842. $contents = substr($contents, 0, $pos);
  843. }
  844. preg_match_all('{
  845. (?:
  846. \b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  847. | \b(?<![\$:>])(?P<ns>namespace) (?P<nsname>\s++[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\s*+\\\\\s*+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+)? \s*+ [\{;]
  848. )
  849. }ix', $contents, $matches);
  850. $classes = array();
  851. $namespace = '';
  852. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  853. if (!empty($matches['ns'][$i])) {
  854. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
  855. } else {
  856. $name = $matches['name'][$i];
  857. if ($name === 'extends' || $name === 'implements') {
  858. continue;
  859. }
  860. if ($name[0] === ':') {
  861. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  862. } elseif ($matches['type'][$i] === 'enum') {
  863. $name = rtrim($name, ':');
  864. }
  865. $classes[] = ltrim($namespace . $name, '\\');
  866. }
  867. }
  868. return $classes;
  869. }
  870. }
  871. <?php
  872. namespace Composer;
  873. use Composer\IO\IOInterface;
  874. use Composer\Util\Filesystem;
  875. use Composer\Util\Silencer;
  876. use Symfony\Component\Finder\Finder;
  877. class Cache
  878. {
  879. private static $cacheCollected = false;
  880. private $io;
  881. private $root;
  882. private $enabled = true;
  883. private $whitelist;
  884. private $filesystem;
  885. public function __construct(IOInterface $io, $cacheDir, $whitelist = 'a-z0-9.', Filesystem $filesystem = null)
  886. {
  887. $this->io = $io;
  888. $this->root = rtrim($cacheDir, '/\\') . '/';
  889. $this->whitelist = $whitelist;
  890. $this->filesystem = $filesystem ?: new Filesystem();
  891. if (preg_match('{(^|[\\\\/])(\$null|NUL|/dev/null)([\\\\/]|$)}', $cacheDir)) {
  892. $this->enabled = false;
  893. return;
  894. }
  895. if (
  896. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  897. || !is_writable($this->root)
  898. ) {
  899. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  900. $this->enabled = false;
  901. }
  902. }
  903. public function isEnabled()
  904. {
  905. return $this->enabled;
  906. }
  907. public function getRoot()
  908. {
  909. return $this->root;
  910. }
  911. public function read($file)
  912. {
  913. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  914. if ($this->enabled && file_exists($this->root . $file)) {
  915. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  916. return file_get_contents($this->root . $file);
  917. }
  918. return false;
  919. }
  920. public function write($file, $contents)
  921. {
  922. if ($this->enabled) {
  923. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  924. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  925. try {
  926. return file_put_contents($this->root . $file, $contents);
  927. } catch (\ErrorException $e) {
  928. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  929. if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  930. unlink($this->root . $file);
  931. $message = sprintf(
  932. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  933. $this->root . $file,
  934. $m[1],
  935. $m[2],
  936. @disk_free_space($this->root . dirname($file))
  937. );
  938. $this->io->writeError($message);
  939. return false;
  940. }
  941. throw $e;
  942. }
  943. }
  944. return false;
  945. }
  946. public function copyFrom($file, $source)
  947. {
  948. if ($this->enabled) {
  949. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  950. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  951. if (!file_exists($source)) {
  952. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  953. } elseif ($this->io->isDebug()) {
  954. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  955. }
  956. return copy($source, $this->root . $file);
  957. }
  958. return false;
  959. }
  960. public function copyTo($file, $target)
  961. {
  962. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  963. if ($this->enabled && file_exists($this->root . $file)) {
  964. try {
  965. touch($this->root . $file, filemtime($this->root . $file), time());
  966. } catch (\ErrorException $e) {
  967. Silencer::call('touch', $this->root . $file);
  968. }
  969. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  970. return copy($this->root . $file, $target);
  971. }
  972. return false;
  973. }
  974. public function gcIsNecessary()
  975. {
  976. return (!self::$cacheCollected && !mt_rand(0, 50));
  977. }
  978. public function remove($file)
  979. {
  980. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  981. if ($this->enabled && file_exists($this->root . $file)) {
  982. return $this->filesystem->unlink($this->root . $file);
  983. }
  984. return false;
  985. }
  986. public function gc($ttl, $maxSize)
  987. {
  988. if ($this->enabled) {
  989. $expire = new \DateTime();
  990. $expire->modify('-'.$ttl.' seconds');
  991. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  992. foreach ($finder as $file) {
  993. $this->filesystem->unlink($file->getPathname());
  994. }
  995. $totalSize = $this->filesystem->size($this->root);
  996. if ($totalSize > $maxSize) {
  997. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  998. while ($totalSize > $maxSize && $iterator->valid()) {
  999. $filepath = $iterator->current()->getPathname();
  1000. $totalSize -= $this->filesystem->size($filepath);
  1001. $this->filesystem->unlink($filepath);
  1002. $iterator->next();
  1003. }
  1004. }
  1005. self::$cacheCollected = true;
  1006. return true;
  1007. }
  1008. return false;
  1009. }
  1010. public function sha1($file)
  1011. {
  1012. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1013. if ($this->enabled && file_exists($this->root . $file)) {
  1014. return sha1_file($this->root . $file);
  1015. }
  1016. return false;
  1017. }
  1018. public function sha256($file)
  1019. {
  1020. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1021. if ($this->enabled && file_exists($this->root . $file)) {
  1022. return hash_file('sha256', $this->root . $file);
  1023. }
  1024. return false;
  1025. }
  1026. protected function getFinder()
  1027. {
  1028. return Finder::create()->in($this->root)->files();
  1029. }
  1030. }
  1031. <?php
  1032. namespace Composer\Command;
  1033. use Symfony\Component\Console\Input\InputInterface;
  1034. use Symfony\Component\Console\Output\OutputInterface;
  1035. class AboutCommand extends BaseCommand
  1036. {
  1037. protected function configure()
  1038. {
  1039. $this
  1040. ->setName('about')
  1041. ->setDescription('Short information about Composer')
  1042. ->setHelp(<<<EOT
  1043. <info>php composer.phar about</info>
  1044. EOT
  1045. )
  1046. ;
  1047. }
  1048. protected function execute(InputInterface $input, OutputInterface $output)
  1049. {
  1050. $this->getIO()->write(<<<EOT
  1051. <info>Composer - Package Management for PHP</info>
  1052. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1053. See https://getcomposer.org/ for more information.</comment>
  1054. EOT
  1055. );
  1056. }
  1057. }
  1058. <?php
  1059. namespace Composer\Command;
  1060. use Composer\Factory;
  1061. use Composer\IO\IOInterface;
  1062. use Composer\Config;
  1063. use Composer\Repository\CompositeRepository;
  1064. use Composer\Repository\RepositoryFactory;
  1065. use Composer\Script\ScriptEvents;
  1066. use Composer\Plugin\CommandEvent;
  1067. use Composer\Plugin\PluginEvents;
  1068. use Composer\Util\Filesystem;
  1069. use Symfony\Component\Console\Input\InputArgument;
  1070. use Symfony\Component\Console\Input\InputInterface;
  1071. use Symfony\Component\Console\Input\InputOption;
  1072. use Symfony\Component\Console\Output\OutputInterface;
  1073. class ArchiveCommand extends BaseCommand
  1074. {
  1075. protected function configure()
  1076. {
  1077. $this
  1078. ->setName('archive')
  1079. ->setDescription('Create an archive of this composer package')
  1080. ->setDefinition(array(
  1081. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1082. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1083. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
  1084. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1085. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1086. .' Note that the format will be appended.'),
  1087. ))
  1088. ->setHelp(<<<EOT
  1089. The <info>archive</info> command creates an archive of the specified format
  1090. containing the files and directories of the Composer project or the specified
  1091. package in the specified version and writes it to the specified directory.
  1092. <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
  1093. EOT
  1094. )
  1095. ;
  1096. }
  1097. protected function execute(InputInterface $input, OutputInterface $output)
  1098. {
  1099. $config = Factory::createConfig();
  1100. $composer = $this->getComposer(false);
  1101. if ($composer) {
  1102. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1103. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1104. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1105. }
  1106. if (null === $input->getOption('format')) {
  1107. $input->setOption('format', $config->get('archive-format'));
  1108. }
  1109. if (null === $input->getOption('dir')) {
  1110. $input->setOption('dir', $config->get('archive-dir'));
  1111. }
  1112. $returnCode = $this->archive(
  1113. $this->getIO(),
  1114. $config,
  1115. $input->getArgument('package'),
  1116. $input->getArgument('version'),
  1117. $input->getOption('format'),
  1118. $input->getOption('dir'),
  1119. $input->getOption('file')
  1120. );
  1121. if (0 === $returnCode && $composer) {
  1122. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1123. }
  1124. return $returnCode;
  1125. }
  1126. protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null)
  1127. {
  1128. $factory = new Factory;
  1129. $downloadManager = $factory->createDownloadManager($io, $config);
  1130. $archiveManager = $factory->createArchiveManager($config, $downloadManager);
  1131. if ($packageName) {
  1132. $package = $this->selectPackage($io, $packageName, $version);
  1133. if (!$package) {
  1134. return 1;
  1135. }
  1136. } else {
  1137. $package = $this->getComposer()->getPackage();
  1138. }
  1139. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1140. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName);
  1141. $fs = new Filesystem;
  1142. $shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
  1143. $io->writeError('Created: ', false);
  1144. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1145. return 0;
  1146. }
  1147. protected function selectPackage(IOInterface $io, $packageName, $version = null)
  1148. {
  1149. $io->writeError('<info>Searching for the specified package.</info>');
  1150. if ($composer = $this->getComposer(false)) {
  1151. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1152. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1153. } else {
  1154. $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
  1155. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1156. $repo = new CompositeRepository($defaultRepos);
  1157. }
  1158. $packages = $repo->findPackages($packageName, $version);
  1159. if (count($packages) > 1) {
  1160. $package = reset($packages);
  1161. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1162. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p) { return $p->getPrettyString(); }, $packages)).'.');
  1163. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1164. } elseif ($packages) {
  1165. $package = reset($packages);
  1166. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1167. } else {
  1168. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1169. return false;
  1170. }
  1171. return $package;
  1172. }
  1173. }
  1174. <?php
  1175. namespace Composer\Command;
  1176. use Composer\Composer;
  1177. use Composer\Console\Application;
  1178. use Composer\IO\IOInterface;
  1179. use Composer\IO\NullIO;
  1180. use Symfony\Component\Console\Input\InputInterface;
  1181. use Symfony\Component\Console\Output\OutputInterface;
  1182. use Symfony\Component\Console\Command\Command;
  1183. abstract class BaseCommand extends Command
  1184. {
  1185. private $composer;
  1186. private $io;
  1187. public function getComposer($required = true, $disablePlugins = null)
  1188. {
  1189. if (null === $this->composer) {
  1190. $application = $this->getApplication();
  1191. if ($application instanceof Application) {
  1192. $this->composer = $application->getComposer($required, $disablePlugins);
  1193. } elseif ($required) {
  1194. throw new \RuntimeException(
  1195. 'Could not create a Composer\Composer instance, you must inject '.
  1196. 'one if this command is not used with a Composer\Console\Application instance'
  1197. );
  1198. }
  1199. }
  1200. return $this->composer;
  1201. }
  1202. public function setComposer(Composer $composer)
  1203. {
  1204. $this->composer = $composer;
  1205. }
  1206. public function resetComposer()
  1207. {
  1208. $this->composer = null;
  1209. $this->getApplication()->resetComposer();
  1210. }
  1211. public function isProxyCommand()
  1212. {
  1213. return false;
  1214. }
  1215. public function getIO()
  1216. {
  1217. if (null === $this->io) {
  1218. $application = $this->getApplication();
  1219. if ($application instanceof Application) {
  1220. $this->io = $application->getIO();
  1221. } else {
  1222. $this->io = new NullIO();
  1223. }
  1224. }
  1225. return $this->io;
  1226. }
  1227. public function setIO(IOInterface $io)
  1228. {
  1229. $this->io = $io;
  1230. }
  1231. protected function initialize(InputInterface $input, OutputInterface $output)
  1232. {
  1233. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1234. $input->setOption('no-progress', true);
  1235. }
  1236. parent::initialize($input, $output);
  1237. }
  1238. }
  1239. <?php
  1240. namespace Composer\Command;
  1241. use Composer\DependencyResolver\Pool;
  1242. use Composer\Package\Link;
  1243. use Composer\Package\PackageInterface;
  1244. use Composer\Repository\ArrayRepository;
  1245. use Composer\Repository\CompositeRepository;
  1246. use Composer\Repository\PlatformRepository;
  1247. use Composer\Repository\RepositoryFactory;
  1248. use Composer\Plugin\CommandEvent;
  1249. use Composer\Plugin\PluginEvents;
  1250. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  1251. use Composer\Package\Version\VersionParser;
  1252. use Symfony\Component\Console\Helper\Table;
  1253. use Symfony\Component\Console\Input\InputArgument;
  1254. use Symfony\Component\Console\Input\InputInterface;
  1255. use Symfony\Component\Console\Input\InputOption;
  1256. use Symfony\Component\Console\Output\OutputInterface;
  1257. class BaseDependencyCommand extends BaseCommand
  1258. {
  1259. const ARGUMENT_PACKAGE = 'package';
  1260. const ARGUMENT_CONSTRAINT = 'constraint';
  1261. const OPTION_RECURSIVE = 'recursive';
  1262. const OPTION_TREE = 'tree';
  1263. protected $colors;
  1264. protected function configure()
  1265. {
  1266. $this->setDefinition(array(
  1267. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  1268. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
  1269. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  1270. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  1271. ));
  1272. }
  1273. protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
  1274. {
  1275. $composer = $this->getComposer();
  1276. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1277. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1278. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1279. $repository = new CompositeRepository(array(
  1280. new ArrayRepository(array($composer->getPackage())),
  1281. $composer->getRepositoryManager()->getLocalRepository(),
  1282. new PlatformRepository(array(), $platformOverrides),
  1283. ));
  1284. $pool = new Pool();
  1285. $pool->addRepository($repository);
  1286. list($needle, $textConstraint) = array_pad(
  1287. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1288. 2,
  1289. $input->getArgument(self::ARGUMENT_CONSTRAINT)
  1290. );
  1291. $packages = $pool->whatProvides($needle);
  1292. if (empty($packages)) {
  1293. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1294. }
  1295. if (!$repository->findPackage($needle, $textConstraint)) {
  1296. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
  1297. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  1298. $repository->addRepository(new ArrayRepository(array(clone $match)));
  1299. }
  1300. }
  1301. $needles = array($needle);
  1302. if ($inverted) {
  1303. foreach ($packages as $package) {
  1304. $needles = array_merge($needles, array_map(function (Link $link) {
  1305. return $link->getTarget();
  1306. }, $package->getReplaces()));
  1307. }
  1308. }
  1309. if ('*' !== $textConstraint) {
  1310. $versionParser = new VersionParser();
  1311. $constraint = $versionParser->parseConstraints($textConstraint);
  1312. } else {
  1313. $constraint = null;
  1314. }
  1315. $renderTree = $input->getOption(self::OPTION_TREE);
  1316. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  1317. $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
  1318. if (empty($results)) {
  1319. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  1320. $this->getIO()->writeError(sprintf('<info>There is no installed package depending on "%s"%s</info>',
  1321. $needle, $extra));
  1322. } elseif ($renderTree) {
  1323. $this->initStyles($output);
  1324. $root = $packages[0];
  1325. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
  1326. $this->printTree($results);
  1327. } else {
  1328. $this->printTable($output, $results);
  1329. }
  1330. return 0;
  1331. }
  1332. protected function printTable(OutputInterface $output, $results)
  1333. {
  1334. $table = array();
  1335. $doubles = array();
  1336. do {
  1337. $queue = array();
  1338. $rows = array();
  1339. foreach ($results as $result) {
  1340. list($package, $link, $children) = $result;
  1341. $unique = (string) $link;
  1342. if (isset($doubles[$unique])) {
  1343. continue;
  1344. }
  1345. $doubles[$unique] = true;
  1346. $version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
  1347. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  1348. if ($children) {
  1349. $queue = array_merge($queue, $children);
  1350. }
  1351. }
  1352. $results = $queue;
  1353. $table = array_merge($rows, $table);
  1354. } while (!empty($results));
  1355. $renderer = new Table($output);
  1356. $renderer->setStyle('compact');
  1357. $renderer->getStyle()->setVerticalBorderChar('');
  1358. $renderer->getStyle()->setCellRowContentFormat('%s ');
  1359. $renderer->setRows($table)->render();
  1360. }
  1361. protected function initStyles(OutputInterface $output)
  1362. {
  1363. $this->colors = array(
  1364. 'green',
  1365. 'yellow',
  1366. 'cyan',
  1367. 'magenta',
  1368. 'blue',
  1369. );
  1370. foreach ($this->colors as $color) {
  1371. $style = new OutputFormatterStyle($color);
  1372. $output->getFormatter()->setStyle($color, $style);
  1373. }
  1374. }
  1375. protected function printTree($results, $prefix = '', $level = 1)
  1376. {
  1377. $count = count($results);
  1378. $idx = 0;
  1379. foreach ($results as $result) {
  1380. list($package, $link, $children) = $result;
  1381. $color = $this->colors[$level % count($this->colors)];
  1382. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  1383. $isLast = (++$idx == $count);
  1384. $versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
  1385. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
  1386. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  1387. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  1388. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  1389. if ($children) {
  1390. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  1391. }
  1392. }
  1393. }
  1394. private function writeTreeLine($line)
  1395. {
  1396. $io = $this->getIO();
  1397. if (!$io->isDecorated()) {
  1398. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  1399. }
  1400. $io->write($line);
  1401. }
  1402. }
  1403. <?php
  1404. namespace Composer\Command;
  1405. use Composer\Cache;
  1406. use Composer\Factory;
  1407. use Symfony\Component\Console\Input\InputInterface;
  1408. use Symfony\Component\Console\Output\OutputInterface;
  1409. class ClearCacheCommand extends BaseCommand
  1410. {
  1411. protected function configure()
  1412. {
  1413. $this
  1414. ->setName('clear-cache')
  1415. ->setAliases(array('clearcache'))
  1416. ->setDescription('Clears composer\'s internal package cache.')
  1417. ->setHelp(<<<EOT
  1418. The <info>clear-cache</info> deletes all cached packages from composer's
  1419. cache directory.
  1420. EOT
  1421. )
  1422. ;
  1423. }
  1424. protected function execute(InputInterface $input, OutputInterface $output)
  1425. {
  1426. $config = Factory::createConfig();
  1427. $io = $this->getIO();
  1428. $cachePaths = array(
  1429. 'cache-dir' => $config->get('cache-dir'),
  1430. 'cache-files-dir' => $config->get('cache-files-dir'),
  1431. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  1432. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  1433. );
  1434. foreach ($cachePaths as $key => $cachePath) {
  1435. $cachePath = realpath($cachePath);
  1436. if (!$cachePath) {
  1437. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  1438. continue;
  1439. }
  1440. $cache = new Cache($io, $cachePath);
  1441. if (!$cache->isEnabled()) {
  1442. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  1443. continue;
  1444. }
  1445. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  1446. $cache->gc(0, 0);
  1447. }
  1448. $io->writeError('<info>All caches cleared.</info>');
  1449. }
  1450. }
  1451. <?php
  1452. namespace Composer\Command;
  1453. use Composer\Util\Platform;
  1454. use Composer\Util\Silencer;
  1455. use Symfony\Component\Console\Input\InputInterface;
  1456. use Symfony\Component\Console\Input\InputArgument;
  1457. use Symfony\Component\Console\Input\InputOption;
  1458. use Symfony\Component\Console\Output\OutputInterface;
  1459. use Composer\Config;
  1460. use Composer\Config\JsonConfigSource;
  1461. use Composer\Factory;
  1462. use Composer\Json\JsonFile;
  1463. use Composer\Semver\VersionParser;
  1464. use Composer\Package\BasePackage;
  1465. class ConfigCommand extends BaseCommand
  1466. {
  1467. protected $config;
  1468. protected $configFile;
  1469. protected $configSource;
  1470. protected $authConfigFile;
  1471. protected $authConfigSource;
  1472. protected function configure()
  1473. {
  1474. $this
  1475. ->setName('config')
  1476. ->setDescription('Set config options')
  1477. ->setDefinition(array(
  1478. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  1479. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  1480. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  1481. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  1482. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  1483. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  1484. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  1485. new InputArgument('setting-key', null, 'Setting key'),
  1486. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  1487. ))
  1488. ->setHelp(<<<EOT
  1489. This command allows you to edit composer config settings and repositories
  1490. in either the local composer.json file or the global config.json file.
  1491. Additionally it lets you edit most properties in the local composer.json.
  1492. To set a config setting:
  1493. <comment>%command.full_name% bin-dir bin/</comment>
  1494. To read a config setting:
  1495. <comment>%command.full_name% bin-dir</comment>
  1496. Outputs: <info>bin</info>
  1497. To edit the global config.json file:
  1498. <comment>%command.full_name% --global</comment>
  1499. To add a repository:
  1500. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  1501. To remove a repository (repo is a short alias for repositories):
  1502. <comment>%command.full_name% --unset repo.foo</comment>
  1503. To disable packagist:
  1504. <comment>%command.full_name% repo.packagist false</comment>
  1505. You can alter repositories in the global config.json file by passing in the
  1506. <info>--global</info> option.
  1507. To edit the file in an external editor:
  1508. <comment>%command.full_name% --editor</comment>
  1509. To choose your editor you can set the "EDITOR" env variable.
  1510. To get a list of configuration values in the file:
  1511. <comment>%command.full_name% --list</comment>
  1512. You can always pass more than one option. As an example, if you want to edit the
  1513. global config.json file.
  1514. <comment>%command.full_name% --editor --global</comment>
  1515. EOT
  1516. )
  1517. ;
  1518. }
  1519. protected function initialize(InputInterface $input, OutputInterface $output)
  1520. {
  1521. parent::initialize($input, $output);
  1522. if ($input->getOption('global') && null !== $input->getOption('file')) {
  1523. throw new \RuntimeException('--file and --global can not be combined');
  1524. }
  1525. $io = $this->getIO();
  1526. $this->config = Factory::createConfig($io);
  1527. $configFile = $input->getOption('global')
  1528. ? ($this->config->get('home') . '/config.json')
  1529. : ($input->getOption('file') ?: trim(getenv('COMPOSER')) ?: 'composer.json');
  1530. if ($configFile === 'composer.json' && !file_exists($configFile) && realpath(getcwd()) === realpath($this->config->get('home'))) {
  1531. file_put_contents($configFile, "{\n}\n");
  1532. }
  1533. $this->configFile = new JsonFile($configFile, null, $io);
  1534. $this->configSource = new JsonConfigSource($this->configFile);
  1535. $authConfigFile = $input->getOption('global')
  1536. ? ($this->config->get('home') . '/auth.json')
  1537. : dirname(realpath($configFile)) . '/auth.json';
  1538. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  1539. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  1540. if ($input->getOption('global') && !$this->configFile->exists()) {
  1541. touch($this->configFile->getPath());
  1542. $this->configFile->write(array('config' => new \ArrayObject));
  1543. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  1544. }
  1545. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  1546. touch($this->authConfigFile->getPath());
  1547. $this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'http-basic' => new \ArrayObject));
  1548. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  1549. }
  1550. if (!$this->configFile->exists()) {
  1551. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  1552. }
  1553. }
  1554. protected function execute(InputInterface $input, OutputInterface $output)
  1555. {
  1556. if ($input->getOption('editor')) {
  1557. $editor = escapeshellcmd(getenv('EDITOR'));
  1558. if (!$editor) {
  1559. if (Platform::isWindows()) {
  1560. $editor = 'notepad';
  1561. } else {
  1562. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  1563. if (exec('which '.$candidate)) {
  1564. $editor = $candidate;
  1565. break;
  1566. }
  1567. }
  1568. }
  1569. }
  1570. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  1571. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  1572. return 0;
  1573. }
  1574. if (!$input->getOption('global')) {
  1575. $this->config->merge($this->configFile->read());
  1576. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
  1577. }
  1578. if ($input->getOption('list')) {
  1579. $this->listConfiguration($this->config->all(), $this->config->raw(), $output);
  1580. return 0;
  1581. }
  1582. $settingKey = $input->getArgument('setting-key');
  1583. if (!$settingKey) {
  1584. return 0;
  1585. }
  1586. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  1587. throw new \RuntimeException('You can not combine a setting value with --unset');
  1588. }
  1589. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  1590. $properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
  1591. $rawData = $this->configFile->read();
  1592. $data = $this->config->all();
  1593. if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  1594. if (empty($matches[1])) {
  1595. $value = isset($data['repositories']) ? $data['repositories'] : array();
  1596. } else {
  1597. if (!isset($data['repositories'][$matches[1]])) {
  1598. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  1599. }
  1600. $value = $data['repositories'][$matches[1]];
  1601. }
  1602. } elseif (strpos($settingKey, '.')) {
  1603. $bits = explode('.', $settingKey);
  1604. if ($bits[0] === 'extra') {
  1605. $data = $rawData;
  1606. } else {
  1607. $data = $data['config'];
  1608. }
  1609. $match = false;
  1610. foreach ($bits as $bit) {
  1611. $key = isset($key) ? $key.'.'.$bit : $bit;
  1612. $match = false;
  1613. if (isset($data[$key])) {
  1614. $match = true;
  1615. $data = $data[$key];
  1616. unset($key);
  1617. }
  1618. }
  1619. if (!$match) {
  1620. throw new \RuntimeException($settingKey.' is not defined.');
  1621. }
  1622. $value = $data;
  1623. } elseif (isset($data['config'][$settingKey])) {
  1624. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  1625. } elseif (in_array($settingKey, $properties, true) && isset($rawData[$settingKey])) {
  1626. $value = $rawData[$settingKey];
  1627. } else {
  1628. throw new \RuntimeException($settingKey.' is not defined');
  1629. }
  1630. if (is_array($value)) {
  1631. $value = json_encode($value);
  1632. }
  1633. $this->getIO()->write($value);
  1634. return 0;
  1635. }
  1636. $values = $input->getArgument('setting-value');
  1637. $booleanValidator = function ($val) { return in_array($val, array('true', 'false', '1', '0'), true); };
  1638. $booleanNormalizer = function ($val) { return $val !== 'false' && (bool) $val; };
  1639. $uniqueConfigValues = array(
  1640. 'process-timeout' => array('is_numeric', 'intval'),
  1641. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  1642. 'preferred-install' => array(
  1643. function ($val) { return in_array($val, array('auto', 'source', 'dist'), true); },
  1644. function ($val) { return $val; },
  1645. ),
  1646. 'store-auths' => array(
  1647. function ($val) { return in_array($val, array('true', 'false', 'prompt'), true); },
  1648. function ($val) {
  1649. if ('prompt' === $val) {
  1650. return 'prompt';
  1651. }
  1652. return $val !== 'false' && (bool) $val;
  1653. },
  1654. ),
  1655. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  1656. 'vendor-dir' => array('is_string', function ($val) { return $val; }),
  1657. 'bin-dir' => array('is_string', function ($val) { return $val; }),
  1658. 'archive-dir' => array('is_string', function ($val) { return $val; }),
  1659. 'archive-format' => array('is_string', function ($val) { return $val; }),
  1660. 'data-dir' => array('is_string', function ($val) { return $val; }),
  1661. 'cache-dir' => array('is_string', function ($val) { return $val; }),
  1662. 'cache-files-dir' => array('is_string', function ($val) { return $val; }),
  1663. 'cache-repo-dir' => array('is_string', function ($val) { return $val; }),
  1664. 'cache-vcs-dir' => array('is_string', function ($val) { return $val; }),
  1665. 'cache-ttl' => array('is_numeric', 'intval'),
  1666. 'cache-files-ttl' => array('is_numeric', 'intval'),
  1667. 'cache-files-maxsize' => array(
  1668. function ($val) { return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0; },
  1669. function ($val) { return $val; },
  1670. ),
  1671. 'bin-compat' => array(
  1672. function ($val) { return in_array($val, array('auto', 'full')); },
  1673. function ($val) { return $val; },
  1674. ),
  1675. 'discard-changes' => array(
  1676. function ($val) { return in_array($val, array('stash', 'true', 'false', '1', '0'), true); },
  1677. function ($val) {
  1678. if ('stash' === $val) {
  1679. return 'stash';
  1680. }
  1681. return $val !== 'false' && (bool) $val;
  1682. },
  1683. ),
  1684. 'autoloader-suffix' => array('is_string', function ($val) { return $val === 'null' ? null : $val; }),
  1685. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  1686. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  1687. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  1688. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  1689. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  1690. 'secure-http' => array($booleanValidator, $booleanNormalizer),
  1691. 'cafile' => array(
  1692. function ($val) { return file_exists($val) && is_readable($val); },
  1693. function ($val) { return $val === 'null' ? null : $val; },
  1694. ),
  1695. 'capath' => array(
  1696. function ($val) { return is_dir($val) && is_readable($val); },
  1697. function ($val) { return $val === 'null' ? null : $val; },
  1698. ),
  1699. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  1700. );
  1701. $multiConfigValues = array(
  1702. 'github-protocols' => array(
  1703. function ($vals) {
  1704. if (!is_array($vals)) {
  1705. return 'array expected';
  1706. }
  1707. foreach ($vals as $val) {
  1708. if (!in_array($val, array('git', 'https', 'ssh'))) {
  1709. return 'valid protocols include: git, https, ssh';
  1710. }
  1711. }
  1712. return true;
  1713. },
  1714. function ($vals) {
  1715. return $vals;
  1716. },
  1717. ),
  1718. 'github-domains' => array(
  1719. function ($vals) {
  1720. if (!is_array($vals)) {
  1721. return 'array expected';
  1722. }
  1723. return true;
  1724. },
  1725. function ($vals) {
  1726. return $vals;
  1727. },
  1728. ),
  1729. 'gitlab-domains' => array(
  1730. function ($vals) {
  1731. if (!is_array($vals)) {
  1732. return 'array expected';
  1733. }
  1734. return true;
  1735. },
  1736. function ($vals) {
  1737. return $vals;
  1738. },
  1739. ),
  1740. );
  1741. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  1742. return $this->configSource->removeConfigSetting($settingKey);
  1743. }
  1744. if (isset($uniqueConfigValues[$settingKey])) {
  1745. return $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  1746. }
  1747. if (isset($multiConfigValues[$settingKey])) {
  1748. return $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  1749. }
  1750. $uniqueProps = array(
  1751. 'name' => array('is_string', function ($val) { return $val; }),
  1752. 'type' => array('is_string', function ($val) { return $val; }),
  1753. 'description' => array('is_string', function ($val) { return $val; }),
  1754. 'homepage' => array('is_string', function ($val) { return $val; }),
  1755. 'version' => array('is_string', function ($val) { return $val; }),
  1756. 'minimum-stability' => array(
  1757. function ($val) { return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]); },
  1758. function ($val) { return VersionParser::normalizeStability($val); }
  1759. ),
  1760. 'prefer-stable' => array($booleanValidator, $booleanNormalizer),
  1761. );
  1762. $multiProps = array(
  1763. 'keywords' => array(
  1764. function ($vals) {
  1765. if (!is_array($vals)) {
  1766. return 'array expected';
  1767. }
  1768. return true;
  1769. },
  1770. function ($vals) {
  1771. return $vals;
  1772. },
  1773. ),
  1774. 'license' => array(
  1775. function ($vals) {
  1776. if (!is_array($vals)) {
  1777. return 'array expected';
  1778. }
  1779. return true;
  1780. },
  1781. function ($vals) {
  1782. return $vals;
  1783. },
  1784. ),
  1785. );
  1786. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || substr($settingKey, 0, 6) === 'extra.')) {
  1787. throw new \InvalidArgumentException('The '.$settingKey.' property can not be set in the global config.json file. Use `composer global config` to apply changes to the global composer.json');
  1788. }
  1789. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  1790. return $this->configSource->removeProperty($settingKey);
  1791. }
  1792. if (isset($uniqueProps[$settingKey])) {
  1793. return $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  1794. }
  1795. if (isset($multiProps[$settingKey])) {
  1796. return $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  1797. }
  1798. if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  1799. if ($input->getOption('unset')) {
  1800. return $this->configSource->removeRepository($matches[1]);
  1801. }
  1802. if (2 === count($values)) {
  1803. return $this->configSource->addRepository($matches[1], array(
  1804. 'type' => $values[0],
  1805. 'url' => $values[1],
  1806. ));
  1807. }
  1808. if (1 === count($values)) {
  1809. $value = strtolower($values[0]);
  1810. if (true === $booleanValidator($value)) {
  1811. if (false === $booleanNormalizer($value)) {
  1812. return $this->configSource->addRepository($matches[1], false);
  1813. }
  1814. } else {
  1815. $value = JsonFile::parseJson($values[0]);
  1816. return $this->configSource->addRepository($matches[1], $value);
  1817. }
  1818. }
  1819. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  1820. }
  1821. if (preg_match('/^extra\.(.+)/', $settingKey, $matches)) {
  1822. if ($input->getOption('unset')) {
  1823. return $this->configSource->removeProperty($settingKey);
  1824. }
  1825. return $this->configSource->addProperty($settingKey, $values[0]);
  1826. }
  1827. if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
  1828. if ($input->getOption('unset')) {
  1829. return $this->configSource->removeConfigSetting($settingKey);
  1830. }
  1831. return $this->configSource->addConfigSetting($settingKey, $values[0]);
  1832. }
  1833. if (preg_match('/^(bitbucket-oauth|github-oauth|gitlab-oauth|http-basic)\.(.+)/', $settingKey, $matches)) {
  1834. if ($input->getOption('unset')) {
  1835. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  1836. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  1837. return;
  1838. }
  1839. if ($matches[1] === 'bitbucket-oauth') {
  1840. if (2 !== count($values)) {
  1841. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  1842. }
  1843. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  1844. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
  1845. } elseif ($matches[1] === 'github-oauth' || $matches[1] === 'gitlab-oauth') {
  1846. if (1 !== count($values)) {
  1847. throw new \RuntimeException('Too many arguments, expected only one token');
  1848. }
  1849. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  1850. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  1851. } elseif ($matches[1] === 'http-basic') {
  1852. if (2 !== count($values)) {
  1853. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  1854. }
  1855. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  1856. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  1857. }
  1858. return;
  1859. }
  1860. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  1861. }
  1862. protected function handleSingleValue($key, array $callbacks, array $values, $method)
  1863. {
  1864. list($validator, $normalizer) = $callbacks;
  1865. if (1 !== count($values)) {
  1866. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  1867. }
  1868. if (true !== $validation = $validator($values[0])) {
  1869. throw new \RuntimeException(sprintf(
  1870. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  1871. $values[0]
  1872. ));
  1873. }
  1874. return call_user_func(array($this->configSource, $method), $key, $normalizer($values[0]));
  1875. }
  1876. protected function handleMultiValue($key, array $callbacks, array $values, $method)
  1877. {
  1878. list($validator, $normalizer) = $callbacks;
  1879. if (true !== $validation = $validator($values)) {
  1880. throw new \RuntimeException(sprintf(
  1881. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  1882. json_encode($values)
  1883. ));
  1884. }
  1885. return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
  1886. }
  1887. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
  1888. {
  1889. $origK = $k;
  1890. $io = $this->getIO();
  1891. foreach ($contents as $key => $value) {
  1892. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  1893. continue;
  1894. }
  1895. $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
  1896. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  1897. $k .= preg_replace('{^config\.}', '', $key . '.');
  1898. $this->listConfiguration($value, $rawVal, $output, $k);
  1899. $k = $origK;
  1900. continue;
  1901. }
  1902. if (is_array($value)) {
  1903. $value = array_map(function ($val) {
  1904. return is_array($val) ? json_encode($val) : $val;
  1905. }, $value);
  1906. $value = '['.implode(', ', $value).']';
  1907. }
  1908. if (is_bool($value)) {
  1909. $value = var_export($value, true);
  1910. }
  1911. if (is_string($rawVal) && $rawVal != $value) {
  1912. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>');
  1913. } else {
  1914. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>');
  1915. }
  1916. }
  1917. }
  1918. }
  1919. <?php
  1920. namespace Composer\Command;
  1921. use Composer\Config;
  1922. use Composer\Factory;
  1923. use Composer\Installer;
  1924. use Composer\Installer\ProjectInstaller;
  1925. use Composer\Installer\InstallationManager;
  1926. use Composer\Installer\SuggestedPackagesReporter;
  1927. use Composer\IO\IOInterface;
  1928. use Composer\Package\BasePackage;
  1929. use Composer\DependencyResolver\Pool;
  1930. use Composer\DependencyResolver\Operation\InstallOperation;
  1931. use Composer\Package\Version\VersionSelector;
  1932. use Composer\Repository\RepositoryFactory;
  1933. use Composer\Repository\CompositeRepository;
  1934. use Composer\Repository\PlatformRepository;
  1935. use Composer\Repository\InstalledFilesystemRepository;
  1936. use Composer\Script\ScriptEvents;
  1937. use Composer\Util\Silencer;
  1938. use Symfony\Component\Console\Input\InputArgument;
  1939. use Symfony\Component\Console\Input\InputInterface;
  1940. use Symfony\Component\Console\Input\InputOption;
  1941. use Symfony\Component\Console\Output\OutputInterface;
  1942. use Symfony\Component\Finder\Finder;
  1943. use Composer\Json\JsonFile;
  1944. use Composer\Config\JsonConfigSource;
  1945. use Composer\Util\Filesystem;
  1946. use Composer\Package\Version\VersionParser;
  1947. class CreateProjectCommand extends BaseCommand
  1948. {
  1949. protected $suggestedPackagesReporter;
  1950. protected function configure()
  1951. {
  1952. $this
  1953. ->setName('create-project')
  1954. ->setDescription('Create new project from a package into given directory.')
  1955. ->setDefinition(array(
  1956. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  1957. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  1958. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  1959. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  1960. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  1961. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  1962. new InputOption('repository', null, InputOption::VALUE_REQUIRED, 'Pick a different repository (as url or json config) to look for the package.'),
  1963. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  1964. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  1965. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  1966. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  1967. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  1968. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  1969. new InputOption('no-secure-http', null, InputOption::VALUE_NONE, 'Disable the secure-http config option temporarily while installing the root package. Use at your own risk. Using this flag is a bad idea.'),
  1970. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deletion vcs folder.'),
  1971. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  1972. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  1973. ))
  1974. ->setHelp(<<<EOT
  1975. The <info>create-project</info> command creates a new project from a given
  1976. package into a new directory. If executed without params and in a directory
  1977. with a composer.json file it installs the packages for the current project.
  1978. You can use this command to bootstrap new projects or setup a clean
  1979. version-controlled installation for developers of your project.
  1980. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  1981. You can also specify the version with the package name using = or : as separator.
  1982. <info>php composer.phar create-project vendor/project:version target-directory</info>
  1983. To install unstable packages, either specify the version you want, or use the
  1984. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  1985. To setup a developer workable version you should create the project using the source
  1986. controlled code by appending the <info>'--prefer-source'</info> flag.
  1987. To install a package from another repository than the default one you
  1988. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  1989. EOT
  1990. )
  1991. ;
  1992. }
  1993. protected function execute(InputInterface $input, OutputInterface $output)
  1994. {
  1995. $config = Factory::createConfig();
  1996. $io = $this->getIO();
  1997. $this->updatePreferredOptions($config, $input, $preferSource, $preferDist, true);
  1998. if ($input->getOption('dev')) {
  1999. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  2000. }
  2001. if ($input->getOption('no-custom-installers')) {
  2002. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  2003. $input->setOption('no-plugins', true);
  2004. }
  2005. return $this->installProject(
  2006. $io,
  2007. $config,
  2008. $input,
  2009. $input->getArgument('package'),
  2010. $input->getArgument('directory'),
  2011. $input->getArgument('version'),
  2012. $input->getOption('stability'),
  2013. $preferSource,
  2014. $preferDist,
  2015. !$input->getOption('no-dev'),
  2016. $input->getOption('repository') ?: $input->getOption('repository-url'),
  2017. $input->getOption('no-plugins'),
  2018. $input->getOption('no-scripts'),
  2019. $input->getOption('keep-vcs'),
  2020. $input->getOption('no-progress'),
  2021. $input->getOption('no-install'),
  2022. $input->getOption('ignore-platform-reqs'),
  2023. !$input->getOption('no-secure-http')
  2024. );
  2025. }
  2026. public function installProject(IOInterface $io, Config $config, InputInterface $input, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false, $secureHttp = true)
  2027. {
  2028. $oldCwd = getcwd();
  2029. $io->loadConfiguration($config);
  2030. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  2031. if ($packageName !== null) {
  2032. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $keepVcs, $noProgress, $ignorePlatformReqs, $secureHttp);
  2033. } else {
  2034. $installedFromVcs = false;
  2035. }
  2036. $composer = Factory::create($io, null, $disablePlugins);
  2037. $composer->getDownloadManager()->setOutputProgress(!$noProgress);
  2038. $fs = new Filesystem();
  2039. if ($noScripts === false) {
  2040. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  2041. }
  2042. $rootPackageConfig = $composer->getConfig();
  2043. $this->updatePreferredOptions($rootPackageConfig, $input, $preferSource, $preferDist);
  2044. if ($noInstall === false) {
  2045. $installer = Installer::create($io, $composer);
  2046. $installer->setPreferSource($preferSource)
  2047. ->setPreferDist($preferDist)
  2048. ->setDevMode($installDevPackages)
  2049. ->setRunScripts(!$noScripts)
  2050. ->setIgnorePlatformRequirements($ignorePlatformReqs)
  2051. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter);
  2052. if ($disablePlugins) {
  2053. $installer->disablePlugins();
  2054. }
  2055. $status = $installer->run();
  2056. if (0 !== $status) {
  2057. return $status;
  2058. }
  2059. }
  2060. $hasVcs = $installedFromVcs;
  2061. if (!$keepVcs && $installedFromVcs
  2062. && (
  2063. !$io->isInteractive()
  2064. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
  2065. )
  2066. ) {
  2067. $finder = new Finder();
  2068. $finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
  2069. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
  2070. $finder->name($vcsName);
  2071. }
  2072. try {
  2073. $dirs = iterator_to_array($finder);
  2074. unset($finder);
  2075. foreach ($dirs as $dir) {
  2076. if (!$fs->removeDirectory($dir)) {
  2077. throw new \RuntimeException('Could not remove '.$dir);
  2078. }
  2079. }
  2080. } catch (\Exception $e) {
  2081. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  2082. }
  2083. $hasVcs = false;
  2084. }
  2085. if (!$hasVcs) {
  2086. $package = $composer->getPackage();
  2087. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2088. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  2089. foreach ($package->{'get'.$meta['method']}() as $link) {
  2090. if ($link->getPrettyConstraint() === 'self.version') {
  2091. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  2092. }
  2093. }
  2094. }
  2095. }
  2096. if ($noScripts === false) {
  2097. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  2098. }
  2099. chdir($oldCwd);
  2100. $vendorComposerDir = $composer->getConfig()->get('vendor-dir').'/composer';
  2101. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  2102. Silencer::call('rmdir', $vendorComposerDir);
  2103. $vendorDir = $composer->getConfig()->get('vendor-dir');
  2104. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  2105. Silencer::call('rmdir', $vendorDir);
  2106. }
  2107. }
  2108. return 0;
  2109. }
  2110. protected function installRootPackage(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false, $ignorePlatformReqs = false, $secureHttp = true)
  2111. {
  2112. if (!$secureHttp) {
  2113. $config->merge(array('config' => array('secure-http' => false)));
  2114. }
  2115. if (null === $repository) {
  2116. $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config));
  2117. } else {
  2118. $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true);
  2119. }
  2120. $parser = new VersionParser();
  2121. $requirements = $parser->parseNameVersionPairs(array($packageName));
  2122. $name = strtolower($requirements[0]['name']);
  2123. if (!$packageVersion && isset($requirements[0]['version'])) {
  2124. $packageVersion = $requirements[0]['version'];
  2125. }
  2126. if (null === $stability) {
  2127. if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  2128. $stability = $match[1];
  2129. } else {
  2130. $stability = VersionParser::parseStability($packageVersion);
  2131. }
  2132. }
  2133. $stability = VersionParser::normalizeStability($stability);
  2134. if (!isset(BasePackage::$stabilities[$stability])) {
  2135. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  2136. }
  2137. $pool = new Pool($stability);
  2138. $pool->addRepository($sourceRepo);
  2139. $phpVersion = null;
  2140. $prettyPhpVersion = null;
  2141. if (!$ignorePlatformReqs) {
  2142. $platformOverrides = $config->get('platform') ?: array();
  2143. $platform = new PlatformRepository(array(), $platformOverrides);
  2144. $phpPackage = $platform->findPackage('php', '*');
  2145. $phpVersion = $phpPackage->getVersion();
  2146. $prettyPhpVersion = $phpPackage->getPrettyVersion();
  2147. }
  2148. $versionSelector = new VersionSelector($pool);
  2149. $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
  2150. if (!$package) {
  2151. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  2152. if ($phpVersion && $versionSelector->findBestCandidate($name, $packageVersion, null, $stability)) {
  2153. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version '.$prettyPhpVersion.'.');
  2154. }
  2155. throw new \InvalidArgumentException($errorMessage .'.');
  2156. }
  2157. if (null === $directory) {
  2158. $parts = explode("/", $name, 2);
  2159. $directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  2160. }
  2161. if (function_exists('pcntl_signal')) {
  2162. declare(ticks=100);
  2163. pcntl_signal(SIGINT, function () use ($directory) {
  2164. $fs = new Filesystem();
  2165. $fs->removeDirectory($directory);
  2166. exit(130);
  2167. });
  2168. }
  2169. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  2170. if ($disablePlugins) {
  2171. $io->writeError('<info>Plugins have been disabled.</info>');
  2172. }
  2173. if (0 === strpos($package->getPrettyVersion(), 'dev-') && in_array($package->getSourceType(), array('git', 'hg'))) {
  2174. $package->setSourceReference(substr($package->getPrettyVersion(), 4));
  2175. }
  2176. $dm = $this->createDownloadManager($io, $config);
  2177. $dm->setPreferSource($preferSource)
  2178. ->setPreferDist($preferDist)
  2179. ->setOutputProgress(!$noProgress);
  2180. $projectInstaller = new ProjectInstaller($directory, $dm);
  2181. $im = $this->createInstallationManager();
  2182. $im->addInstaller($projectInstaller);
  2183. $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
  2184. $im->notifyInstalls($io);
  2185. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  2186. $installedFromVcs = 'source' === $package->getInstallationSource();
  2187. $io->writeError('<info>Created project in ' . $directory . '</info>');
  2188. chdir($directory);
  2189. $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
  2190. putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
  2191. return $installedFromVcs;
  2192. }
  2193. protected function createDownloadManager(IOInterface $io, Config $config)
  2194. {
  2195. $factory = new Factory();
  2196. return $factory->createDownloadManager($io, $config);
  2197. }
  2198. protected function createInstallationManager()
  2199. {
  2200. return new InstallationManager();
  2201. }
  2202. protected function updatePreferredOptions(Config $config, InputInterface $input, &$preferSource, &$preferDist, $keepVcsRequiresPreferSource = false)
  2203. {
  2204. $preferSource = false;
  2205. $preferDist = false;
  2206. switch ($config->get('preferred-install')) {
  2207. case 'source':
  2208. $preferSource = true;
  2209. break;
  2210. case 'dist':
  2211. $preferDist = true;
  2212. break;
  2213. case 'auto':
  2214. default:
  2215. break;
  2216. }
  2217. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->getOption('keep-vcs'))) {
  2218. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->getOption('keep-vcs'));
  2219. $preferDist = $input->getOption('prefer-dist');
  2220. }
  2221. }
  2222. }
  2223. <?php
  2224. namespace Composer\Command;
  2225. use Symfony\Component\Console\Input\InputInterface;
  2226. use Symfony\Component\Console\Output\OutputInterface;
  2227. class DependsCommand extends BaseDependencyCommand
  2228. {
  2229. protected function configure()
  2230. {
  2231. parent::configure();
  2232. $this
  2233. ->setName('depends')
  2234. ->setAliases(array('why'))
  2235. ->setDescription('Shows which packages cause the given package to be installed')
  2236. ->setHelp(<<<EOT
  2237. Displays detailed information about where a package is referenced.
  2238. <info>php composer.phar depends composer/composer</info>
  2239. EOT
  2240. )
  2241. ;
  2242. }
  2243. protected function execute(InputInterface $input, OutputInterface $output)
  2244. {
  2245. return parent::doExecute($input, $output, false);
  2246. }
  2247. }
  2248. <?php
  2249. namespace Composer\Command;
  2250. use Composer\Composer;
  2251. use Composer\Factory;
  2252. use Composer\Config;
  2253. use Composer\Downloader\TransportException;
  2254. use Composer\Plugin\CommandEvent;
  2255. use Composer\Plugin\PluginEvents;
  2256. use Composer\Util\ConfigValidator;
  2257. use Composer\Util\ProcessExecutor;
  2258. use Composer\Util\RemoteFilesystem;
  2259. use Composer\Util\StreamContextFactory;
  2260. use Composer\SelfUpdate\Keys;
  2261. use Composer\SelfUpdate\Versions;
  2262. use Composer\IO\NullIO;
  2263. use Symfony\Component\Console\Input\InputInterface;
  2264. use Symfony\Component\Console\Output\OutputInterface;
  2265. class DiagnoseCommand extends BaseCommand
  2266. {
  2267. protected $rfs;
  2268. protected $process;
  2269. protected $exitCode = 0;
  2270. protected function configure()
  2271. {
  2272. $this
  2273. ->setName('diagnose')
  2274. ->setDescription('Diagnoses the system to identify common errors.')
  2275. ->setHelp(<<<EOT
  2276. The <info>diagnose</info> command checks common errors to help debugging problems.
  2277. The process exit code will be 1 in case of warnings and 2 for errors.
  2278. EOT
  2279. )
  2280. ;
  2281. }
  2282. protected function execute(InputInterface $input, OutputInterface $output)
  2283. {
  2284. $composer = $this->getComposer(false);
  2285. $io = $this->getIO();
  2286. if ($composer) {
  2287. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  2288. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2289. $io->write('Checking composer.json: ', false);
  2290. $this->outputResult($this->checkComposerSchema());
  2291. }
  2292. if ($composer) {
  2293. $config = $composer->getConfig();
  2294. } else {
  2295. $config = Factory::createConfig();
  2296. }
  2297. $config->merge(array('config' => array('secure-http' => false)));
  2298. $config->prohibitUrlByConfig('http://packagist.org', new NullIO);
  2299. $this->rfs = Factory::createRemoteFilesystem($io, $config);
  2300. $this->process = new ProcessExecutor($io);
  2301. $io->write('Checking platform settings: ', false);
  2302. $this->outputResult($this->checkPlatform());
  2303. $io->write('Checking git settings: ', false);
  2304. $this->outputResult($this->checkGit());
  2305. $io->write('Checking http connectivity to packagist: ', false);
  2306. $this->outputResult($this->checkHttp('http', $config));
  2307. $io->write('Checking https connectivity to packagist: ', false);
  2308. $this->outputResult($this->checkHttp('https', $config));
  2309. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  2310. if (!empty($opts['http']['proxy'])) {
  2311. $io->write('Checking HTTP proxy: ', false);
  2312. $this->outputResult($this->checkHttpProxy());
  2313. $io->write('Checking HTTP proxy support for request_fulluri: ', false);
  2314. $this->outputResult($this->checkHttpProxyFullUriRequestParam());
  2315. $io->write('Checking HTTPS proxy support for request_fulluri: ', false);
  2316. $this->outputResult($this->checkHttpsProxyFullUriRequestParam());
  2317. }
  2318. if ($oauth = $config->get('github-oauth')) {
  2319. foreach ($oauth as $domain => $token) {
  2320. $io->write('Checking '.$domain.' oauth access: ', false);
  2321. $this->outputResult($this->checkGithubOauth($domain, $token));
  2322. }
  2323. } else {
  2324. $io->write('Checking github.com rate limit: ', false);
  2325. try {
  2326. $rate = $this->getGithubRateLimit('github.com');
  2327. $this->outputResult(true);
  2328. if (10 > $rate['remaining']) {
  2329. $io->write('<warning>WARNING</warning>');
  2330. $io->write(sprintf(
  2331. '<comment>Github has a rate limit on their API. '
  2332. . 'You currently have <options=bold>%u</options=bold> '
  2333. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  2334. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  2335. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  2336. $rate['remaining'],
  2337. $rate['limit']
  2338. ));
  2339. }
  2340. } catch (\Exception $e) {
  2341. if ($e instanceof TransportException && $e->getCode() === 401) {
  2342. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  2343. } else {
  2344. $this->outputResult($e);
  2345. }
  2346. }
  2347. }
  2348. $io->write('Checking disk free space: ', false);
  2349. $this->outputResult($this->checkDiskSpace($config));
  2350. if ('phar:' === substr(__FILE__, 0, 5)) {
  2351. $io->write('Checking pubkeys: ', false);
  2352. $this->outputResult($this->checkPubKeys($config));
  2353. $io->write('Checking composer version: ', false);
  2354. $this->outputResult($this->checkVersion($config));
  2355. }
  2356. return $this->exitCode;
  2357. }
  2358. private function checkComposerSchema()
  2359. {
  2360. $validator = new ConfigValidator($this->getIO());
  2361. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  2362. if ($errors || $warnings) {
  2363. $messages = array(
  2364. 'error' => $errors,
  2365. 'warning' => $warnings,
  2366. );
  2367. $output = '';
  2368. foreach ($messages as $style => $msgs) {
  2369. foreach ($msgs as $msg) {
  2370. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  2371. }
  2372. }
  2373. return rtrim($output);
  2374. }
  2375. return true;
  2376. }
  2377. private function checkGit()
  2378. {
  2379. $this->process->execute('git config color.ui', $output);
  2380. if (strtolower(trim($output)) === 'always') {
  2381. return '<comment>Your git color.ui setting is set to always, this is known to create issues. Use "git config --global color.ui true" to set it correctly.</comment>';
  2382. }
  2383. return true;
  2384. }
  2385. private function checkHttp($proto, Config $config)
  2386. {
  2387. $disableTls = false;
  2388. $result = array();
  2389. if ($proto === 'https' && $config->get('disable-tls') === true) {
  2390. $disableTls = true;
  2391. $result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  2392. }
  2393. if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
  2394. $result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
  2395. }
  2396. try {
  2397. $this->rfs->getContents('packagist.org', $proto . '://packagist.org/packages.json', false);
  2398. } catch (TransportException $e) {
  2399. if (false !== strpos($e->getMessage(), 'cafile')) {
  2400. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  2401. $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
  2402. $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
  2403. } else {
  2404. array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
  2405. }
  2406. }
  2407. if (count($result) > 0) {
  2408. return $result;
  2409. }
  2410. return true;
  2411. }
  2412. private function checkHttpProxy()
  2413. {
  2414. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2415. try {
  2416. $json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://packagist.org/packages.json', false), true);
  2417. $hash = reset($json['provider-includes']);
  2418. $hash = $hash['sha256'];
  2419. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  2420. $provider = $this->rfs->getContents('packagist.org', $protocol . '://packagist.org/'.$path, false);
  2421. if (hash('sha256', $provider) !== $hash) {
  2422. return 'It seems that your proxy is modifying http traffic on the fly';
  2423. }
  2424. } catch (\Exception $e) {
  2425. return $e;
  2426. }
  2427. return true;
  2428. }
  2429. private function checkHttpProxyFullUriRequestParam()
  2430. {
  2431. $url = 'http://packagist.org/packages.json';
  2432. try {
  2433. $this->rfs->getContents('packagist.org', $url, false);
  2434. } catch (TransportException $e) {
  2435. try {
  2436. $this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
  2437. } catch (TransportException $e) {
  2438. return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
  2439. }
  2440. return 'It seems there is a problem with your proxy server, try setting the "HTTP_PROXY_REQUEST_FULLURI" and "HTTPS_PROXY_REQUEST_FULLURI" environment variables to "false"';
  2441. }
  2442. return true;
  2443. }
  2444. private function checkHttpsProxyFullUriRequestParam()
  2445. {
  2446. if (!extension_loaded('openssl')) {
  2447. return 'You need the openssl extension installed for this check';
  2448. }
  2449. $url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
  2450. try {
  2451. $this->rfs->getContents('github.com', $url, false);
  2452. } catch (TransportException $e) {
  2453. try {
  2454. $this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
  2455. } catch (TransportException $e) {
  2456. return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
  2457. }
  2458. return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
  2459. }
  2460. return true;
  2461. }
  2462. private function checkGithubOauth($domain, $token)
  2463. {
  2464. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2465. try {
  2466. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  2467. return $this->rfs->getContents($domain, $url, false, array(
  2468. 'retry-auth-failure' => false,
  2469. )) ? true : 'Unexpected error';
  2470. } catch (\Exception $e) {
  2471. if ($e instanceof TransportException && $e->getCode() === 401) {
  2472. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  2473. }
  2474. return $e;
  2475. }
  2476. }
  2477. private function getGithubRateLimit($domain, $token = null)
  2478. {
  2479. if ($token) {
  2480. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2481. }
  2482. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  2483. $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
  2484. $data = json_decode($json, true);
  2485. return $data['resources']['core'];
  2486. }
  2487. private function checkDiskSpace($config)
  2488. {
  2489. $minSpaceFree = 1024 * 1024;
  2490. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  2491. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  2492. ) {
  2493. return '<error>The disk hosting '.$dir.' is full</error>';
  2494. }
  2495. return true;
  2496. }
  2497. private function checkPubKeys($config)
  2498. {
  2499. $home = $config->get('home');
  2500. $errors = array();
  2501. $io = $this->getIO();
  2502. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  2503. $io->write('');
  2504. }
  2505. if (file_exists($home.'/keys.tags.pub')) {
  2506. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  2507. } else {
  2508. $errors[] = '<error>Missing pubkey for tags verification</error>';
  2509. }
  2510. if (file_exists($home.'/keys.dev.pub')) {
  2511. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  2512. } else {
  2513. $errors[] = '<error>Missing pubkey for dev verification</error>';
  2514. }
  2515. if ($errors) {
  2516. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  2517. }
  2518. return $errors ?: true;
  2519. }
  2520. private function checkVersion($config)
  2521. {
  2522. $versionsUtil = new Versions($config, $this->rfs);
  2523. $latest = $versionsUtil->getLatest();
  2524. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  2525. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  2526. }
  2527. return true;
  2528. }
  2529. private function outputResult($result)
  2530. {
  2531. $io = $this->getIO();
  2532. if (true === $result) {
  2533. $io->write('<info>OK</info>');
  2534. return;
  2535. }
  2536. $hadError = false;
  2537. if ($result instanceof \Exception) {
  2538. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  2539. }
  2540. if (!$result) {
  2541. $hadError = true;
  2542. } else {
  2543. if (!is_array($result)) {
  2544. $result = array($result);
  2545. }
  2546. foreach ($result as $message) {
  2547. if (false !== strpos($message, '<error>')) {
  2548. $hadError = true;
  2549. }
  2550. }
  2551. }
  2552. if ($hadError) {
  2553. $io->write('<error>FAIL</error>');
  2554. $this->exitCode = 2;
  2555. } else {
  2556. $io->write('<warning>WARNING</warning>');
  2557. $this->exitCode = 1;
  2558. }
  2559. if ($result) {
  2560. foreach ($result as $message) {
  2561. $io->write($message);
  2562. }
  2563. }
  2564. }
  2565. private function checkPlatform()
  2566. {
  2567. $output = '';
  2568. $out = function ($msg, $style) use (&$output) {
  2569. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  2570. };
  2571. $errors = array();
  2572. $warnings = array();
  2573. $iniPath = php_ini_loaded_file();
  2574. $displayIniMessage = false;
  2575. if ($iniPath) {
  2576. $iniMessage = PHP_EOL.PHP_EOL.'The php.ini used by your command-line PHP is: ' . $iniPath;
  2577. } else {
  2578. $iniMessage = PHP_EOL.PHP_EOL.'A php.ini file does not exist. You will have to create one.';
  2579. }
  2580. $iniMessage .= PHP_EOL.'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.';
  2581. if (!function_exists('json_decode')) {
  2582. $errors['json'] = true;
  2583. }
  2584. if (!extension_loaded('Phar')) {
  2585. $errors['phar'] = true;
  2586. }
  2587. if (!extension_loaded('filter')) {
  2588. $errors['filter'] = true;
  2589. }
  2590. if (!extension_loaded('hash')) {
  2591. $errors['hash'] = true;
  2592. }
  2593. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  2594. $errors['iconv_mbstring'] = true;
  2595. }
  2596. if (!ini_get('allow_url_fopen')) {
  2597. $errors['allow_url_fopen'] = true;
  2598. }
  2599. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  2600. $errors['ioncube'] = ioncube_loader_version();
  2601. }
  2602. if (PHP_VERSION_ID < 50302) {
  2603. $errors['php'] = PHP_VERSION;
  2604. }
  2605. if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
  2606. $warnings['php'] = PHP_VERSION;
  2607. }
  2608. if (!extension_loaded('openssl')) {
  2609. $errors['openssl'] = true;
  2610. }
  2611. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  2612. $warnings['openssl_version'] = true;
  2613. }
  2614. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && ini_get('apc.enable_cli')) {
  2615. $warnings['apc_cli'] = true;
  2616. }
  2617. ob_start();
  2618. phpinfo(INFO_GENERAL);
  2619. $phpinfo = ob_get_clean();
  2620. if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  2621. $configure = $match[1];
  2622. if (false !== strpos($configure, '--enable-sigchild')) {
  2623. $warnings['sigchild'] = true;
  2624. }
  2625. if (false !== strpos($configure, '--with-curlwrappers')) {
  2626. $warnings['curlwrappers'] = true;
  2627. }
  2628. }
  2629. if (ini_get('xdebug.profiler_enabled')) {
  2630. $warnings['xdebug_profile'] = true;
  2631. } elseif (extension_loaded('xdebug')) {
  2632. $warnings['xdebug_loaded'] = true;
  2633. }
  2634. if (!empty($errors)) {
  2635. foreach ($errors as $error => $current) {
  2636. switch ($error) {
  2637. case 'json':
  2638. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  2639. $text .= "Install it or recompile php without --disable-json";
  2640. break;
  2641. case 'phar':
  2642. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  2643. $text .= "Install it or recompile php without --disable-phar";
  2644. break;
  2645. case 'filter':
  2646. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  2647. $text .= "Install it or recompile php without --disable-filter";
  2648. break;
  2649. case 'hash':
  2650. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  2651. $text .= "Install it or recompile php without --disable-hash";
  2652. break;
  2653. case 'iconv_mbstring':
  2654. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  2655. $text .= "Install either of them or recompile php without --disable-iconv";
  2656. break;
  2657. case 'unicode':
  2658. $text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
  2659. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2660. $text .= " detect_unicode = Off";
  2661. $displayIniMessage = true;
  2662. break;
  2663. case 'suhosin':
  2664. $text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
  2665. $text .= "Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):".PHP_EOL;
  2666. $text .= " suhosin.executor.include.whitelist = phar ".$current;
  2667. $displayIniMessage = true;
  2668. break;
  2669. case 'php':
  2670. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
  2671. break;
  2672. case 'allow_url_fopen':
  2673. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  2674. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2675. $text .= " allow_url_fopen = On";
  2676. $displayIniMessage = true;
  2677. break;
  2678. case 'ioncube':
  2679. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  2680. $text .= "Upgrade to ionCube 4.0.9 or higher or remove this line (path may be different) from your `php.ini` to disable it:".PHP_EOL;
  2681. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  2682. $displayIniMessage = true;
  2683. break;
  2684. case 'openssl':
  2685. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  2686. $text .= "If possible you should enable it or recompile php with --with-openssl";
  2687. break;
  2688. }
  2689. $out($text, 'error');
  2690. }
  2691. $output .= PHP_EOL;
  2692. }
  2693. if (!empty($warnings)) {
  2694. foreach ($warnings as $warning => $current) {
  2695. switch ($warning) {
  2696. case 'apc_cli':
  2697. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  2698. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2699. $text .= " apc.enable_cli = Off";
  2700. $displayIniMessage = true;
  2701. break;
  2702. case 'sigchild':
  2703. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  2704. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  2705. $text .= " https://bugs.php.net/bug.php?id=22999";
  2706. break;
  2707. case 'curlwrappers':
  2708. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  2709. $text .= " Recompile it without this flag if possible";
  2710. break;
  2711. case 'php':
  2712. $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
  2713. $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";
  2714. break;
  2715. case 'openssl_version':
  2716. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  2717. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  2718. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  2719. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  2720. break;
  2721. case 'xdebug_loaded':
  2722. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  2723. $text .= " Disabling it when using Composer is recommended.";
  2724. break;
  2725. case 'xdebug_profile':
  2726. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  2727. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  2728. $text .= " xdebug.profiler_enabled = 0";
  2729. $displayIniMessage = true;
  2730. break;
  2731. }
  2732. $out($text, 'comment');
  2733. }
  2734. }
  2735. if ($displayIniMessage) {
  2736. $out($iniMessage, 'comment');
  2737. }
  2738. return !$warnings && !$errors ? true : $output;
  2739. }
  2740. }
  2741. <?php
  2742. namespace Composer\Command;
  2743. use Composer\Plugin\CommandEvent;
  2744. use Composer\Plugin\PluginEvents;
  2745. use Symfony\Component\Console\Input\InputInterface;
  2746. use Symfony\Component\Console\Input\InputOption;
  2747. use Symfony\Component\Console\Output\OutputInterface;
  2748. class DumpAutoloadCommand extends BaseCommand
  2749. {
  2750. protected function configure()
  2751. {
  2752. $this
  2753. ->setName('dump-autoload')
  2754. ->setAliases(array('dumpautoload'))
  2755. ->setDescription('Dumps the autoloader')
  2756. ->setDefinition(array(
  2757. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  2758. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  2759. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  2760. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
  2761. ))
  2762. ->setHelp(<<<EOT
  2763. <info>php composer.phar dump-autoload</info>
  2764. EOT
  2765. )
  2766. ;
  2767. }
  2768. protected function execute(InputInterface $input, OutputInterface $output)
  2769. {
  2770. $composer = $this->getComposer();
  2771. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  2772. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2773. $installationManager = $composer->getInstallationManager();
  2774. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  2775. $package = $composer->getPackage();
  2776. $config = $composer->getConfig();
  2777. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  2778. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  2779. if ($optimize || $authoritative) {
  2780. $this->getIO()->writeError('<info>Generating optimized autoload files</info>');
  2781. } else {
  2782. $this->getIO()->writeError('<info>Generating autoload files</info>');
  2783. }
  2784. $generator = $composer->getAutoloadGenerator();
  2785. $generator->setDevMode(!$input->getOption('no-dev'));
  2786. $generator->setClassMapAuthoritative($authoritative);
  2787. $generator->setRunScripts(!$input->getOption('no-scripts'));
  2788. $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  2789. }
  2790. }
  2791. <?php
  2792. namespace Composer\Command;
  2793. use Symfony\Component\Console\Input\InputInterface;
  2794. use Symfony\Component\Console\Input\InputOption;
  2795. use Symfony\Component\Console\Output\OutputInterface;
  2796. use Symfony\Component\Console\Input\InputArgument;
  2797. class ExecCommand extends BaseCommand
  2798. {
  2799. protected function configure()
  2800. {
  2801. $this
  2802. ->setName('exec')
  2803. ->setDescription('Execute a vendored binary/script')
  2804. ->setDefinition(array(
  2805. new InputOption('list', 'l', InputOption::VALUE_NONE),
  2806. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit'),
  2807. new InputArgument(
  2808. 'args',
  2809. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  2810. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  2811. ),
  2812. ))
  2813. ;
  2814. }
  2815. protected function execute(InputInterface $input, OutputInterface $output)
  2816. {
  2817. $composer = $this->getComposer();
  2818. $binDir = $composer->getConfig()->get('bin-dir');
  2819. if ($input->getOption('list') || !$input->getArgument('binary')) {
  2820. $bins = glob($binDir . '/*');
  2821. if (!$bins) {
  2822. throw new \RuntimeException("No binaries found in bin-dir ($binDir)");
  2823. }
  2824. $this->getIO()->write(<<<EOT
  2825. <comment>Available binaries:</comment>
  2826. EOT
  2827. );
  2828. foreach ($bins as $bin) {
  2829. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  2830. continue;
  2831. }
  2832. $previousBin = $bin;
  2833. $bin = basename($bin);
  2834. $this->getIO()->write(<<<EOT
  2835. <info>- $bin</info>
  2836. EOT
  2837. );
  2838. }
  2839. return 0;
  2840. }
  2841. $binary = $input->getArgument('binary');
  2842. $dispatcher = $composer->getEventDispatcher();
  2843. $dispatcher->addListener('__exec_command', $binary);
  2844. if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
  2845. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  2846. }
  2847. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  2848. }
  2849. }
  2850. <?php
  2851. namespace Composer\Command;
  2852. use Composer\Factory;
  2853. use Symfony\Component\Console\Input\InputInterface;
  2854. use Symfony\Component\Console\Input\InputArgument;
  2855. use Symfony\Component\Console\Input\StringInput;
  2856. use Symfony\Component\Console\Output\OutputInterface;
  2857. class GlobalCommand extends BaseCommand
  2858. {
  2859. protected function configure()
  2860. {
  2861. $this
  2862. ->setName('global')
  2863. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  2864. ->setDefinition(array(
  2865. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  2866. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  2867. ))
  2868. ->setHelp(<<<EOT
  2869. Use this command as a wrapper to run other Composer commands
  2870. within the global context of COMPOSER_HOME.
  2871. You can use this to install CLI utilities globally, all you need
  2872. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  2873. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  2874. and /home/<user>/.composer on unix systems.
  2875. Note: This path may vary depending on customizations to bin-dir in
  2876. composer.json or the environmental variable COMPOSER_BIN_DIR.
  2877. EOT
  2878. )
  2879. ;
  2880. }
  2881. public function run(InputInterface $input, OutputInterface $output)
  2882. {
  2883. $tokens = preg_split('{\s+}', $input->__toString());
  2884. $args = array();
  2885. foreach ($tokens as $token) {
  2886. if ($token && $token[0] !== '-') {
  2887. $args[] = $token;
  2888. if (count($args) >= 2) {
  2889. break;
  2890. }
  2891. }
  2892. }
  2893. if (count($args) < 2) {
  2894. return parent::run($input, $output);
  2895. }
  2896. $config = Factory::createConfig();
  2897. chdir($config->get('home'));
  2898. $this->getIO()->writeError('<info>Changed current directory to '.$config->get('home').'</info>');
  2899. $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  2900. $this->getApplication()->resetComposer();
  2901. return $this->getApplication()->run($input, $output);
  2902. }
  2903. public function isProxyCommand()
  2904. {
  2905. return true;
  2906. }
  2907. }
  2908. <?php
  2909. namespace Composer\Command;
  2910. use Composer\Package\CompletePackageInterface;
  2911. use Composer\Repository\RepositoryInterface;
  2912. use Composer\Repository\ArrayRepository;
  2913. use Composer\Repository\RepositoryFactory;
  2914. use Composer\Util\Platform;
  2915. use Composer\Util\ProcessExecutor;
  2916. use Symfony\Component\Console\Input\InputArgument;
  2917. use Symfony\Component\Console\Input\InputOption;
  2918. use Symfony\Component\Console\Input\InputInterface;
  2919. use Symfony\Component\Console\Output\OutputInterface;
  2920. class HomeCommand extends BaseCommand
  2921. {
  2922. protected function configure()
  2923. {
  2924. $this
  2925. ->setName('browse')
  2926. ->setAliases(array('home'))
  2927. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  2928. ->setDefinition(array(
  2929. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Package(s) to browse to.'),
  2930. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  2931. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  2932. ))
  2933. ->setHelp(<<<EOT
  2934. The home command opens or shows a package's repository URL or
  2935. homepage in your default browser.
  2936. To open the homepage by default, use -H or --homepage.
  2937. To show instead of open the repository or homepage URL, use -s or --show.
  2938. EOT
  2939. );
  2940. }
  2941. protected function execute(InputInterface $input, OutputInterface $output)
  2942. {
  2943. $repos = $this->initializeRepos();
  2944. $io = $this->getIO();
  2945. $return = 0;
  2946. foreach ($input->getArgument('packages') as $packageName) {
  2947. $handled = false;
  2948. $packageExists = false;
  2949. foreach ($repos as $repo) {
  2950. foreach ($repo->findPackages($packageName) as $package) {
  2951. $packageExists = true;
  2952. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  2953. $handled = true;
  2954. break 2;
  2955. }
  2956. }
  2957. }
  2958. if (!$packageExists) {
  2959. $return = 1;
  2960. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  2961. }
  2962. if (!$handled) {
  2963. $return = 1;
  2964. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  2965. }
  2966. }
  2967. return $return;
  2968. }
  2969. private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
  2970. {
  2971. $support = $package->getSupport();
  2972. $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
  2973. if (!$url || $showHomepage) {
  2974. $url = $package->getHomepage();
  2975. }
  2976. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  2977. return false;
  2978. }
  2979. if ($showOnly) {
  2980. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  2981. } else {
  2982. $this->openBrowser($url);
  2983. }
  2984. return true;
  2985. }
  2986. private function openBrowser($url)
  2987. {
  2988. $url = ProcessExecutor::escape($url);
  2989. $process = new ProcessExecutor($this->getIO());
  2990. if (Platform::isWindows()) {
  2991. return $process->execute('start "web" explorer "' . $url . '"', $output);
  2992. }
  2993. $linux = $process->execute('which xdg-open', $output);
  2994. $osx = $process->execute('which open', $output);
  2995. if (0 === $linux) {
  2996. $process->execute('xdg-open ' . $url, $output);
  2997. } elseif (0 === $osx) {
  2998. $process->execute('open ' . $url, $output);
  2999. } else {
  3000. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  3001. }
  3002. }
  3003. private function initializeRepos()
  3004. {
  3005. $composer = $this->getComposer(false);
  3006. if ($composer) {
  3007. return array_merge(
  3008. array(new ArrayRepository(array($composer->getPackage()))),
  3009. array($composer->getRepositoryManager()->getLocalRepository()),
  3010. $composer->getRepositoryManager()->getRepositories()
  3011. );
  3012. }
  3013. return RepositoryFactory::defaultRepos($this->getIO());
  3014. }
  3015. }
  3016. <?php
  3017. namespace Composer\Command;
  3018. use Composer\DependencyResolver\Pool;
  3019. use Composer\Json\JsonFile;
  3020. use Composer\Factory;
  3021. use Composer\Repository\RepositoryFactory;
  3022. use Composer\Package\BasePackage;
  3023. use Composer\Package\Version\VersionParser;
  3024. use Composer\Package\Version\VersionSelector;
  3025. use Composer\Repository\CompositeRepository;
  3026. use Composer\Repository\PlatformRepository;
  3027. use Composer\Util\ProcessExecutor;
  3028. use Symfony\Component\Console\Input\InputInterface;
  3029. use Symfony\Component\Console\Input\InputOption;
  3030. use Symfony\Component\Console\Output\OutputInterface;
  3031. use Symfony\Component\Process\Process;
  3032. use Symfony\Component\Process\ExecutableFinder;
  3033. class InitCommand extends BaseCommand
  3034. {
  3035. protected $repos;
  3036. private $gitConfig;
  3037. private $pool;
  3038. protected function configure()
  3039. {
  3040. $this
  3041. ->setName('init')
  3042. ->setDescription('Creates a basic composer.json file in current directory.')
  3043. ->setDefinition(array(
  3044. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  3045. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  3046. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  3047. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  3048. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  3049. new InputOption('require', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3050. new InputOption('require-dev', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require for development with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3051. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  3052. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  3053. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  3054. ))
  3055. ->setHelp(<<<EOT
  3056. The <info>init</info> command creates a basic composer.json file
  3057. in the current directory.
  3058. <info>php composer.phar init</info>
  3059. EOT
  3060. )
  3061. ;
  3062. }
  3063. protected function execute(InputInterface $input, OutputInterface $output)
  3064. {
  3065. $io = $this->getIO();
  3066. $whitelist = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
  3067. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($whitelist)));
  3068. if (isset($options['author'])) {
  3069. $options['authors'] = $this->formatAuthors($options['author']);
  3070. unset($options['author']);
  3071. }
  3072. $repositories = $input->getOption('repository');
  3073. if ($repositories) {
  3074. $config = Factory::createConfig($io);
  3075. foreach ($repositories as $repo) {
  3076. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo);
  3077. }
  3078. }
  3079. if (isset($options['stability'])) {
  3080. $options['minimum-stability'] = $options['stability'];
  3081. unset($options['stability']);
  3082. }
  3083. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  3084. if (array() === $options['require']) {
  3085. $options['require'] = new \stdClass;
  3086. }
  3087. if (isset($options['require-dev'])) {
  3088. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  3089. if (array() === $options['require-dev']) {
  3090. $options['require-dev'] = new \stdClass;
  3091. }
  3092. }
  3093. $file = new JsonFile(Factory::getComposerFile());
  3094. $json = $file->encode($options);
  3095. if ($input->isInteractive()) {
  3096. $io->writeError(array('', $json, ''));
  3097. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) {
  3098. $io->writeError('<error>Command aborted</error>');
  3099. return 1;
  3100. }
  3101. }
  3102. $file->write($options);
  3103. if ($input->isInteractive() && is_dir('.git')) {
  3104. $ignoreFile = realpath('.gitignore');
  3105. if (false === $ignoreFile) {
  3106. $ignoreFile = realpath('.') . '/.gitignore';
  3107. }
  3108. if (!$this->hasVendorIgnore($ignoreFile)) {
  3109. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  3110. if ($io->askConfirmation($question, true)) {
  3111. $this->addVendorIgnore($ignoreFile);
  3112. }
  3113. }
  3114. }
  3115. }
  3116. protected function interact(InputInterface $input, OutputInterface $output)
  3117. {
  3118. $git = $this->getGitConfig();
  3119. $io = $this->getIO();
  3120. $formatter = $this->getHelperSet()->get('formatter');
  3121. $repositories = $input->getOption('repository');
  3122. if ($repositories) {
  3123. $config = Factory::createConfig($io);
  3124. $repos = array(new PlatformRepository);
  3125. foreach ($repositories as $repo) {
  3126. $repos[] = RepositoryFactory::fromString($io, $config, $repo);
  3127. }
  3128. $repos[] = RepositoryFactory::createRepo($io, $config, array(
  3129. 'type' => 'composer',
  3130. 'url' => 'https://packagist.org',
  3131. ));
  3132. $this->repos = new CompositeRepository($repos);
  3133. unset($repos, $config, $repositories);
  3134. }
  3135. $io->writeError(array(
  3136. '',
  3137. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  3138. '',
  3139. ));
  3140. $io->writeError(array(
  3141. '',
  3142. 'This command will guide you through creating your composer.json config.',
  3143. '',
  3144. ));
  3145. $cwd = realpath(".");
  3146. if (!$name = $input->getOption('name')) {
  3147. $name = basename($cwd);
  3148. $name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  3149. $name = strtolower($name);
  3150. if (isset($git['github.user'])) {
  3151. $name = $git['github.user'] . '/' . $name;
  3152. } elseif (!empty($_SERVER['USERNAME'])) {
  3153. $name = $_SERVER['USERNAME'] . '/' . $name;
  3154. } elseif (get_current_user()) {
  3155. $name = get_current_user() . '/' . $name;
  3156. } else {
  3157. $name = $name . '/' . $name;
  3158. }
  3159. $name = strtolower($name);
  3160. } else {
  3161. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $name)) {
  3162. throw new \InvalidArgumentException(
  3163. 'The package name '.$name.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  3164. );
  3165. }
  3166. }
  3167. $name = $io->askAndValidate(
  3168. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  3169. function ($value) use ($name) {
  3170. if (null === $value) {
  3171. return $name;
  3172. }
  3173. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $value)) {
  3174. throw new \InvalidArgumentException(
  3175. 'The package name '.$value.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  3176. );
  3177. }
  3178. return $value;
  3179. },
  3180. null,
  3181. $name
  3182. );
  3183. $input->setOption('name', $name);
  3184. $description = $input->getOption('description') ?: false;
  3185. $description = $io->ask(
  3186. 'Description [<comment>'.$description.'</comment>]: ',
  3187. $description
  3188. );
  3189. $input->setOption('description', $description);
  3190. if (null === $author = $input->getOption('author')) {
  3191. if (isset($git['user.name']) && isset($git['user.email'])) {
  3192. $author = sprintf('%s <%s>', $git['user.name'], $git['user.email']);
  3193. }
  3194. }
  3195. $self = $this;
  3196. $author = $io->askAndValidate(
  3197. 'Author [<comment>'.$author.'</comment>, n to skip]: ',
  3198. function ($value) use ($self, $author) {
  3199. if ($value === 'n' || $value === 'no') {
  3200. return;
  3201. }
  3202. $value = $value ?: $author;
  3203. $author = $self->parseAuthorString($value);
  3204. return sprintf('%s <%s>', $author['name'], $author['email']);
  3205. },
  3206. null,
  3207. $author
  3208. );
  3209. $input->setOption('author', $author);
  3210. $minimumStability = $input->getOption('stability') ?: null;
  3211. $minimumStability = $io->askAndValidate(
  3212. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  3213. function ($value) use ($self, $minimumStability) {
  3214. if (null === $value) {
  3215. return $minimumStability;
  3216. }
  3217. if (!isset(BasePackage::$stabilities[$value])) {
  3218. throw new \InvalidArgumentException(
  3219. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  3220. implode(', ', array_keys(BasePackage::$stabilities))
  3221. );
  3222. }
  3223. return $value;
  3224. },
  3225. null,
  3226. $minimumStability
  3227. );
  3228. $input->setOption('stability', $minimumStability);
  3229. $type = $input->getOption('type') ?: false;
  3230. $type = $io->ask(
  3231. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  3232. $type
  3233. );
  3234. $input->setOption('type', $type);
  3235. $license = $input->getOption('license') ?: false;
  3236. $license = $io->ask(
  3237. 'License [<comment>'.$license.'</comment>]: ',
  3238. $license
  3239. );
  3240. $input->setOption('license', $license);
  3241. $io->writeError(array('', 'Define your dependencies.', ''));
  3242. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  3243. $requirements = array();
  3244. if ($io->askConfirmation($question, true)) {
  3245. $requirements = $this->determineRequirements($input, $output, $input->getOption('require'));
  3246. }
  3247. $input->setOption('require', $requirements);
  3248. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  3249. $devRequirements = array();
  3250. if ($io->askConfirmation($question, true)) {
  3251. $devRequirements = $this->determineRequirements($input, $output, $input->getOption('require-dev'));
  3252. }
  3253. $input->setOption('require-dev', $devRequirements);
  3254. }
  3255. public function parseAuthorString($author)
  3256. {
  3257. if (preg_match('/^(?P<name>[- .,\p{L}\p{N}\'’"()]+) <(?P<email>.+?)>$/u', $author, $match)) {
  3258. if ($this->isValidEmail($match['email'])) {
  3259. return array(
  3260. 'name' => trim($match['name']),
  3261. 'email' => $match['email'],
  3262. );
  3263. }
  3264. }
  3265. throw new \InvalidArgumentException(
  3266. 'Invalid author string. Must be in the format: '.
  3267. 'John Smith <john@example.com>'
  3268. );
  3269. }
  3270. protected function findPackages($name)
  3271. {
  3272. return $this->getRepos()->search($name);
  3273. }
  3274. protected function getRepos()
  3275. {
  3276. if (!$this->repos) {
  3277. $this->repos = new CompositeRepository(array_merge(
  3278. array(new PlatformRepository),
  3279. RepositoryFactory::defaultRepos($this->getIO())
  3280. ));
  3281. }
  3282. return $this->repos;
  3283. }
  3284. protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), $phpVersion = null)
  3285. {
  3286. if ($requires) {
  3287. $requires = $this->normalizeRequirements($requires);
  3288. $result = array();
  3289. $io = $this->getIO();
  3290. foreach ($requires as $requirement) {
  3291. if (!isset($requirement['version'])) {
  3292. $version = $this->findBestVersionForPackage($input, $requirement['name'], $phpVersion);
  3293. $requirement['version'] = $version;
  3294. $io->writeError(sprintf(
  3295. 'Using version <info>%s</info> for <info>%s</info>',
  3296. $requirement['version'],
  3297. $requirement['name']
  3298. ));
  3299. }
  3300. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  3301. }
  3302. return $result;
  3303. }
  3304. $versionParser = new VersionParser();
  3305. $io = $this->getIO();
  3306. while (null !== $package = $io->ask('Search for a package: ')) {
  3307. $matches = $this->findPackages($package);
  3308. if (count($matches)) {
  3309. $exactMatch = null;
  3310. $choices = array();
  3311. foreach ($matches as $position => $foundPackage) {
  3312. $choices[] = sprintf(' <info>%5s</info> %s', "[$position]", $foundPackage['name']);
  3313. if ($foundPackage['name'] === $package) {
  3314. $exactMatch = true;
  3315. break;
  3316. }
  3317. }
  3318. if (!$exactMatch) {
  3319. $io->writeError(array(
  3320. '',
  3321. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  3322. '',
  3323. ));
  3324. $io->writeError($choices);
  3325. $io->writeError('');
  3326. $validator = function ($selection) use ($matches, $versionParser) {
  3327. if ('' === $selection) {
  3328. return false;
  3329. }
  3330. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  3331. $package = $matches[(int) $selection];
  3332. return $package['name'];
  3333. }
  3334. if (preg_match('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  3335. if (isset($packageMatches['version'])) {
  3336. $versionParser->parseConstraints($packageMatches['version']);
  3337. return $packageMatches['name'].' '.$packageMatches['version'];
  3338. }
  3339. return $packageMatches['name'];
  3340. }
  3341. throw new \Exception('Not a valid selection');
  3342. };
  3343. $package = $io->askAndValidate(
  3344. 'Enter package # to add, or the complete package name if it is not listed: ',
  3345. $validator,
  3346. 3,
  3347. false
  3348. );
  3349. }
  3350. if (false !== $package && false === strpos($package, ' ')) {
  3351. $validator = function ($input) {
  3352. $input = trim($input);
  3353. return $input ?: false;
  3354. };
  3355. $constraint = $io->askAndValidate(
  3356. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  3357. $validator,
  3358. 3,
  3359. false
  3360. );
  3361. if (false === $constraint) {
  3362. $constraint = $this->findBestVersionForPackage($input, $package, $phpVersion);
  3363. $io->writeError(sprintf(
  3364. 'Using version <info>%s</info> for <info>%s</info>',
  3365. $constraint,
  3366. $package
  3367. ));
  3368. }
  3369. $package .= ' '.$constraint;
  3370. }
  3371. if (false !== $package) {
  3372. $requires[] = $package;
  3373. }
  3374. }
  3375. }
  3376. return $requires;
  3377. }
  3378. protected function formatAuthors($author)
  3379. {
  3380. return array($this->parseAuthorString($author));
  3381. }
  3382. protected function formatRequirements(array $requirements)
  3383. {
  3384. $requires = array();
  3385. $requirements = $this->normalizeRequirements($requirements);
  3386. foreach ($requirements as $requirement) {
  3387. $requires[$requirement['name']] = $requirement['version'];
  3388. }
  3389. return $requires;
  3390. }
  3391. protected function getGitConfig()
  3392. {
  3393. if (null !== $this->gitConfig) {
  3394. return $this->gitConfig;
  3395. }
  3396. $finder = new ExecutableFinder();
  3397. $gitBin = $finder->find('git');
  3398. $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
  3399. $cmd->run();
  3400. if ($cmd->isSuccessful()) {
  3401. $this->gitConfig = array();
  3402. preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
  3403. foreach ($matches as $match) {
  3404. $this->gitConfig[$match[1]] = $match[2];
  3405. }
  3406. return $this->gitConfig;
  3407. }
  3408. return $this->gitConfig = array();
  3409. }
  3410. protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
  3411. {
  3412. if (!file_exists($ignoreFile)) {
  3413. return false;
  3414. }
  3415. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  3416. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  3417. foreach ($lines as $line) {
  3418. if (preg_match($pattern, $line)) {
  3419. return true;
  3420. }
  3421. }
  3422. return false;
  3423. }
  3424. protected function normalizeRequirements(array $requirements)
  3425. {
  3426. $parser = new VersionParser();
  3427. return $parser->parseNameVersionPairs($requirements);
  3428. }
  3429. protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
  3430. {
  3431. $contents = "";
  3432. if (file_exists($ignoreFile)) {
  3433. $contents = file_get_contents($ignoreFile);
  3434. if ("\n" !== substr($contents, 0, -1)) {
  3435. $contents .= "\n";
  3436. }
  3437. }
  3438. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  3439. }
  3440. protected function isValidEmail($email)
  3441. {
  3442. if (!function_exists('filter_var')) {
  3443. return true;
  3444. }
  3445. if (PHP_VERSION_ID < 50303) {
  3446. return true;
  3447. }
  3448. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  3449. }
  3450. private function getPool(InputInterface $input)
  3451. {
  3452. if (!$this->pool) {
  3453. $this->pool = new Pool($this->getMinimumStability($input));
  3454. $this->pool->addRepository($this->getRepos());
  3455. }
  3456. return $this->pool;
  3457. }
  3458. private function getMinimumStability(InputInterface $input)
  3459. {
  3460. if ($input->hasOption('stability')) {
  3461. return $input->getOption('stability') ?: 'stable';
  3462. }
  3463. $file = Factory::getComposerFile();
  3464. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  3465. if (!empty($composer['minimum-stability'])) {
  3466. return $composer['minimum-stability'];
  3467. }
  3468. }
  3469. return 'stable';
  3470. }
  3471. private function findBestVersionForPackage(InputInterface $input, $name, $phpVersion)
  3472. {
  3473. $versionSelector = new VersionSelector($this->getPool($input));
  3474. $package = $versionSelector->findBestCandidate($name, null, $phpVersion);
  3475. if (!$package) {
  3476. if ($phpVersion && $versionSelector->findBestCandidate($name)) {
  3477. throw new \InvalidArgumentException(sprintf(
  3478. 'Could not find package %s at any version matching your PHP version %s', $name, $phpVersion
  3479. ));
  3480. }
  3481. throw new \InvalidArgumentException(sprintf(
  3482. 'Could not find package %s at any version for your minimum-stability (%s). Check the package spelling or your minimum-stability',
  3483. $name,
  3484. $this->getMinimumStability($input)
  3485. ));
  3486. }
  3487. return $versionSelector->findRecommendedRequireVersion($package);
  3488. }
  3489. }
  3490. <?php
  3491. namespace Composer\Command;
  3492. use Composer\Installer;
  3493. use Composer\Plugin\CommandEvent;
  3494. use Composer\Plugin\PluginEvents;
  3495. use Symfony\Component\Console\Input\InputInterface;
  3496. use Symfony\Component\Console\Input\InputOption;
  3497. use Symfony\Component\Console\Input\InputArgument;
  3498. use Symfony\Component\Console\Output\OutputInterface;
  3499. class InstallCommand extends BaseCommand
  3500. {
  3501. protected function configure()
  3502. {
  3503. $this
  3504. ->setName('install')
  3505. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  3506. ->setDefinition(array(
  3507. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  3508. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  3509. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  3510. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  3511. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  3512. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  3513. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  3514. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3515. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3516. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  3517. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  3518. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  3519. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  3520. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  3521. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  3522. ))
  3523. ->setHelp(<<<EOT
  3524. The <info>install</info> command reads the composer.lock file from
  3525. the current directory, processes it, and downloads and installs all the
  3526. libraries and dependencies outlined in that file. If the file does not
  3527. exist it will look for composer.json and do the same.
  3528. <info>php composer.phar install</info>
  3529. EOT
  3530. )
  3531. ;
  3532. }
  3533. protected function execute(InputInterface $input, OutputInterface $output)
  3534. {
  3535. $io = $this->getIO();
  3536. if ($args = $input->getArgument('packages')) {
  3537. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  3538. return 1;
  3539. }
  3540. if ($input->getOption('no-custom-installers')) {
  3541. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  3542. $input->setOption('no-plugins', true);
  3543. }
  3544. if ($input->getOption('dev')) {
  3545. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  3546. }
  3547. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  3548. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  3549. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  3550. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3551. $install = Installer::create($io, $composer);
  3552. $preferSource = false;
  3553. $preferDist = false;
  3554. $config = $composer->getConfig();
  3555. switch ($config->get('preferred-install')) {
  3556. case 'source':
  3557. $preferSource = true;
  3558. break;
  3559. case 'dist':
  3560. $preferDist = true;
  3561. break;
  3562. case 'auto':
  3563. default:
  3564. break;
  3565. }
  3566. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist')) {
  3567. $preferSource = $input->getOption('prefer-source');
  3568. $preferDist = $input->getOption('prefer-dist');
  3569. }
  3570. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  3571. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3572. $install
  3573. ->setDryRun($input->getOption('dry-run'))
  3574. ->setVerbose($input->getOption('verbose'))
  3575. ->setPreferSource($preferSource)
  3576. ->setPreferDist($preferDist)
  3577. ->setDevMode(!$input->getOption('no-dev'))
  3578. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  3579. ->setRunScripts(!$input->getOption('no-scripts'))
  3580. ->setSkipSuggest($input->getOption('no-suggest'))
  3581. ->setOptimizeAutoloader($optimize)
  3582. ->setClassMapAuthoritative($authoritative)
  3583. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  3584. ;
  3585. if ($input->getOption('no-plugins')) {
  3586. $install->disablePlugins();
  3587. }
  3588. return $install->run();
  3589. }
  3590. }
  3591. <?php
  3592. namespace Composer\Command;
  3593. use Composer\Json\JsonFile;
  3594. use Composer\Plugin\CommandEvent;
  3595. use Composer\Plugin\PluginEvents;
  3596. use Composer\Package\PackageInterface;
  3597. use Composer\Repository\RepositoryInterface;
  3598. use Symfony\Component\Console\Helper\Table;
  3599. use Symfony\Component\Console\Input\InputInterface;
  3600. use Symfony\Component\Console\Input\InputOption;
  3601. use Symfony\Component\Console\Output\OutputInterface;
  3602. class LicensesCommand extends BaseCommand
  3603. {
  3604. protected function configure()
  3605. {
  3606. $this
  3607. ->setName('licenses')
  3608. ->setDescription('Show information about licenses of dependencies')
  3609. ->setDefinition(array(
  3610. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  3611. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  3612. ))
  3613. ->setHelp(<<<EOT
  3614. The license command displays detailed information about the licenses of
  3615. the installed dependencies.
  3616. EOT
  3617. )
  3618. ;
  3619. }
  3620. protected function execute(InputInterface $input, OutputInterface $output)
  3621. {
  3622. $composer = $this->getComposer();
  3623. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  3624. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3625. $root = $composer->getPackage();
  3626. $repo = $composer->getRepositoryManager()->getLocalRepository();
  3627. if ($input->getOption('no-dev')) {
  3628. $packages = $this->filterRequiredPackages($repo, $root);
  3629. } else {
  3630. $packages = $this->appendPackages($repo->getPackages(), array());
  3631. }
  3632. ksort($packages);
  3633. $io = $this->getIO();
  3634. switch ($format = $input->getOption('format')) {
  3635. case 'text':
  3636. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  3637. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  3638. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  3639. $io->write('Dependencies:');
  3640. $io->write('');
  3641. $table = new Table($output);
  3642. $table->setStyle('compact');
  3643. $table->getStyle()->setVerticalBorderChar('');
  3644. $table->getStyle()->setCellRowContentFormat('%s ');
  3645. $table->setHeaders(array('Name', 'Version', 'License'));
  3646. foreach ($packages as $package) {
  3647. $table->addRow(array(
  3648. $package->getPrettyName(),
  3649. $package->getFullPrettyVersion(),
  3650. implode(', ', $package->getLicense()) ?: 'none',
  3651. ));
  3652. }
  3653. $table->render();
  3654. break;
  3655. case 'json':
  3656. $dependencies = array();
  3657. foreach ($packages as $package) {
  3658. $dependencies[$package->getPrettyName()] = array(
  3659. 'version' => $package->getFullPrettyVersion(),
  3660. 'license' => $package->getLicense(),
  3661. );
  3662. }
  3663. $io->write(JsonFile::encode(array(
  3664. 'name' => $root->getPrettyName(),
  3665. 'version' => $root->getFullPrettyVersion(),
  3666. 'license' => $root->getLicense(),
  3667. 'dependencies' => $dependencies,
  3668. )));
  3669. break;
  3670. default:
  3671. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  3672. }
  3673. }
  3674. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
  3675. {
  3676. $requires = array_keys($package->getRequires());
  3677. $packageListNames = array_keys($bucket);
  3678. $packages = array_filter(
  3679. $repo->getPackages(),
  3680. function ($package) use ($requires, $packageListNames) {
  3681. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  3682. }
  3683. );
  3684. $bucket = $this->appendPackages($packages, $bucket);
  3685. foreach ($packages as $package) {
  3686. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  3687. }
  3688. return $bucket;
  3689. }
  3690. public function appendPackages(array $packages, array $bucket)
  3691. {
  3692. foreach ($packages as $package) {
  3693. $bucket[$package->getName()] = $package;
  3694. }
  3695. return $bucket;
  3696. }
  3697. }
  3698. <?php
  3699. namespace Composer\Command;
  3700. use Symfony\Component\Console\Input\InputInterface;
  3701. use Symfony\Component\Console\Input\InputArgument;
  3702. use Symfony\Component\Console\Input\ArrayInput;
  3703. use Symfony\Component\Console\Input\InputOption;
  3704. use Symfony\Component\Console\Output\OutputInterface;
  3705. class OutdatedCommand extends ShowCommand
  3706. {
  3707. protected function configure()
  3708. {
  3709. $this
  3710. ->setName('outdated')
  3711. ->setDescription('Shows a list of installed packages that have updates available, including their latest version.')
  3712. ->setDefinition(array(
  3713. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  3714. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  3715. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  3716. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  3717. ))
  3718. ->setHelp(<<<EOT
  3719. The outdated command is just a proxy for `composer show -l`
  3720. The color coding for dependency versions is as such:
  3721. - <info>green</info>: Dependency is in the latest version and is up to date.
  3722. - <comment>yellow</comment>: Dependency has a new version available that includes backwards
  3723. compatibility breaks according to semver, so upgrade when you can but it
  3724. may involve work.
  3725. - <highlight>red</highlight>: Dependency has a new version that is semver-compatible and you should upgrade it.
  3726. EOT
  3727. )
  3728. ;
  3729. }
  3730. protected function execute(InputInterface $input, OutputInterface $output)
  3731. {
  3732. $args = array(
  3733. 'show',
  3734. '--latest' => true,
  3735. );
  3736. if (!$input->getOption('all')) {
  3737. $args['--outdated'] = true;
  3738. }
  3739. if ($input->getOption('direct')) {
  3740. $args['--direct'] = true;
  3741. }
  3742. if ($input->getArgument('package')) {
  3743. $args['package'] = $input->getArgument('package');
  3744. }
  3745. $input = new ArrayInput($args);
  3746. return $this->getApplication()->run($input, $output);
  3747. }
  3748. public function isProxyCommand()
  3749. {
  3750. return true;
  3751. }
  3752. }
  3753. <?php
  3754. namespace Composer\Command;
  3755. use Symfony\Component\Console\Input\InputInterface;
  3756. use Symfony\Component\Console\Output\OutputInterface;
  3757. class ProhibitsCommand extends BaseDependencyCommand
  3758. {
  3759. protected function configure()
  3760. {
  3761. parent::configure();
  3762. $this
  3763. ->setName('prohibits')
  3764. ->setAliases(array('why-not'))
  3765. ->setDescription('Shows which packages prevent the given package from being installed')
  3766. ->setHelp(<<<EOT
  3767. Displays detailed information about why a package cannot be installed.
  3768. <info>php composer.phar prohibits composer/composer</info>
  3769. EOT
  3770. )
  3771. ;
  3772. }
  3773. protected function execute(InputInterface $input, OutputInterface $output)
  3774. {
  3775. return parent::doExecute($input, $output, true);
  3776. }
  3777. }
  3778. <?php
  3779. namespace Composer\Command;
  3780. use Composer\Config\JsonConfigSource;
  3781. use Composer\Installer;
  3782. use Composer\Plugin\CommandEvent;
  3783. use Composer\Plugin\PluginEvents;
  3784. use Composer\Json\JsonFile;
  3785. use Composer\Factory;
  3786. use Symfony\Component\Console\Input\InputInterface;
  3787. use Symfony\Component\Console\Input\InputOption;
  3788. use Symfony\Component\Console\Input\InputArgument;
  3789. use Symfony\Component\Console\Output\OutputInterface;
  3790. class RemoveCommand extends BaseCommand
  3791. {
  3792. protected function configure()
  3793. {
  3794. $this
  3795. ->setName('remove')
  3796. ->setDescription('Removes a package from the require or require-dev')
  3797. ->setDefinition(array(
  3798. new InputArgument('packages', InputArgument::IS_ARRAY, 'Packages that should be removed.'),
  3799. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  3800. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3801. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  3802. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3803. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  3804. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
  3805. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  3806. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  3807. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  3808. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  3809. ))
  3810. ->setHelp(<<<EOT
  3811. The <info>remove</info> command removes a package from the current
  3812. list of installed packages
  3813. <info>php composer.phar remove</info>
  3814. EOT
  3815. )
  3816. ;
  3817. }
  3818. protected function execute(InputInterface $input, OutputInterface $output)
  3819. {
  3820. $packages = $input->getArgument('packages');
  3821. $file = Factory::getComposerFile();
  3822. $jsonFile = new JsonFile($file);
  3823. $composer = $jsonFile->read();
  3824. $composerBackup = file_get_contents($jsonFile->getPath());
  3825. $json = new JsonConfigSource($jsonFile);
  3826. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  3827. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  3828. $io = $this->getIO();
  3829. if ($input->getOption('update-with-dependencies')) {
  3830. $io->writeError('<warning>You are using the deprecated option "update-with-dependencies". This is now default behaviour. The --no-update-with-dependencies option can be used to remove a package without its dependencies.</warning>');
  3831. }
  3832. foreach ($packages as $package) {
  3833. if (isset($composer[$type][$package])) {
  3834. $json->removeLink($type, $package);
  3835. } elseif (isset($composer[$altType][$package])) {
  3836. $io->writeError('<warning>'.$package.' could not be found in '.$type.' but it is present in '.$altType.'</warning>');
  3837. if ($io->isInteractive()) {
  3838. if ($io->askConfirmation('Do you want to remove it from '.$altType.' [<comment>yes</comment>]? ', true)) {
  3839. $json->removeLink($altType, $package);
  3840. }
  3841. }
  3842. } else {
  3843. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  3844. }
  3845. }
  3846. if ($input->getOption('no-update')) {
  3847. return 0;
  3848. }
  3849. $this->resetComposer();
  3850. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  3851. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  3852. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  3853. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3854. $install = Installer::create($io, $composer);
  3855. $updateDevMode = !$input->getOption('update-no-dev');
  3856. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  3857. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  3858. $install
  3859. ->setVerbose($input->getOption('verbose'))
  3860. ->setDevMode($updateDevMode)
  3861. ->setOptimizeAutoloader($optimize)
  3862. ->setClassMapAuthoritative($authoritative)
  3863. ->setUpdate(true)
  3864. ->setUpdateWhitelist($packages)
  3865. ->setWhitelistDependencies(!$input->getOption('no-update-with-dependencies'))
  3866. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  3867. ->setRunScripts(!$input->getOption('no-scripts'))
  3868. ;
  3869. $exception = null;
  3870. try {
  3871. $status = $install->run();
  3872. } catch (\Exception $exception) {
  3873. $status = 1;
  3874. }
  3875. if ($status !== 0) {
  3876. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  3877. file_put_contents($jsonFile->getPath(), $composerBackup);
  3878. }
  3879. if ($exception) {
  3880. throw $exception;
  3881. }
  3882. return $status;
  3883. }
  3884. }
  3885. <?php
  3886. namespace Composer\Command;
  3887. use Symfony\Component\Console\Input\InputInterface;
  3888. use Symfony\Component\Console\Input\InputArgument;
  3889. use Symfony\Component\Console\Input\InputOption;
  3890. use Symfony\Component\Console\Output\OutputInterface;
  3891. use Composer\Factory;
  3892. use Composer\Installer;
  3893. use Composer\Json\JsonFile;
  3894. use Composer\Json\JsonManipulator;
  3895. use Composer\Package\Version\VersionParser;
  3896. use Composer\Plugin\CommandEvent;
  3897. use Composer\Plugin\PluginEvents;
  3898. use Composer\Repository\CompositeRepository;
  3899. use Composer\Repository\PlatformRepository;
  3900. class RequireCommand extends InitCommand
  3901. {
  3902. protected function configure()
  3903. {
  3904. $this
  3905. ->setName('require')
  3906. ->setDescription('Adds required packages to your composer.json and installs them')
  3907. ->setDefinition(array(
  3908. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Required package name optionally including a version constraint, e.g. foo/bar or foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3909. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  3910. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  3911. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  3912. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3913. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  3914. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3915. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  3916. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies.'),
  3917. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  3918. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  3919. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  3920. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  3921. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  3922. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  3923. ))
  3924. ->setHelp(<<<EOT
  3925. The require command adds required packages to your composer.json and installs them.
  3926. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  3927. If you do not want to install the new dependencies immediately you can call it with --no-update
  3928. EOT
  3929. )
  3930. ;
  3931. }
  3932. protected function execute(InputInterface $input, OutputInterface $output)
  3933. {
  3934. $file = Factory::getComposerFile();
  3935. $io = $this->getIO();
  3936. $newlyCreated = !file_exists($file);
  3937. if (!file_exists($file) && !file_put_contents($file, "{\n}\n")) {
  3938. $io->writeError('<error>'.$file.' could not be created.</error>');
  3939. return 1;
  3940. }
  3941. if (!is_readable($file)) {
  3942. $io->writeError('<error>'.$file.' is not readable.</error>');
  3943. return 1;
  3944. }
  3945. if (!is_writable($file)) {
  3946. $io->writeError('<error>'.$file.' is not writable.</error>');
  3947. return 1;
  3948. }
  3949. if (filesize($file) === 0) {
  3950. file_put_contents($file, "{\n}\n");
  3951. }
  3952. $json = new JsonFile($file);
  3953. $composerDefinition = $json->read();
  3954. $composerBackup = file_get_contents($json->getPath());
  3955. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  3956. $repos = $composer->getRepositoryManager()->getRepositories();
  3957. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  3958. $this->repos = new CompositeRepository(array_merge(
  3959. array(new PlatformRepository(array(), $platformOverrides)),
  3960. $repos
  3961. ));
  3962. $phpVersion = $this->repos->findPackage('php', '*')->getVersion();
  3963. $requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'), $phpVersion);
  3964. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  3965. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  3966. $baseRequirements = array_key_exists($requireKey, $composerDefinition) ? $composerDefinition[$requireKey] : array();
  3967. $requirements = $this->formatRequirements($requirements);
  3968. $versionParser = new VersionParser();
  3969. foreach ($requirements as $constraint) {
  3970. $versionParser->parseConstraints($constraint);
  3971. }
  3972. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  3973. if (!$this->updateFileCleanly($json, $baseRequirements, $requirements, $requireKey, $removeKey, $sortPackages)) {
  3974. foreach ($requirements as $package => $version) {
  3975. $baseRequirements[$package] = $version;
  3976. if (isset($composerDefinition[$removeKey][$package])) {
  3977. unset($composerDefinition[$removeKey][$package]);
  3978. }
  3979. }
  3980. $composerDefinition[$requireKey] = $baseRequirements;
  3981. $json->write($composerDefinition);
  3982. }
  3983. $io->writeError('<info>'.$file.' has been '.($newlyCreated ? 'created' : 'updated').'</info>');
  3984. if ($input->getOption('no-update')) {
  3985. return 0;
  3986. }
  3987. $updateDevMode = !$input->getOption('update-no-dev');
  3988. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  3989. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  3990. $this->resetComposer();
  3991. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  3992. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  3993. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  3994. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3995. $install = Installer::create($io, $composer);
  3996. $install
  3997. ->setVerbose($input->getOption('verbose'))
  3998. ->setPreferSource($input->getOption('prefer-source'))
  3999. ->setPreferDist($input->getOption('prefer-dist'))
  4000. ->setDevMode($updateDevMode)
  4001. ->setRunScripts(!$input->getOption('no-scripts'))
  4002. ->setOptimizeAutoloader($optimize)
  4003. ->setClassMapAuthoritative($authoritative)
  4004. ->setUpdate(true)
  4005. ->setUpdateWhitelist(array_keys($requirements))
  4006. ->setWhitelistDependencies($input->getOption('update-with-dependencies'))
  4007. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4008. ->setPreferStable($input->getOption('prefer-stable'))
  4009. ->setPreferLowest($input->getOption('prefer-lowest'))
  4010. ;
  4011. $exception = null;
  4012. try {
  4013. $status = $install->run();
  4014. } catch (\Exception $exception) {
  4015. $status = 1;
  4016. }
  4017. if ($status !== 0) {
  4018. if ($newlyCreated) {
  4019. $io->writeError("\n".'<error>Installation failed, deleting '.$file.'.</error>');
  4020. unlink($json->getPath());
  4021. } else {
  4022. $io->writeError("\n".'<error>Installation failed, reverting '.$file.' to its original content.</error>');
  4023. file_put_contents($json->getPath(), $composerBackup);
  4024. }
  4025. }
  4026. if ($exception) {
  4027. throw $exception;
  4028. }
  4029. return $status;
  4030. }
  4031. private function updateFileCleanly($json, array $base, array $new, $requireKey, $removeKey, $sortPackages)
  4032. {
  4033. $contents = file_get_contents($json->getPath());
  4034. $manipulator = new JsonManipulator($contents);
  4035. foreach ($new as $package => $constraint) {
  4036. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  4037. return false;
  4038. }
  4039. if (!$manipulator->removeSubNode($removeKey, $package)) {
  4040. return false;
  4041. }
  4042. }
  4043. file_put_contents($json->getPath(), $manipulator->getContents());
  4044. return true;
  4045. }
  4046. protected function interact(InputInterface $input, OutputInterface $output)
  4047. {
  4048. return;
  4049. }
  4050. }
  4051. <?php
  4052. namespace Composer\Command;
  4053. use Composer\Script\CommandEvent;
  4054. use Composer\Script\ScriptEvents;
  4055. use Composer\Util\ProcessExecutor;
  4056. use Symfony\Component\Console\Input\InputInterface;
  4057. use Symfony\Component\Console\Input\InputOption;
  4058. use Symfony\Component\Console\Input\InputArgument;
  4059. use Symfony\Component\Console\Output\OutputInterface;
  4060. class RunScriptCommand extends BaseCommand
  4061. {
  4062. protected $scriptEvents = array(
  4063. ScriptEvents::PRE_INSTALL_CMD,
  4064. ScriptEvents::POST_INSTALL_CMD,
  4065. ScriptEvents::PRE_UPDATE_CMD,
  4066. ScriptEvents::POST_UPDATE_CMD,
  4067. ScriptEvents::PRE_STATUS_CMD,
  4068. ScriptEvents::POST_STATUS_CMD,
  4069. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  4070. ScriptEvents::POST_CREATE_PROJECT_CMD,
  4071. ScriptEvents::PRE_ARCHIVE_CMD,
  4072. ScriptEvents::POST_ARCHIVE_CMD,
  4073. ScriptEvents::PRE_AUTOLOAD_DUMP,
  4074. ScriptEvents::POST_AUTOLOAD_DUMP,
  4075. );
  4076. protected function configure()
  4077. {
  4078. $this
  4079. ->setName('run-script')
  4080. ->setDescription('Run the scripts defined in composer.json.')
  4081. ->setDefinition(array(
  4082. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  4083. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4084. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  4085. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4086. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4087. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  4088. ))
  4089. ->setHelp(<<<EOT
  4090. The <info>run-script</info> command runs scripts defined in composer.json:
  4091. <info>php composer.phar run-script post-update-cmd</info>
  4092. EOT
  4093. )
  4094. ;
  4095. }
  4096. protected function execute(InputInterface $input, OutputInterface $output)
  4097. {
  4098. if ($input->getOption('list')) {
  4099. return $this->listScripts();
  4100. } elseif (!$input->getArgument('script')) {
  4101. throw new \RuntimeException('Missing required argument "script"');
  4102. }
  4103. $script = $input->getArgument('script');
  4104. if (!in_array($script, $this->scriptEvents)) {
  4105. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  4106. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  4107. }
  4108. }
  4109. $composer = $this->getComposer();
  4110. $hasListeners = $composer->getEventDispatcher()->hasEventListeners(new CommandEvent($script, $composer, $this->getIO()));
  4111. if (!$hasListeners) {
  4112. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  4113. }
  4114. $args = $input->getArgument('args');
  4115. if (!is_null($timeout = $input->getOption('timeout'))) {
  4116. if (!ctype_digit($timeout)) {
  4117. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  4118. }
  4119. ProcessExecutor::setTimeout((int) $timeout);
  4120. }
  4121. return $composer->getEventDispatcher()->dispatchScript($script, $input->getOption('dev') || !$input->getOption('no-dev'), $args);
  4122. }
  4123. protected function listScripts()
  4124. {
  4125. $scripts = $this->getComposer()->getPackage()->getScripts();
  4126. if (!count($scripts)) {
  4127. return 0;
  4128. }
  4129. $io = $this->getIO();
  4130. $io->writeError('<info>scripts:</info>');
  4131. foreach ($scripts as $name => $script) {
  4132. $io->write(' ' . $name);
  4133. }
  4134. return 0;
  4135. }
  4136. }
  4137. <?php
  4138. namespace Composer\Command;
  4139. use Symfony\Component\Console\Input\InputInterface;
  4140. use Symfony\Component\Console\Input\InputOption;
  4141. use Symfony\Component\Console\Input\InputArgument;
  4142. use Symfony\Component\Console\Output\OutputInterface;
  4143. class ScriptAliasCommand extends BaseCommand
  4144. {
  4145. private $script;
  4146. public function __construct($script)
  4147. {
  4148. $this->script = $script;
  4149. parent::__construct();
  4150. }
  4151. protected function configure()
  4152. {
  4153. $this
  4154. ->setName($this->script)
  4155. ->setDescription('Run the '.$this->script.' script as defined in composer.json.')
  4156. ->setDefinition(array(
  4157. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4158. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4159. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4160. ))
  4161. ->setHelp(<<<EOT
  4162. The <info>run-script</info> command runs scripts defined in composer.json:
  4163. <info>php composer.phar run-script post-update-cmd</info>
  4164. EOT
  4165. )
  4166. ;
  4167. }
  4168. protected function execute(InputInterface $input, OutputInterface $output)
  4169. {
  4170. $composer = $this->getComposer();
  4171. $args = $input->getArguments();
  4172. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  4173. }
  4174. }
  4175. <?php
  4176. namespace Composer\Command;
  4177. use Composer\Factory;
  4178. use Symfony\Component\Console\Input\InputInterface;
  4179. use Symfony\Component\Console\Input\InputArgument;
  4180. use Symfony\Component\Console\Input\InputOption;
  4181. use Symfony\Component\Console\Output\OutputInterface;
  4182. use Composer\Repository\CompositeRepository;
  4183. use Composer\Repository\PlatformRepository;
  4184. use Composer\Repository\RepositoryInterface;
  4185. use Composer\Plugin\CommandEvent;
  4186. use Composer\Plugin\PluginEvents;
  4187. class SearchCommand extends BaseCommand
  4188. {
  4189. protected $matches;
  4190. protected $lowMatches = array();
  4191. protected $tokens;
  4192. protected $output;
  4193. protected $onlyName;
  4194. protected function configure()
  4195. {
  4196. $this
  4197. ->setName('search')
  4198. ->setDescription('Search for packages')
  4199. ->setDefinition(array(
  4200. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
  4201. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  4202. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  4203. ))
  4204. ->setHelp(<<<EOT
  4205. The search command searches for packages by its name
  4206. <info>php composer.phar search symfony composer</info>
  4207. EOT
  4208. )
  4209. ;
  4210. }
  4211. protected function execute(InputInterface $input, OutputInterface $output)
  4212. {
  4213. $platformRepo = new PlatformRepository;
  4214. $io = $this->getIO();
  4215. if (!($composer = $this->getComposer(false))) {
  4216. $composer = Factory::create($this->getIO(), array());
  4217. }
  4218. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4219. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  4220. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  4221. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  4222. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4223. $onlyName = $input->getOption('only-name');
  4224. $type = $input->getOption('type') ?: null;
  4225. $flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
  4226. $results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags, $type);
  4227. foreach ($results as $result) {
  4228. $io->write($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
  4229. }
  4230. }
  4231. }
  4232. <?php
  4233. namespace Composer\Command;
  4234. use Composer\Composer;
  4235. use Composer\Factory;
  4236. use Composer\Config;
  4237. use Composer\Util\Filesystem;
  4238. use Composer\SelfUpdate\Keys;
  4239. use Composer\SelfUpdate\Versions;
  4240. use Composer\IO\IOInterface;
  4241. use Composer\Downloader\FilesystemException;
  4242. use Symfony\Component\Console\Input\InputInterface;
  4243. use Symfony\Component\Console\Input\InputOption;
  4244. use Symfony\Component\Console\Input\InputArgument;
  4245. use Symfony\Component\Console\Output\OutputInterface;
  4246. use Symfony\Component\Finder\Finder;
  4247. class SelfUpdateCommand extends BaseCommand
  4248. {
  4249. const HOMEPAGE = 'getcomposer.org';
  4250. const OLD_INSTALL_EXT = '-old.phar';
  4251. protected function configure()
  4252. {
  4253. $this
  4254. ->setName('self-update')
  4255. ->setAliases(array('selfupdate'))
  4256. ->setDescription('Updates composer.phar to the latest version.')
  4257. ->setDefinition(array(
  4258. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  4259. new InputOption('clean-backups', null, InputOption::VALUE_NONE, 'Delete old backups during an update. This makes the current version of composer the only backup available after the update'),
  4260. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  4261. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4262. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  4263. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  4264. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  4265. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  4266. ))
  4267. ->setHelp(<<<EOT
  4268. The <info>self-update</info> command checks getcomposer.org for newer
  4269. versions of composer and if found, installs the latest.
  4270. <info>php composer.phar self-update</info>
  4271. EOT
  4272. )
  4273. ;
  4274. }
  4275. protected function execute(InputInterface $input, OutputInterface $output)
  4276. {
  4277. $config = Factory::createConfig();
  4278. if ($config->get('disable-tls') === true) {
  4279. $baseUrl = 'http://' . self::HOMEPAGE;
  4280. } else {
  4281. $baseUrl = 'https://' . self::HOMEPAGE;
  4282. }
  4283. $io = $this->getIO();
  4284. $remoteFilesystem = Factory::createRemoteFilesystem($io, $config);
  4285. $versionsUtil = new Versions($config, $remoteFilesystem);
  4286. foreach (array('stable', 'preview', 'snapshot') as $channel) {
  4287. if ($input->getOption($channel)) {
  4288. $versionsUtil->setChannel($channel);
  4289. }
  4290. }
  4291. $cacheDir = $config->get('cache-dir');
  4292. $rollbackDir = $config->get('data-dir');
  4293. $home = $config->get('home');
  4294. $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
  4295. if ($input->getOption('update-keys')) {
  4296. return $this->fetchKeys($io, $config);
  4297. }
  4298. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  4299. if (!is_writable($tmpDir)) {
  4300. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  4301. }
  4302. if ($input->getOption('rollback')) {
  4303. return $this->rollback($output, $rollbackDir, $localFilename);
  4304. }
  4305. $latest = $versionsUtil->getLatest();
  4306. $latestVersion = $latest['version'];
  4307. $updateVersion = $input->getArgument('version') ?: $latestVersion;
  4308. if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  4309. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  4310. return 1;
  4311. }
  4312. if (Composer::VERSION === $updateVersion) {
  4313. $io->writeError(sprintf('<info>You are already using composer version %s (%s channel).</info>', $updateVersion, $versionsUtil->getChannel()));
  4314. if ($input->getOption('clean-backups')) {
  4315. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  4316. }
  4317. return 0;
  4318. }
  4319. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
  4320. $backupFile = sprintf(
  4321. '%s/%s-%s%s',
  4322. $rollbackDir,
  4323. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  4324. preg_replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  4325. self::OLD_INSTALL_EXT
  4326. );
  4327. $updatingToTag = !preg_match('{^[0-9a-f]{40}$}', $updateVersion);
  4328. $io->write(sprintf("Updating to version <info>%s</info> (%s channel).", $updateVersion, $versionsUtil->getChannel()));
  4329. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  4330. $signature = $remoteFilesystem->getContents(self::HOMEPAGE, $remoteFilename.'.sig', false);
  4331. $remoteFilesystem->copy(self::HOMEPAGE, $remoteFilename, $tempFilename, !$input->getOption('no-progress'));
  4332. if (!file_exists($tempFilename) || !$signature) {
  4333. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  4334. return 1;
  4335. }
  4336. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  4337. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  4338. } else {
  4339. if (!extension_loaded('openssl')) {
  4340. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  4341. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  4342. }
  4343. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  4344. if (!file_exists($sigFile)) {
  4345. file_put_contents($home.'/keys.dev.pub', <<<DEVPUBKEY
  4346. -----BEGIN PUBLIC KEY-----
  4347. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  4348. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  4349. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  4350. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  4351. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  4352. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  4353. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  4354. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  4355. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  4356. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  4357. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  4358. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  4359. -----END PUBLIC KEY-----
  4360. DEVPUBKEY
  4361. );
  4362. file_put_contents($home.'/keys.tags.pub', <<<TAGSPUBKEY
  4363. -----BEGIN PUBLIC KEY-----
  4364. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  4365. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  4366. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  4367. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  4368. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  4369. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  4370. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  4371. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  4372. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  4373. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  4374. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  4375. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  4376. -----END PUBLIC KEY-----
  4377. TAGSPUBKEY
  4378. );
  4379. }
  4380. $pubkeyid = openssl_pkey_get_public($sigFile);
  4381. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  4382. if (!in_array('SHA384', openssl_get_md_methods())) {
  4383. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  4384. }
  4385. $signature = json_decode($signature, true);
  4386. $signature = base64_decode($signature['sha384']);
  4387. $verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
  4388. openssl_free_key($pubkeyid);
  4389. if (!$verified) {
  4390. throw new \RuntimeException('The phar signature did not match the file you downloaded, this means your public keys are outdated or that the phar file is corrupt/has been modified');
  4391. }
  4392. }
  4393. if ($input->getOption('clean-backups')) {
  4394. $this->cleanBackups($rollbackDir);
  4395. }
  4396. if ($err = $this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  4397. @unlink($tempFilename);
  4398. $io->writeError('<error>The file is corrupted ('.$err->getMessage().').</error>');
  4399. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  4400. return 1;
  4401. }
  4402. if (file_exists($backupFile)) {
  4403. $io->writeError('Use <info>composer self-update --rollback</info> to return to version '.Composer::VERSION);
  4404. } else {
  4405. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  4406. }
  4407. }
  4408. protected function fetchKeys(IOInterface $io, Config $config)
  4409. {
  4410. if (!$io->isInteractive()) {
  4411. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  4412. }
  4413. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  4414. $validator = function ($value) {
  4415. if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  4416. throw new \UnexpectedValueException('Invalid input');
  4417. }
  4418. return trim($value)."\n";
  4419. };
  4420. $devKey = '';
  4421. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  4422. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  4423. while ($line = $io->ask('')) {
  4424. $devKey .= trim($line)."\n";
  4425. if (trim($line) === '-----END PUBLIC KEY-----') {
  4426. break;
  4427. }
  4428. }
  4429. }
  4430. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  4431. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  4432. $tagsKey = '';
  4433. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  4434. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  4435. while ($line = $io->ask('')) {
  4436. $tagsKey .= trim($line)."\n";
  4437. if (trim($line) === '-----END PUBLIC KEY-----') {
  4438. break;
  4439. }
  4440. }
  4441. }
  4442. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  4443. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  4444. $io->write('Public keys stored in '.$config->get('home'));
  4445. }
  4446. protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
  4447. {
  4448. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  4449. if (!$rollbackVersion) {
  4450. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  4451. }
  4452. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  4453. if (!is_file($oldFile)) {
  4454. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  4455. }
  4456. if (!is_readable($oldFile)) {
  4457. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  4458. }
  4459. $io = $this->getIO();
  4460. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  4461. if ($err = $this->setLocalPhar($localFilename, $oldFile)) {
  4462. $io->writeError('<error>The backup file was corrupted ('.$err->getMessage().').</error>');
  4463. return 1;
  4464. }
  4465. return 0;
  4466. }
  4467. protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
  4468. {
  4469. try {
  4470. @chmod($newFilename, fileperms($localFilename));
  4471. if (!ini_get('phar.readonly')) {
  4472. $phar = new \Phar($newFilename);
  4473. unset($phar);
  4474. }
  4475. if ($backupTarget && file_exists($localFilename)) {
  4476. @copy($localFilename, $backupTarget);
  4477. }
  4478. rename($newFilename, $localFilename);
  4479. return null;
  4480. } catch (\Exception $e) {
  4481. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  4482. throw $e;
  4483. }
  4484. return $e;
  4485. }
  4486. }
  4487. protected function cleanBackups($rollbackDir, $except = null)
  4488. {
  4489. $finder = $this->getOldInstallationFinder($rollbackDir);
  4490. $io = $this->getIO();
  4491. $fs = new Filesystem;
  4492. foreach ($finder as $file) {
  4493. if ($except && $file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  4494. continue;
  4495. }
  4496. $file = (string) $file;
  4497. $io->writeError('<info>Removing: '.$file.'</info>');
  4498. $fs->remove($file);
  4499. }
  4500. }
  4501. protected function getLastBackupVersion($rollbackDir)
  4502. {
  4503. $finder = $this->getOldInstallationFinder($rollbackDir);
  4504. $finder->sortByName();
  4505. $files = iterator_to_array($finder);
  4506. if (count($files)) {
  4507. return basename(end($files), self::OLD_INSTALL_EXT);
  4508. }
  4509. return false;
  4510. }
  4511. protected function getOldInstallationFinder($rollbackDir)
  4512. {
  4513. $finder = Finder::create()
  4514. ->depth(0)
  4515. ->files()
  4516. ->name('*' . self::OLD_INSTALL_EXT)
  4517. ->in($rollbackDir);
  4518. return $finder;
  4519. }
  4520. }
  4521. <?php
  4522. namespace Composer\Command;
  4523. use Composer\DependencyResolver\Pool;
  4524. use Composer\DependencyResolver\DefaultPolicy;
  4525. use Composer\Package\CompletePackageInterface;
  4526. use Composer\Package\Version\VersionParser;
  4527. use Composer\Package\BasePackage;
  4528. use Composer\Package\Version\VersionSelector;
  4529. use Composer\Plugin\CommandEvent;
  4530. use Composer\Plugin\PluginEvents;
  4531. use Composer\Package\PackageInterface;
  4532. use Composer\Semver\Constraint\ConstraintInterface;
  4533. use Composer\Util\Platform;
  4534. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  4535. use Symfony\Component\Console\Input\InputInterface;
  4536. use Symfony\Component\Console\Input\InputArgument;
  4537. use Symfony\Component\Console\Input\InputOption;
  4538. use Symfony\Component\Console\Output\OutputInterface;
  4539. use Composer\Repository\ArrayRepository;
  4540. use Composer\Repository\CompositeRepository;
  4541. use Composer\Repository\ComposerRepository;
  4542. use Composer\Repository\PlatformRepository;
  4543. use Composer\Repository\RepositoryInterface;
  4544. use Composer\Repository\RepositoryFactory;
  4545. use Composer\Spdx\SpdxLicenses;
  4546. use Composer\Composer;
  4547. use Composer\Semver\Semver;
  4548. class ShowCommand extends BaseCommand
  4549. {
  4550. protected $versionParser;
  4551. protected $colors;
  4552. private $pool;
  4553. protected function configure()
  4554. {
  4555. $this
  4556. ->setName('show')
  4557. ->setAliases(array('info'))
  4558. ->setDescription('Show information about packages')
  4559. ->setDefinition(array(
  4560. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4561. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  4562. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  4563. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  4564. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  4565. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  4566. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  4567. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  4568. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  4569. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  4570. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  4571. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  4572. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4573. ))
  4574. ->setHelp(<<<EOT
  4575. The show command displays detailed information about a package, or
  4576. lists all packages available.
  4577. EOT
  4578. )
  4579. ;
  4580. }
  4581. protected function execute(InputInterface $input, OutputInterface $output)
  4582. {
  4583. $this->versionParser = new VersionParser;
  4584. if ($input->getOption('tree')) {
  4585. $this->initStyles($output);
  4586. }
  4587. $composer = $this->getComposer(false);
  4588. $io = $this->getIO();
  4589. if ($input->getOption('installed')) {
  4590. $io->writeError('<warning>You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.</warning>');
  4591. }
  4592. if ($input->getOption('outdated')) {
  4593. $input->setOption('latest', true);
  4594. }
  4595. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  4596. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  4597. return 1;
  4598. }
  4599. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  4600. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  4601. return 1;
  4602. }
  4603. $platformOverrides = array();
  4604. if ($composer) {
  4605. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4606. }
  4607. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  4608. $phpVersion = $platformRepo->findPackage('php', '*')->getVersion();
  4609. if ($input->getOption('self')) {
  4610. $package = $this->getComposer()->getPackage();
  4611. $repos = $installedRepo = new ArrayRepository(array($package));
  4612. } elseif ($input->getOption('platform')) {
  4613. $repos = $installedRepo = $platformRepo;
  4614. } elseif ($input->getOption('available')) {
  4615. $installedRepo = $platformRepo;
  4616. if ($composer) {
  4617. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  4618. } else {
  4619. $defaultRepos = RepositoryFactory::defaultRepos($io);
  4620. $repos = new CompositeRepository($defaultRepos);
  4621. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  4622. }
  4623. } elseif ($input->getOption('all') && $composer) {
  4624. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4625. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  4626. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  4627. } elseif ($input->getOption('all')) {
  4628. $defaultRepos = RepositoryFactory::defaultRepos($io);
  4629. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  4630. $installedRepo = $platformRepo;
  4631. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  4632. } else {
  4633. $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  4634. }
  4635. if ($composer) {
  4636. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  4637. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4638. }
  4639. if ($input->getOption('latest') && null === $composer) {
  4640. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  4641. $input->setOption('latest', false);
  4642. }
  4643. $packageFilter = $input->getArgument('package');
  4644. if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) {
  4645. if (empty($package)) {
  4646. list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
  4647. if (!$package) {
  4648. throw new \InvalidArgumentException('Package '.$input->getArgument('package').' not found');
  4649. }
  4650. } else {
  4651. $versions = array($package->getPrettyVersion() => $package->getVersion());
  4652. }
  4653. if ($input->getOption('tree')) {
  4654. $this->displayPackageTree($package, $installedRepo, $repos);
  4655. } else {
  4656. $latestPackage = null;
  4657. if ($input->getOption('latest')) {
  4658. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion);
  4659. }
  4660. $this->printMeta($package, $versions, $installedRepo, $latestPackage);
  4661. $this->printLinks($package, 'requires');
  4662. $this->printLinks($package, 'devRequires', 'requires (dev)');
  4663. if ($package->getSuggests()) {
  4664. $io->write("\n<info>suggests</info>");
  4665. foreach ($package->getSuggests() as $suggested => $reason) {
  4666. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  4667. }
  4668. }
  4669. $this->printLinks($package, 'provides');
  4670. $this->printLinks($package, 'conflicts');
  4671. $this->printLinks($package, 'replaces');
  4672. }
  4673. return;
  4674. }
  4675. if ($input->getOption('tree')) {
  4676. $rootRequires = $this->getRootRequires();
  4677. foreach ($installedRepo->getPackages() as $package) {
  4678. if (in_array($package->getName(), $rootRequires, true)) {
  4679. $this->displayPackageTree($package, $installedRepo, $repos);
  4680. }
  4681. }
  4682. return 0;
  4683. }
  4684. if ($repos instanceof CompositeRepository) {
  4685. $repos = $repos->getRepositories();
  4686. } elseif (!is_array($repos)) {
  4687. $repos = array($repos);
  4688. }
  4689. $packages = array();
  4690. if (null !== $packageFilter) {
  4691. $packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  4692. }
  4693. $packageListFilter = array();
  4694. if ($input->getOption('direct')) {
  4695. $packageListFilter = $this->getRootRequires();
  4696. }
  4697. foreach ($repos as $repo) {
  4698. if ($repo === $platformRepo) {
  4699. $type = '<info>platform</info>:';
  4700. } elseif (
  4701. $repo === $installedRepo
  4702. || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
  4703. ) {
  4704. $type = '<info>installed</info>:';
  4705. } else {
  4706. $type = '<comment>available</comment>:';
  4707. }
  4708. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  4709. foreach ($repo->getProviderNames() as $name) {
  4710. if (!$packageFilter || preg_match($packageFilter, $name)) {
  4711. $packages[$type][$name] = $name;
  4712. }
  4713. }
  4714. } else {
  4715. foreach ($repo->getPackages() as $package) {
  4716. if (!isset($packages[$type][$package->getName()])
  4717. || !is_object($packages[$type][$package->getName()])
  4718. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  4719. ) {
  4720. if (!$packageFilter || preg_match($packageFilter, $package->getName())) {
  4721. if (!$packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  4722. $packages[$type][$package->getName()] = $package;
  4723. }
  4724. }
  4725. }
  4726. }
  4727. }
  4728. }
  4729. $showAllTypes = $input->getOption('all');
  4730. $showLatest = $input->getOption('latest');
  4731. $indent = $showAllTypes ? ' ' : '';
  4732. $latestPackages = array();
  4733. foreach (array('<info>platform</info>:' => true, '<comment>available</comment>:' => false, '<info>installed</info>:' => true) as $type => $showVersion) {
  4734. if (isset($packages[$type])) {
  4735. if ($showAllTypes) {
  4736. $io->write($type);
  4737. }
  4738. ksort($packages[$type]);
  4739. $nameLength = $versionLength = $latestLength = 0;
  4740. foreach ($packages[$type] as $package) {
  4741. if (is_object($package)) {
  4742. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  4743. if ($showVersion) {
  4744. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  4745. if ($showLatest) {
  4746. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion);
  4747. if ($latestPackage === false) {
  4748. continue;
  4749. }
  4750. $latestPackages[$package->getPrettyName()] = $latestPackage;
  4751. $latestLength = max($latestLength, strlen($latestPackage->getFullPrettyVersion()));
  4752. }
  4753. }
  4754. } else {
  4755. $nameLength = max($nameLength, $package);
  4756. }
  4757. }
  4758. list($width) = $this->getApplication()->getTerminalDimensions();
  4759. if (null === $width) {
  4760. $width = PHP_INT_MAX;
  4761. }
  4762. if (Platform::isWindows()) {
  4763. $width--;
  4764. }
  4765. if ($input->getOption('path') && null === $composer) {
  4766. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  4767. $input->setOption('path', false);
  4768. }
  4769. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  4770. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion && ($nameLength + $versionLength + 3 <= $width);
  4771. $writeLatest = $writeVersion && $showLatest && ($nameLength + $versionLength + $latestLength + 3 <= $width);
  4772. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path') && ($nameLength + $versionLength + $latestLength + 24 <= $width);
  4773. foreach ($packages[$type] as $package) {
  4774. if (is_object($package)) {
  4775. $latestPackackage = null;
  4776. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  4777. $latestPackackage = $latestPackages[$package->getPrettyName()];
  4778. }
  4779. if ($input->getOption('outdated') && $latestPackackage && $latestPackackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && !$latestPackackage->isAbandoned()) {
  4780. continue;
  4781. }
  4782. $io->write($indent . str_pad($package->getPrettyName(), $nameLength, ' '), false);
  4783. if ($writeVersion) {
  4784. $io->write(' ' . str_pad($package->getFullPrettyVersion(), $versionLength, ' '), false);
  4785. }
  4786. if ($writeLatest && $latestPackackage) {
  4787. $latestVersion = $latestPackackage->getFullPrettyVersion();
  4788. $style = $this->getVersionStyle($latestPackackage, $package);
  4789. $io->write(' <'.$style.'>' . str_pad($latestVersion, $latestLength, ' ') . '</'.$style.'>', false);
  4790. }
  4791. if ($writeDescription) {
  4792. $description = strtok($package->getDescription(), "\r\n");
  4793. $remaining = $width - $nameLength - $versionLength - 4;
  4794. if ($writeLatest) {
  4795. $remaining -= $latestLength;
  4796. }
  4797. if (strlen($description) > $remaining) {
  4798. $description = substr($description, 0, $remaining - 3) . '...';
  4799. }
  4800. $io->write(' ' . $description, false);
  4801. }
  4802. if ($writePath) {
  4803. $path = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  4804. $io->write(' ' . $path, false);
  4805. }
  4806. if ($latestPackackage && $latestPackackage->isAbandoned()) {
  4807. $replacement = (is_string($latestPackackage->getReplacementPackage()))
  4808. ? 'Use ' . $latestPackackage->getReplacementPackage() . ' instead'
  4809. : 'No replacement was suggested';
  4810. $io->writeError('');
  4811. $io->writeError(
  4812. sprintf(
  4813. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  4814. $package->getPrettyName(),
  4815. $replacement
  4816. ),
  4817. false
  4818. );
  4819. }
  4820. } else {
  4821. $io->write($indent . $package, false);
  4822. }
  4823. $io->write('');
  4824. }
  4825. if ($showAllTypes) {
  4826. $io->write('');
  4827. }
  4828. }
  4829. }
  4830. }
  4831. protected function getRootRequires()
  4832. {
  4833. $rootPackage = $this->getComposer()->getPackage();
  4834. return array_map(
  4835. 'strtolower',
  4836. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  4837. );
  4838. }
  4839. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  4840. {
  4841. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  4842. return 'info';
  4843. }
  4844. $constraint = $package->getVersion();
  4845. if (0 !== strpos($constraint, 'dev-')) {
  4846. $constraint = '^'.$constraint;
  4847. }
  4848. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  4849. return 'highlight';
  4850. }
  4851. return 'comment';
  4852. }
  4853. protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
  4854. {
  4855. $name = strtolower($name);
  4856. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  4857. $policy = new DefaultPolicy();
  4858. $pool = new Pool('dev');
  4859. $pool->addRepository($repos);
  4860. $matchedPackage = null;
  4861. $versions = array();
  4862. $matches = $pool->whatProvides($name, $constraint);
  4863. foreach ($matches as $index => $package) {
  4864. if ($package->getName() !== $name) {
  4865. unset($matches[$index]);
  4866. continue;
  4867. }
  4868. if (null === $version && $installedRepo->hasPackage($package)) {
  4869. $matchedPackage = $package;
  4870. }
  4871. $versions[$package->getPrettyVersion()] = $package->getVersion();
  4872. $matches[$index] = $package->getId();
  4873. }
  4874. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) {
  4875. $matchedPackage = $pool->literalToPackage($preferred[0]);
  4876. }
  4877. return array($matchedPackage, $versions);
  4878. }
  4879. protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  4880. {
  4881. $io = $this->getIO();
  4882. $io->write('<info>name</info> : ' . $package->getPrettyName());
  4883. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  4884. $io->write('<info>keywords</info> : ' . join(', ', $package->getKeywords() ?: array()));
  4885. $this->printVersions($package, $versions, $installedRepo);
  4886. if ($latestPackage) {
  4887. $style = $this->getVersionStyle($latestPackage, $package);
  4888. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
  4889. } else {
  4890. $latestPackage = $package;
  4891. }
  4892. $io->write('<info>type</info> : ' . $package->getType());
  4893. $this->printLicenses($package);
  4894. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  4895. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  4896. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  4897. if ($latestPackage->isAbandoned()) {
  4898. $replacement = ($latestPackage->getReplacementPackage() !== null)
  4899. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  4900. : null;
  4901. $io->writeError(
  4902. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  4903. );
  4904. }
  4905. if ($package->getSupport()) {
  4906. $io->write("\n<info>support</info>");
  4907. foreach ($package->getSupport() as $type => $value) {
  4908. $io->write('<comment>' . $type . '</comment> : '.$value);
  4909. }
  4910. }
  4911. if ($package->getAutoload()) {
  4912. $io->write("\n<info>autoload</info>");
  4913. foreach ($package->getAutoload() as $type => $autoloads) {
  4914. $io->write('<comment>' . $type . '</comment>');
  4915. if ($type === 'psr-0') {
  4916. foreach ($autoloads as $name => $path) {
  4917. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  4918. }
  4919. } elseif ($type === 'psr-4') {
  4920. foreach ($autoloads as $name => $path) {
  4921. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  4922. }
  4923. } elseif ($type === 'classmap') {
  4924. $io->write(implode(', ', $autoloads));
  4925. }
  4926. }
  4927. if ($package->getIncludePaths()) {
  4928. $io->write('<comment>include-path</comment>');
  4929. $io->write(implode(', ', $package->getIncludePaths()));
  4930. }
  4931. }
  4932. }
  4933. protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  4934. {
  4935. uasort($versions, 'version_compare');
  4936. $versions = array_keys(array_reverse($versions));
  4937. if ($installedRepo->hasPackage($package)) {
  4938. $installedVersion = $package->getPrettyVersion();
  4939. $key = array_search($installedVersion, $versions);
  4940. if (false !== $key) {
  4941. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  4942. }
  4943. }
  4944. $versions = implode(', ', $versions);
  4945. $this->getIO()->write('<info>versions</info> : ' . $versions);
  4946. }
  4947. protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
  4948. {
  4949. $title = $title ?: $linkType;
  4950. $io = $this->getIO();
  4951. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  4952. $io->write("\n<info>" . $title . "</info>");
  4953. foreach ($links as $link) {
  4954. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  4955. }
  4956. }
  4957. }
  4958. protected function printLicenses(CompletePackageInterface $package)
  4959. {
  4960. $spdxLicenses = new SpdxLicenses();
  4961. $licenses = $package->getLicense();
  4962. $io = $this->getIO();
  4963. foreach ($licenses as $licenseId) {
  4964. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  4965. if (!$license) {
  4966. $out = $licenseId;
  4967. } else {
  4968. if ($license[1] === true) {
  4969. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  4970. } else {
  4971. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  4972. }
  4973. }
  4974. $io->write('<info>license</info> : ' . $out);
  4975. }
  4976. }
  4977. protected function initStyles(OutputInterface $output)
  4978. {
  4979. $this->colors = array(
  4980. 'green',
  4981. 'yellow',
  4982. 'cyan',
  4983. 'magenta',
  4984. 'blue',
  4985. );
  4986. foreach ($this->colors as $color) {
  4987. $style = new OutputFormatterStyle($color);
  4988. $output->getFormatter()->setStyle($color, $style);
  4989. }
  4990. }
  4991. protected function displayPackageTree(PackageInterface $package, RepositoryInterface $installedRepo, RepositoryInterface $distantRepos)
  4992. {
  4993. $io = $this->getIO();
  4994. $io->write(sprintf('<info>%s</info>', $package->getPrettyName()), false);
  4995. $io->write(' ' . $package->getPrettyVersion(), false);
  4996. $io->write(' ' . strtok($package->getDescription(), "\r\n"));
  4997. if (is_object($package)) {
  4998. $requires = $package->getRequires();
  4999. $treeBar = '├';
  5000. $j = 0;
  5001. $total = count($requires);
  5002. foreach ($requires as $requireName => $require) {
  5003. $j++;
  5004. if ($j == 0) {
  5005. $this->writeTreeLine($treeBar);
  5006. }
  5007. if ($j == $total) {
  5008. $treeBar = 'â””';
  5009. }
  5010. $level = 1;
  5011. $color = $this->colors[$level];
  5012. $info = sprintf('%s──<%s>%s</%s> %s', $treeBar, $color, $requireName, $color, $require->getPrettyConstraint());
  5013. $this->writeTreeLine($info);
  5014. $treeBar = str_replace('â””', ' ', $treeBar);
  5015. $packagesInTree = array($package->getName(), $requireName);
  5016. $this->displayTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree, $treeBar, $level + 1);
  5017. }
  5018. }
  5019. }
  5020. protected function displayTree($name, $package, RepositoryInterface $installedRepo, RepositoryInterface $distantRepos, array $packagesInTree, $previousTreeBar = '├', $level = 1)
  5021. {
  5022. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  5023. list($package, $versions) = $this->getPackage($installedRepo, $distantRepos, $name, $package->getPrettyConstraint() === 'self.version' ? $package->getConstraint() : $package->getPrettyConstraint());
  5024. if (is_object($package)) {
  5025. $requires = $package->getRequires();
  5026. $treeBar = $previousTreeBar . ' ├';
  5027. $i = 0;
  5028. $total = count($requires);
  5029. foreach ($requires as $requireName => $require) {
  5030. $currentTree = $packagesInTree;
  5031. $i++;
  5032. if ($i == $total) {
  5033. $treeBar = $previousTreeBar . ' â””';
  5034. }
  5035. $colorIdent = $level % count($this->colors);
  5036. $color = $this->colors[$colorIdent];
  5037. $circularWarn = in_array($requireName, $currentTree) ? '(circular dependency aborted here)' : '';
  5038. $info = rtrim(sprintf('%s──<%s>%s</%s> %s %s', $treeBar, $color, $requireName, $color, $require->getPrettyConstraint(), $circularWarn));
  5039. $this->writeTreeLine($info);
  5040. $treeBar = str_replace('â””', ' ', $treeBar);
  5041. if (!in_array($requireName, $currentTree)) {
  5042. $currentTree[] = $requireName;
  5043. $this->displayTree($requireName, $require, $installedRepo, $distantRepos, $currentTree, $treeBar, $level + 1);
  5044. }
  5045. }
  5046. }
  5047. }
  5048. private function writeTreeLine($line)
  5049. {
  5050. $io = $this->getIO();
  5051. if (!$io->isDecorated()) {
  5052. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  5053. }
  5054. $io->write($line);
  5055. }
  5056. private function findLatestPackage(PackageInterface $package, Composer $composer, $phpVersion)
  5057. {
  5058. $name = $package->getName();
  5059. $versionSelector = new VersionSelector($this->getPool($composer));
  5060. $stability = $composer->getPackage()->getMinimumStability();
  5061. $flags = $composer->getPackage()->getStabilityFlags();
  5062. if (isset($flags[$name])) {
  5063. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  5064. }
  5065. $bestStability = $stability;
  5066. if ($composer->getPackage()->getPreferStable()) {
  5067. $bestStability = $package->getStability();
  5068. }
  5069. $targetVersion = null;
  5070. if (0 === strpos($package->getVersion(), 'dev-')) {
  5071. $targetVersion = $package->getVersion();
  5072. }
  5073. return $versionSelector->findBestCandidate($name, $targetVersion, $phpVersion, $bestStability);
  5074. }
  5075. private function getPool(Composer $composer)
  5076. {
  5077. if (!$this->pool) {
  5078. $this->pool = new Pool($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  5079. $this->pool->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  5080. }
  5081. return $this->pool;
  5082. }
  5083. }
  5084. <?php
  5085. namespace Composer\Command;
  5086. use Symfony\Component\Console\Input\InputInterface;
  5087. use Symfony\Component\Console\Input\InputOption;
  5088. use Symfony\Component\Console\Output\OutputInterface;
  5089. use Composer\Downloader\ChangeReportInterface;
  5090. use Composer\Downloader\DvcsDownloaderInterface;
  5091. use Composer\Downloader\VcsCapableDownloaderInterface;
  5092. use Composer\Package\Dumper\ArrayDumper;
  5093. use Composer\Package\Version\VersionGuesser;
  5094. use Composer\Package\Version\VersionParser;
  5095. use Composer\Plugin\CommandEvent;
  5096. use Composer\Plugin\PluginEvents;
  5097. use Composer\Script\ScriptEvents;
  5098. use Composer\Util\ProcessExecutor;
  5099. class StatusCommand extends BaseCommand
  5100. {
  5101. const EXIT_CODE_ERRORS = 1;
  5102. const EXIT_CODE_UNPUSHED_CHANGES = 2;
  5103. const EXIT_CODE_VERSION_CHANGES = 4;
  5104. protected function configure()
  5105. {
  5106. $this
  5107. ->setName('status')
  5108. ->setDescription('Show a list of locally modified packages')
  5109. ->setDefinition(array(
  5110. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  5111. ))
  5112. ->setHelp(<<<EOT
  5113. The status command displays a list of dependencies that have
  5114. been modified locally.
  5115. EOT
  5116. )
  5117. ;
  5118. }
  5119. protected function execute(InputInterface $input, OutputInterface $output)
  5120. {
  5121. $composer = $this->getComposer();
  5122. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  5123. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5124. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  5125. $dm = $composer->getDownloadManager();
  5126. $im = $composer->getInstallationManager();
  5127. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  5128. $errors = array();
  5129. $io = $this->getIO();
  5130. $unpushedChanges = array();
  5131. $vcsVersionChanges = array();
  5132. $parser = new VersionParser;
  5133. $guesser = new VersionGuesser($composer->getConfig(), new ProcessExecutor($io), $parser);
  5134. $dumper = new ArrayDumper;
  5135. foreach ($installedRepo->getCanonicalPackages() as $package) {
  5136. $downloader = $dm->getDownloaderForInstalledPackage($package);
  5137. $targetDir = $im->getInstallPath($package);
  5138. if ($downloader instanceof ChangeReportInterface) {
  5139. if (is_link($targetDir)) {
  5140. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  5141. }
  5142. if ($changes = $downloader->getLocalChanges($package, $targetDir, true)) {
  5143. $errors[$targetDir] = $changes;
  5144. }
  5145. }
  5146. if ($downloader instanceof VcsCapableDownloaderInterface) {
  5147. if ($currentRef = $downloader->getVcsReference($package, $targetDir)) {
  5148. switch ($package->getInstallationSource()) {
  5149. case 'source':
  5150. $previousRef = $package->getSourceReference();
  5151. break;
  5152. case 'dist':
  5153. $previousRef = $package->getDistReference();
  5154. break;
  5155. default:
  5156. $previousRef = null;
  5157. }
  5158. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  5159. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
  5160. $vcsVersionChanges[$targetDir] = array(
  5161. 'previous' => array(
  5162. 'version' => $package->getPrettyVersion(),
  5163. 'ref' => $previousRef
  5164. ),
  5165. 'current' => array(
  5166. 'version' => $currentVersion['pretty_version'],
  5167. 'ref' => $currentVersion['commit'],
  5168. ),
  5169. );
  5170. }
  5171. }
  5172. }
  5173. if ($downloader instanceof DvcsDownloaderInterface) {
  5174. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  5175. $unpushedChanges[$targetDir] = $unpushed;
  5176. }
  5177. }
  5178. }
  5179. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  5180. $io->writeError('<info>No local changes</info>');
  5181. return 0;
  5182. }
  5183. if ($errors) {
  5184. $io->writeError('<error>You have changes in the following dependencies:</error>');
  5185. foreach ($errors as $path => $changes) {
  5186. if ($input->getOption('verbose')) {
  5187. $indentedChanges = implode("\n", array_map(function ($line) {
  5188. return ' ' . ltrim($line);
  5189. }, explode("\n", $changes)));
  5190. $io->write('<info>'.$path.'</info>:');
  5191. $io->write($indentedChanges);
  5192. } else {
  5193. $io->write($path);
  5194. }
  5195. }
  5196. }
  5197. if ($unpushedChanges) {
  5198. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  5199. foreach ($unpushedChanges as $path => $changes) {
  5200. if ($input->getOption('verbose')) {
  5201. $indentedChanges = implode("\n", array_map(function ($line) {
  5202. return ' ' . ltrim($line);
  5203. }, explode("\n", $changes)));
  5204. $io->write('<info>'.$path.'</info>:');
  5205. $io->write($indentedChanges);
  5206. } else {
  5207. $io->write($path);
  5208. }
  5209. }
  5210. }
  5211. if ($vcsVersionChanges) {
  5212. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  5213. foreach ($vcsVersionChanges as $path => $changes) {
  5214. if ($input->getOption('verbose')) {
  5215. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  5216. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  5217. if ($io->isVeryVerbose()) {
  5218. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  5219. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  5220. }
  5221. $io->write('<info>'.$path.'</info>:');
  5222. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  5223. } else {
  5224. $io->write($path);
  5225. }
  5226. }
  5227. }
  5228. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  5229. $io->writeError('Use --verbose (-v) to see a list of files');
  5230. }
  5231. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  5232. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  5233. }
  5234. }
  5235. <?php
  5236. namespace Composer\Command;
  5237. use Composer\Repository\PlatformRepository;
  5238. use Symfony\Component\Console\Input\InputArgument;
  5239. use Symfony\Component\Console\Input\InputInterface;
  5240. use Symfony\Component\Console\Input\InputOption;
  5241. use Symfony\Component\Console\Output\OutputInterface;
  5242. class SuggestsCommand extends BaseCommand
  5243. {
  5244. protected function configure()
  5245. {
  5246. $this
  5247. ->setName('suggests')
  5248. ->setDescription('Show package suggestions')
  5249. ->setDefinition(array(
  5250. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package'),
  5251. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  5252. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  5253. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  5254. ))
  5255. ->setHelp(<<<EOT
  5256. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  5257. Enabling <info>-v</info> implies <info>--by-package --by-suggestion</info>, showing both lists.
  5258. EOT
  5259. )
  5260. ;
  5261. }
  5262. protected function execute(InputInterface $input, OutputInterface $output)
  5263. {
  5264. $lock = $this->getComposer()->getLocker()->getLockData();
  5265. if (empty($lock)) {
  5266. throw new \RuntimeException('Lockfile seems to be empty?');
  5267. }
  5268. $packages = $lock['packages'];
  5269. if (!$input->getOption('no-dev')) {
  5270. $packages += $lock['packages-dev'];
  5271. }
  5272. $filter = $input->getArgument('packages');
  5273. $installed = array();
  5274. foreach ($packages as $package) {
  5275. $installed[] = $package['name'];
  5276. if (!empty($package['provide'])) {
  5277. $installed = array_merge($installed, array_keys($package['provide']));
  5278. }
  5279. if (!empty($package['replace'])) {
  5280. $installed = array_merge($installed, array_keys($package['replace']));
  5281. }
  5282. }
  5283. $installed = array_flip($installed);
  5284. ksort($installed);
  5285. $platform = new PlatformRepository(array(), $this->getComposer()->getConfig()->get('platform') ?: array());
  5286. $suggesters = array();
  5287. $suggested = array();
  5288. foreach ($packages as $package) {
  5289. $packageName = $package['name'];
  5290. if ((!empty($filter) && !in_array($packageName, $filter)) || empty($package['suggest'])) {
  5291. continue;
  5292. }
  5293. foreach ($package['suggest'] as $suggestion => $reason) {
  5294. if (false === strpos('/', $suggestion) && !is_null($platform->findPackage($suggestion, '*'))) {
  5295. continue;
  5296. }
  5297. if (!isset($installed[$suggestion])) {
  5298. $suggesters[$packageName][$suggestion] = $reason;
  5299. $suggested[$suggestion][$packageName] = $reason;
  5300. }
  5301. }
  5302. }
  5303. ksort($suggesters);
  5304. ksort($suggested);
  5305. $mode = 0;
  5306. $io = $this->getIO();
  5307. if ($input->getOption('by-package') || $io->isVerbose()) {
  5308. $mode |= 1;
  5309. }
  5310. if ($input->getOption('by-suggestion')) {
  5311. $mode |= 2;
  5312. }
  5313. if ($mode === 0) {
  5314. foreach (array_keys($suggested) as $suggestion) {
  5315. $io->write(sprintf('<info>%s</info>', $suggestion));
  5316. }
  5317. return;
  5318. }
  5319. if ($mode & 1) {
  5320. foreach ($suggesters as $suggester => $suggestions) {
  5321. $io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  5322. foreach ($suggestions as $suggestion => $reason) {
  5323. $io->write(sprintf(' - <info>%s</info>: %s', $suggestion, $reason ?: '*'));
  5324. }
  5325. $io->write('');
  5326. }
  5327. }
  5328. if ($mode & 2) {
  5329. if ($mode & 1) {
  5330. $io->write(str_repeat('-', 78));
  5331. }
  5332. foreach ($suggested as $suggestion => $suggesters) {
  5333. $io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  5334. foreach ($suggesters as $suggester => $reason) {
  5335. $io->write(sprintf(' - <info>%s</info>: %s', $suggester, $reason ?: '*'));
  5336. }
  5337. $io->write('');
  5338. }
  5339. }
  5340. }
  5341. }
  5342. <?php
  5343. namespace Composer\Command;
  5344. use Composer\Composer;
  5345. use Composer\Installer;
  5346. use Composer\IO\IOInterface;
  5347. use Composer\Plugin\CommandEvent;
  5348. use Composer\Plugin\PluginEvents;
  5349. use Symfony\Component\Console\Helper\Table;
  5350. use Symfony\Component\Console\Input\InputInterface;
  5351. use Symfony\Component\Console\Input\InputOption;
  5352. use Symfony\Component\Console\Input\InputArgument;
  5353. use Symfony\Component\Console\Output\OutputInterface;
  5354. use Symfony\Component\Console\Question\Question;
  5355. class UpdateCommand extends BaseCommand
  5356. {
  5357. protected function configure()
  5358. {
  5359. $this
  5360. ->setName('update')
  5361. ->setDescription('Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  5362. ->setDefinition(array(
  5363. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  5364. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  5365. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  5366. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  5367. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  5368. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  5369. new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
  5370. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  5371. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  5372. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  5373. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  5374. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  5375. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also all dependencies of whitelisted packages to the whitelist.'),
  5376. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  5377. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  5378. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  5379. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  5380. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  5381. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  5382. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  5383. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  5384. ))
  5385. ->setHelp(<<<EOT
  5386. The <info>update</info> command reads the composer.json file from the
  5387. current directory, processes it, and updates, removes or installs all the
  5388. dependencies.
  5389. <info>php composer.phar update</info>
  5390. To limit the update operation to a few packages, you can list the package(s)
  5391. you want to update as such:
  5392. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  5393. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  5394. from a specific vendor:
  5395. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  5396. To select packages names interactively with auto-completion use <info>-i</info>.
  5397. EOT
  5398. )
  5399. ;
  5400. }
  5401. protected function execute(InputInterface $input, OutputInterface $output)
  5402. {
  5403. $io = $this->getIO();
  5404. if ($input->getOption('no-custom-installers')) {
  5405. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  5406. $input->setOption('no-plugins', true);
  5407. }
  5408. if ($input->getOption('dev')) {
  5409. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  5410. }
  5411. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  5412. $packages = $input->getArgument('packages');
  5413. if ($input->getOption('interactive')) {
  5414. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  5415. }
  5416. if ($input->getOption('root-reqs')) {
  5417. $require = array_keys($composer->getPackage()->getRequires());
  5418. if (!$input->getOption('no-dev')) {
  5419. $requireDev = array_keys($composer->getPackage()->getDevRequires());
  5420. $require = array_merge($require, $requireDev);
  5421. }
  5422. if (!empty($packages)) {
  5423. $packages = array_intersect($packages, $require);
  5424. } else {
  5425. $packages = $require;
  5426. }
  5427. }
  5428. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  5429. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  5430. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5431. $install = Installer::create($io, $composer);
  5432. $preferSource = false;
  5433. $preferDist = false;
  5434. $config = $composer->getConfig();
  5435. switch ($config->get('preferred-install')) {
  5436. case 'source':
  5437. $preferSource = true;
  5438. break;
  5439. case 'dist':
  5440. $preferDist = true;
  5441. break;
  5442. case 'auto':
  5443. default:
  5444. break;
  5445. }
  5446. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist')) {
  5447. $preferSource = $input->getOption('prefer-source');
  5448. $preferDist = $input->getOption('prefer-dist');
  5449. }
  5450. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  5451. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  5452. $install
  5453. ->setDryRun($input->getOption('dry-run'))
  5454. ->setVerbose($input->getOption('verbose'))
  5455. ->setPreferSource($preferSource)
  5456. ->setPreferDist($preferDist)
  5457. ->setDevMode(!$input->getOption('no-dev'))
  5458. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  5459. ->setRunScripts(!$input->getOption('no-scripts'))
  5460. ->setSkipSuggest($input->getOption('no-suggest'))
  5461. ->setOptimizeAutoloader($optimize)
  5462. ->setClassMapAuthoritative($authoritative)
  5463. ->setUpdate(true)
  5464. ->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $packages)
  5465. ->setWhitelistDependencies($input->getOption('with-dependencies'))
  5466. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  5467. ->setPreferStable($input->getOption('prefer-stable'))
  5468. ->setPreferLowest($input->getOption('prefer-lowest'))
  5469. ;
  5470. if ($input->getOption('no-plugins')) {
  5471. $install->disablePlugins();
  5472. }
  5473. return $install->run();
  5474. }
  5475. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
  5476. {
  5477. if (!$input->isInteractive()) {
  5478. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  5479. }
  5480. $requires = array_merge(
  5481. $composer->getPackage()->getRequires(),
  5482. $composer->getPackage()->getDevRequires()
  5483. );
  5484. $autocompleterValues = array();
  5485. foreach ($requires as $require) {
  5486. $autocompleterValues[strtolower($require->getTarget())] = $require->getTarget();
  5487. }
  5488. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  5489. foreach ($installedPackages as $package) {
  5490. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  5491. }
  5492. $helper = $this->getHelper('question');
  5493. $question = new Question('<comment>Enter package name: </comment>', null);
  5494. $io->writeError('<info>Press enter without value to end submission</info>');
  5495. do {
  5496. $autocompleterValues = array_diff($autocompleterValues, $packages);
  5497. $question->setAutocompleterValues($autocompleterValues);
  5498. $addedPackage = $helper->ask($input, $output, $question);
  5499. if (!is_string($addedPackage) || empty($addedPackage)) {
  5500. break;
  5501. }
  5502. $addedPackage = strtolower($addedPackage);
  5503. if (!in_array($addedPackage, $packages)) {
  5504. $packages[] = $addedPackage;
  5505. }
  5506. } while (true);
  5507. $packages = array_filter($packages);
  5508. if (!$packages) {
  5509. throw new \InvalidArgumentException('You must enter minimum one package.');
  5510. }
  5511. $table = new Table($output);
  5512. $table->setHeaders(array('Selected packages'));
  5513. foreach ($packages as $package) {
  5514. $table->addRow(array($package));
  5515. }
  5516. $table->render();
  5517. if ($io->askConfirmation(sprintf(
  5518. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  5519. 1 === count($packages) ? '' : 's'
  5520. ), true)) {
  5521. return $packages;
  5522. }
  5523. throw new \RuntimeException('Installation aborted.');
  5524. }
  5525. }
  5526. <?php
  5527. namespace Composer\Command;
  5528. use Composer\Factory;
  5529. use Composer\Package\Loader\ValidatingArrayLoader;
  5530. use Composer\Plugin\CommandEvent;
  5531. use Composer\Plugin\PluginEvents;
  5532. use Composer\Util\ConfigValidator;
  5533. use Symfony\Component\Console\Input\InputArgument;
  5534. use Symfony\Component\Console\Input\InputInterface;
  5535. use Symfony\Component\Console\Input\InputOption;
  5536. use Symfony\Component\Console\Output\OutputInterface;
  5537. class ValidateCommand extends BaseCommand
  5538. {
  5539. protected function configure()
  5540. {
  5541. $this
  5542. ->setName('validate')
  5543. ->setDescription('Validates a composer.json and composer.lock')
  5544. ->setDefinition(array(
  5545. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not make a complete validation'),
  5546. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  5547. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  5548. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  5549. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  5550. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file', './composer.json'),
  5551. ))
  5552. ->setHelp(<<<EOT
  5553. The validate command validates a given composer.json and composer.lock
  5554. Exit codes in case of errors are:
  5555. 1 validation warning(s), only when --strict is given
  5556. 2 validation error(s)
  5557. 3 file unreadable or missing
  5558. EOT
  5559. );
  5560. }
  5561. protected function execute(InputInterface $input, OutputInterface $output)
  5562. {
  5563. $file = $input->getArgument('file');
  5564. $io = $this->getIO();
  5565. if (!file_exists($file)) {
  5566. $io->writeError('<error>' . $file . ' not found.</error>');
  5567. return 3;
  5568. }
  5569. if (!is_readable($file)) {
  5570. $io->writeError('<error>' . $file . ' is not readable.</error>');
  5571. return 3;
  5572. }
  5573. $validator = new ConfigValidator($io);
  5574. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  5575. $checkPublish = !$input->getOption('no-check-publish');
  5576. $checkLock = !$input->getOption('no-check-lock');
  5577. $isStrict = $input->getOption('strict');
  5578. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  5579. $lockErrors = array();
  5580. $composer = Factory::create($io, $file);
  5581. $locker = $composer->getLocker();
  5582. if ($locker->isLocked() && !$locker->isFresh()) {
  5583. $lockErrors[] = 'The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update`.';
  5584. }
  5585. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true);
  5586. $exitCode = $errors || ($publishErrors && $checkPublish) || ($lockErrors && $checkLock) ? 2 : ($isStrict && $warnings ? 1 : 0);
  5587. if ($input->getOption('with-dependencies')) {
  5588. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5589. foreach ($localRepo->getPackages() as $package) {
  5590. $path = $composer->getInstallationManager()->getInstallPath($package);
  5591. $file = $path . '/composer.json';
  5592. if (is_dir($path) && file_exists($file)) {
  5593. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  5594. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  5595. $depCode = $errors || ($publishErrors && $checkPublish) ? 2 : ($isStrict && $warnings ? 1 : 0);
  5596. $exitCode = max($depCode, $exitCode);
  5597. }
  5598. }
  5599. }
  5600. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  5601. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5602. $exitCode = max($eventCode, $exitCode);
  5603. return $exitCode;
  5604. }
  5605. private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false)
  5606. {
  5607. if (!$errors && !$publishErrors && !$warnings) {
  5608. $io->write('<info>' . $name . ' is valid</info>');
  5609. } elseif (!$errors && !$publishErrors) {
  5610. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  5611. if ($printSchemaUrl) {
  5612. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  5613. }
  5614. } elseif (!$errors) {
  5615. $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
  5616. $io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
  5617. if ($printSchemaUrl) {
  5618. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  5619. }
  5620. } else {
  5621. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  5622. }
  5623. if ($checkPublish) {
  5624. $errors = array_merge($errors, $publishErrors);
  5625. } else {
  5626. $warnings = array_merge($warnings, $publishErrors);
  5627. }
  5628. if ($checkLock) {
  5629. $errors = array_merge($errors, $lockErrors);
  5630. } else {
  5631. $warnings = array_merge($warnings, $lockErrors);
  5632. }
  5633. $messages = array(
  5634. 'error' => $errors,
  5635. 'warning' => $warnings,
  5636. );
  5637. foreach ($messages as $style => $msgs) {
  5638. foreach ($msgs as $msg) {
  5639. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  5640. }
  5641. }
  5642. }
  5643. }
  5644. <?php
  5645. namespace Composer;
  5646. use Composer\Package\RootPackageInterface;
  5647. use Composer\Package\Locker;
  5648. use Composer\Repository\RepositoryManager;
  5649. use Composer\Installer\InstallationManager;
  5650. use Composer\Plugin\PluginManager;
  5651. use Composer\Downloader\DownloadManager;
  5652. use Composer\EventDispatcher\EventDispatcher;
  5653. use Composer\Autoload\AutoloadGenerator;
  5654. class Composer
  5655. {
  5656. const VERSION = '1.2.1';
  5657. const BRANCH_ALIAS_VERSION = '';
  5658. const RELEASE_DATE = '2016-09-12 11:27:19';
  5659. private $package;
  5660. private $locker;
  5661. private $repositoryManager;
  5662. private $downloadManager;
  5663. private $installationManager;
  5664. private $pluginManager;
  5665. private $config;
  5666. private $eventDispatcher;
  5667. private $autoloadGenerator;
  5668. public function setPackage(RootPackageInterface $package)
  5669. {
  5670. $this->package = $package;
  5671. }
  5672. public function getPackage()
  5673. {
  5674. return $this->package;
  5675. }
  5676. public function setConfig(Config $config)
  5677. {
  5678. $this->config = $config;
  5679. }
  5680. public function getConfig()
  5681. {
  5682. return $this->config;
  5683. }
  5684. public function setLocker(Locker $locker)
  5685. {
  5686. $this->locker = $locker;
  5687. }
  5688. public function getLocker()
  5689. {
  5690. return $this->locker;
  5691. }
  5692. public function setRepositoryManager(RepositoryManager $manager)
  5693. {
  5694. $this->repositoryManager = $manager;
  5695. }
  5696. public function getRepositoryManager()
  5697. {
  5698. return $this->repositoryManager;
  5699. }
  5700. public function setDownloadManager(DownloadManager $manager)
  5701. {
  5702. $this->downloadManager = $manager;
  5703. }
  5704. public function getDownloadManager()
  5705. {
  5706. return $this->downloadManager;
  5707. }
  5708. public function setInstallationManager(InstallationManager $manager)
  5709. {
  5710. $this->installationManager = $manager;
  5711. }
  5712. public function getInstallationManager()
  5713. {
  5714. return $this->installationManager;
  5715. }
  5716. public function setPluginManager(PluginManager $manager)
  5717. {
  5718. $this->pluginManager = $manager;
  5719. }
  5720. public function getPluginManager()
  5721. {
  5722. return $this->pluginManager;
  5723. }
  5724. public function setEventDispatcher(EventDispatcher $eventDispatcher)
  5725. {
  5726. $this->eventDispatcher = $eventDispatcher;
  5727. }
  5728. public function getEventDispatcher()
  5729. {
  5730. return $this->eventDispatcher;
  5731. }
  5732. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
  5733. {
  5734. $this->autoloadGenerator = $autoloadGenerator;
  5735. }
  5736. public function getAutoloadGenerator()
  5737. {
  5738. return $this->autoloadGenerator;
  5739. }
  5740. }
  5741. <?php
  5742. namespace Composer;
  5743. use Composer\Config\ConfigSourceInterface;
  5744. use Composer\Downloader\TransportException;
  5745. use Composer\IO\IOInterface;
  5746. use Composer\Util\Platform;
  5747. class Config
  5748. {
  5749. const RELATIVE_PATHS = 1;
  5750. public static $defaultConfig = array(
  5751. 'process-timeout' => 300,
  5752. 'use-include-path' => false,
  5753. 'preferred-install' => 'auto',
  5754. 'notify-on-install' => true,
  5755. 'github-protocols' => array('https', 'ssh', 'git'),
  5756. 'vendor-dir' => 'vendor',
  5757. 'bin-dir' => '{$vendor-dir}/bin',
  5758. 'cache-dir' => '{$home}/cache',
  5759. 'data-dir' => '{$home}',
  5760. 'cache-files-dir' => '{$cache-dir}/files',
  5761. 'cache-repo-dir' => '{$cache-dir}/repo',
  5762. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  5763. 'cache-ttl' => 15552000,
  5764. 'cache-files-ttl' => null,
  5765. 'cache-files-maxsize' => '300MiB',
  5766. 'bin-compat' => 'auto',
  5767. 'discard-changes' => false,
  5768. 'autoloader-suffix' => null,
  5769. 'sort-packages' => false,
  5770. 'optimize-autoloader' => false,
  5771. 'classmap-authoritative' => false,
  5772. 'prepend-autoloader' => true,
  5773. 'github-domains' => array('github.com'),
  5774. 'bitbucket-expose-hostname' => true,
  5775. 'disable-tls' => false,
  5776. 'secure-http' => true,
  5777. 'cafile' => null,
  5778. 'capath' => null,
  5779. 'github-expose-hostname' => true,
  5780. 'gitlab-domains' => array('gitlab.com'),
  5781. 'store-auths' => 'prompt',
  5782. 'platform' => array(),
  5783. 'archive-format' => 'tar',
  5784. 'archive-dir' => '.',
  5785. );
  5786. public static $defaultRepositories = array(
  5787. 'packagist' => array(
  5788. 'type' => 'composer',
  5789. 'url' => 'https?://packagist.org',
  5790. 'allow_ssl_downgrade' => true,
  5791. ),
  5792. );
  5793. private $config;
  5794. private $baseDir;
  5795. private $repositories;
  5796. private $configSource;
  5797. private $authConfigSource;
  5798. private $useEnvironment;
  5799. private $warnedHosts = array();
  5800. public function __construct($useEnvironment = true, $baseDir = null)
  5801. {
  5802. $this->config = static::$defaultConfig;
  5803. $this->repositories = static::$defaultRepositories;
  5804. $this->useEnvironment = (bool) $useEnvironment;
  5805. $this->baseDir = $baseDir;
  5806. }
  5807. public function setConfigSource(ConfigSourceInterface $source)
  5808. {
  5809. $this->configSource = $source;
  5810. }
  5811. public function getConfigSource()
  5812. {
  5813. return $this->configSource;
  5814. }
  5815. public function setAuthConfigSource(ConfigSourceInterface $source)
  5816. {
  5817. $this->authConfigSource = $source;
  5818. }
  5819. public function getAuthConfigSource()
  5820. {
  5821. return $this->authConfigSource;
  5822. }
  5823. public function merge($config)
  5824. {
  5825. if (!empty($config['config']) && is_array($config['config'])) {
  5826. foreach ($config['config'] as $key => $val) {
  5827. if (in_array($key, array('bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'http-basic')) && isset($this->config[$key])) {
  5828. $this->config[$key] = array_merge($this->config[$key], $val);
  5829. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  5830. if (is_array($val) || is_array($this->config[$key])) {
  5831. if (is_string($val)) {
  5832. $val = array('*' => $val);
  5833. }
  5834. if (is_string($this->config[$key])) {
  5835. $this->config[$key] = array('*' => $this->config[$key]);
  5836. }
  5837. $this->config[$key] = array_merge($this->config[$key], $val);
  5838. if (isset($this->config[$key]['*'])) {
  5839. $wildcard = $this->config[$key]['*'];
  5840. unset($this->config[$key]['*']);
  5841. $this->config[$key]['*'] = $wildcard;
  5842. }
  5843. } else {
  5844. $this->config[$key] = $val;
  5845. }
  5846. } else {
  5847. $this->config[$key] = $val;
  5848. }
  5849. }
  5850. }
  5851. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  5852. $this->repositories = array_reverse($this->repositories, true);
  5853. $newRepos = array_reverse($config['repositories'], true);
  5854. foreach ($newRepos as $name => $repository) {
  5855. if (false === $repository) {
  5856. unset($this->repositories[$name]);
  5857. continue;
  5858. }
  5859. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  5860. unset($this->repositories[key($repository)]);
  5861. continue;
  5862. }
  5863. if (is_int($name)) {
  5864. $this->repositories[] = $repository;
  5865. } else {
  5866. $this->repositories[$name] = $repository;
  5867. }
  5868. }
  5869. $this->repositories = array_reverse($this->repositories, true);
  5870. }
  5871. }
  5872. public function getRepositories()
  5873. {
  5874. return $this->repositories;
  5875. }
  5876. public function get($key, $flags = 0)
  5877. {
  5878. switch ($key) {
  5879. case 'vendor-dir':
  5880. case 'bin-dir':
  5881. case 'process-timeout':
  5882. case 'data-dir':
  5883. case 'cache-dir':
  5884. case 'cache-files-dir':
  5885. case 'cache-repo-dir':
  5886. case 'cache-vcs-dir':
  5887. case 'cafile':
  5888. case 'capath':
  5889. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  5890. $val = rtrim($this->process($this->getComposerEnv($env) ?: $this->config[$key], $flags), '/\\');
  5891. $val = Platform::expandPath($val);
  5892. if (substr($key, -4) !== '-dir') {
  5893. return $val;
  5894. }
  5895. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  5896. case 'cache-ttl':
  5897. return (int) $this->config[$key];
  5898. case 'cache-files-maxsize':
  5899. if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
  5900. throw new \RuntimeException(
  5901. "Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
  5902. );
  5903. }
  5904. $size = $matches[1];
  5905. if (isset($matches[2])) {
  5906. switch (strtolower($matches[2])) {
  5907. case 'g':
  5908. $size *= 1024;
  5909. case 'm':
  5910. $size *= 1024;
  5911. case 'k':
  5912. $size *= 1024;
  5913. break;
  5914. }
  5915. }
  5916. return $size;
  5917. case 'cache-files-ttl':
  5918. if (isset($this->config[$key])) {
  5919. return (int) $this->config[$key];
  5920. }
  5921. return (int) $this->config['cache-ttl'];
  5922. case 'home':
  5923. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $this->config[$key]);
  5924. return rtrim($this->process($val, $flags), '/\\');
  5925. case 'bin-compat':
  5926. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  5927. if (!in_array($value, array('auto', 'full'))) {
  5928. throw new \RuntimeException(
  5929. "Invalid value for 'bin-compat': {$value}. Expected auto, full"
  5930. );
  5931. }
  5932. return $value;
  5933. case 'discard-changes':
  5934. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  5935. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  5936. throw new \RuntimeException(
  5937. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  5938. );
  5939. }
  5940. if ('stash' === $env) {
  5941. return 'stash';
  5942. }
  5943. return $env !== 'false' && (bool) $env;
  5944. }
  5945. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  5946. throw new \RuntimeException(
  5947. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  5948. );
  5949. }
  5950. return $this->config[$key];
  5951. case 'github-protocols':
  5952. $protos = $this->config['github-protocols'];
  5953. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  5954. unset($protos[$index]);
  5955. }
  5956. if (reset($protos) === 'http') {
  5957. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  5958. }
  5959. return $protos;
  5960. case 'disable-tls':
  5961. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  5962. case 'secure-http':
  5963. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  5964. default:
  5965. if (!isset($this->config[$key])) {
  5966. return null;
  5967. }
  5968. return $this->process($this->config[$key], $flags);
  5969. }
  5970. }
  5971. public function all($flags = 0)
  5972. {
  5973. $all = array(
  5974. 'repositories' => $this->getRepositories(),
  5975. );
  5976. foreach (array_keys($this->config) as $key) {
  5977. $all['config'][$key] = $this->get($key, $flags);
  5978. }
  5979. return $all;
  5980. }
  5981. public function raw()
  5982. {
  5983. return array(
  5984. 'repositories' => $this->getRepositories(),
  5985. 'config' => $this->config,
  5986. );
  5987. }
  5988. public function has($key)
  5989. {
  5990. return array_key_exists($key, $this->config);
  5991. }
  5992. private function process($value, $flags)
  5993. {
  5994. $config = $this;
  5995. if (!is_string($value)) {
  5996. return $value;
  5997. }
  5998. return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config, $flags) {
  5999. return $config->get($match[1], $flags);
  6000. }, $value);
  6001. }
  6002. private function realpath($path)
  6003. {
  6004. if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
  6005. return $path;
  6006. }
  6007. return $this->baseDir . '/' . $path;
  6008. }
  6009. private function getComposerEnv($var)
  6010. {
  6011. if ($this->useEnvironment) {
  6012. return getenv($var);
  6013. }
  6014. return false;
  6015. }
  6016. public function prohibitUrlByConfig($url, IOInterface $io = null)
  6017. {
  6018. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  6019. return;
  6020. }
  6021. $scheme = parse_url($url, PHP_URL_SCHEME);
  6022. if (in_array($scheme, array('http', 'git', 'ftp', 'svn'))) {
  6023. if ($this->get('secure-http')) {
  6024. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  6025. } elseif ($io) {
  6026. $host = parse_url($url, PHP_URL_HOST);
  6027. if (!isset($this->warnedHosts[$host])) {
  6028. $io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
  6029. }
  6030. $this->warnedHosts[$host] = true;
  6031. }
  6032. }
  6033. }
  6034. }
  6035. <?php
  6036. namespace Composer\Config;
  6037. interface ConfigSourceInterface
  6038. {
  6039. public function addRepository($name, $config);
  6040. public function removeRepository($name);
  6041. public function addConfigSetting($name, $value);
  6042. public function removeConfigSetting($name);
  6043. public function addProperty($name, $value);
  6044. public function removeProperty($name);
  6045. public function addLink($type, $name, $value);
  6046. public function removeLink($type, $name);
  6047. public function getName();
  6048. }
  6049. <?php
  6050. namespace Composer\Config;
  6051. use Composer\Json\JsonFile;
  6052. use Composer\Json\JsonManipulator;
  6053. use Composer\Util\Silencer;
  6054. class JsonConfigSource implements ConfigSourceInterface
  6055. {
  6056. private $file;
  6057. private $authConfig;
  6058. public function __construct(JsonFile $file, $authConfig = false)
  6059. {
  6060. $this->file = $file;
  6061. $this->authConfig = $authConfig;
  6062. }
  6063. public function getName()
  6064. {
  6065. return $this->file->getPath();
  6066. }
  6067. public function addRepository($name, $config)
  6068. {
  6069. $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
  6070. $config['repositories'][$repo] = $repoConfig;
  6071. });
  6072. }
  6073. public function removeRepository($name)
  6074. {
  6075. $this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
  6076. unset($config['repositories'][$repo]);
  6077. });
  6078. }
  6079. public function addConfigSetting($name, $value)
  6080. {
  6081. $authConfig = $this->authConfig;
  6082. $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) {
  6083. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|http-basic|platform)\.}', $key)) {
  6084. list($key, $host) = explode('.', $key, 2);
  6085. if ($authConfig) {
  6086. $config[$key][$host] = $val;
  6087. } else {
  6088. $config['config'][$key][$host] = $val;
  6089. }
  6090. } else {
  6091. $config['config'][$key] = $val;
  6092. }
  6093. });
  6094. }
  6095. public function removeConfigSetting($name)
  6096. {
  6097. $authConfig = $this->authConfig;
  6098. $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) {
  6099. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|http-basic|platform)\.}', $key)) {
  6100. list($key, $host) = explode('.', $key, 2);
  6101. if ($authConfig) {
  6102. unset($config[$key][$host]);
  6103. } else {
  6104. unset($config['config'][$key][$host]);
  6105. }
  6106. } else {
  6107. unset($config['config'][$key]);
  6108. }
  6109. });
  6110. }
  6111. public function addProperty($name, $value)
  6112. {
  6113. $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
  6114. if (substr($key, 0, 6) === 'extra.') {
  6115. $bits = explode('.', $key);
  6116. $last = array_pop($bits);
  6117. $arr =& $config['extra'];
  6118. foreach ($bits as $bit) {
  6119. if (!isset($arr[$bit])) {
  6120. $arr[$bit] = array();
  6121. }
  6122. $arr =& $arr[$bit];
  6123. }
  6124. $arr[$last] = $val;
  6125. } else {
  6126. $config[$key] = $val;
  6127. }
  6128. });
  6129. }
  6130. public function removeProperty($name)
  6131. {
  6132. $authConfig = $this->authConfig;
  6133. $this->manipulateJson('removeProperty', $name, function (&$config, $key) {
  6134. if (substr($key, 0, 6) === 'extra.') {
  6135. $bits = explode('.', $key);
  6136. $last = array_pop($bits);
  6137. $arr =& $config['extra'];
  6138. foreach ($bits as $bit) {
  6139. if (!isset($arr[$bit])) {
  6140. return;
  6141. }
  6142. $arr =& $arr[$bit];
  6143. }
  6144. unset($arr[$last]);
  6145. } else {
  6146. unset($config[$key]);
  6147. }
  6148. });
  6149. }
  6150. public function addLink($type, $name, $value)
  6151. {
  6152. $this->manipulateJson('addLink', $type, $name, $value, function (&$config, $type, $name, $value) {
  6153. $config[$type][$name] = $value;
  6154. });
  6155. }
  6156. public function removeLink($type, $name)
  6157. {
  6158. $this->manipulateJson('removeSubNode', $type, $name, function (&$config, $type, $name) {
  6159. unset($config[$type][$name]);
  6160. });
  6161. }
  6162. protected function manipulateJson($method, $args, $fallback)
  6163. {
  6164. $args = func_get_args();
  6165. array_shift($args);
  6166. $fallback = array_pop($args);
  6167. if ($this->file->exists()) {
  6168. if (!is_writable($this->file->getPath())) {
  6169. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  6170. }
  6171. if (!is_readable($this->file->getPath())) {
  6172. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  6173. }
  6174. $contents = file_get_contents($this->file->getPath());
  6175. } elseif ($this->authConfig) {
  6176. $contents = "{\n}\n";
  6177. } else {
  6178. $contents = "{\n \"config\": {\n }\n}\n";
  6179. }
  6180. $manipulator = new JsonManipulator($contents);
  6181. $newFile = !$this->file->exists();
  6182. if ($this->authConfig && $method === 'addConfigSetting') {
  6183. $method = 'addSubNode';
  6184. list($mainNode, $name) = explode('.', $args[0], 2);
  6185. $args = array($mainNode, $name, $args[1]);
  6186. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  6187. $method = 'removeSubNode';
  6188. list($mainNode, $name) = explode('.', $args[0], 2);
  6189. $args = array($mainNode, $name);
  6190. }
  6191. if (call_user_func_array(array($manipulator, $method), $args)) {
  6192. file_put_contents($this->file->getPath(), $manipulator->getContents());
  6193. } else {
  6194. $config = $this->file->read();
  6195. $this->arrayUnshiftRef($args, $config);
  6196. call_user_func_array($fallback, $args);
  6197. $this->file->write($config);
  6198. }
  6199. if ($newFile) {
  6200. Silencer::call('chmod', $this->file->getPath(), 0600);
  6201. }
  6202. }
  6203. private function arrayUnshiftRef(&$array, &$value)
  6204. {
  6205. $return = array_unshift($array, '');
  6206. $array[0] = &$value;
  6207. return $return;
  6208. }
  6209. }
  6210. <?php
  6211. namespace Composer\Console;
  6212. use Composer\Util\Platform;
  6213. use Composer\Util\Silencer;
  6214. use Symfony\Component\Console\Application as BaseApplication;
  6215. use Symfony\Component\Console\Input\InputInterface;
  6216. use Symfony\Component\Console\Input\InputOption;
  6217. use Symfony\Component\Console\Output\OutputInterface;
  6218. use Symfony\Component\Console\Output\ConsoleOutput;
  6219. use Symfony\Component\Console\Formatter\OutputFormatter;
  6220. use Composer\Command;
  6221. use Composer\Composer;
  6222. use Composer\Factory;
  6223. use Composer\IO\IOInterface;
  6224. use Composer\IO\ConsoleIO;
  6225. use Composer\Json\JsonValidationException;
  6226. use Composer\Util\ErrorHandler;
  6227. use Composer\EventDispatcher\ScriptExecutionException;
  6228. use Composer\Exception\NoSslException;
  6229. class Application extends BaseApplication
  6230. {
  6231. protected $composer;
  6232. protected $io;
  6233. private static $logo = ' ______
  6234. / ____/___ ____ ___ ____ ____ ________ _____
  6235. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  6236. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  6237. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  6238. /_/
  6239. ';
  6240. private $hasPluginCommands = false;
  6241. private $disablePluginsByDefault = false;
  6242. public function __construct()
  6243. {
  6244. static $shutdownRegistered = false;
  6245. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  6246. ini_set('xdebug.show_exception_trace', false);
  6247. ini_set('xdebug.scream', false);
  6248. }
  6249. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  6250. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  6251. }
  6252. if (!$shutdownRegistered) {
  6253. $shutdownRegistered = true;
  6254. register_shutdown_function(function () {
  6255. $lastError = error_get_last();
  6256. if ($lastError && $lastError['message'] &&
  6257. (strpos($lastError['message'], 'Allowed memory') !== false ||
  6258. strpos($lastError['message'], 'exceeded memory') !== false )) {
  6259. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  6260. }
  6261. });
  6262. }
  6263. parent::__construct('Composer', Composer::VERSION);
  6264. }
  6265. public function run(InputInterface $input = null, OutputInterface $output = null)
  6266. {
  6267. if (null === $output) {
  6268. $styles = Factory::createAdditionalStyles();
  6269. $formatter = new OutputFormatter(null, $styles);
  6270. $output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  6271. }
  6272. return parent::run($input, $output);
  6273. }
  6274. public function doRun(InputInterface $input, OutputInterface $output)
  6275. {
  6276. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  6277. $io = $this->io = new ConsoleIO($input, $output, $this->getHelperSet());
  6278. ErrorHandler::register($io);
  6279. if ($newWorkDir = $this->getNewWorkingDir($input)) {
  6280. $oldWorkingDir = getcwd();
  6281. chdir($newWorkDir);
  6282. $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
  6283. }
  6284. $commandName = '';
  6285. if ($name = $this->getCommandName($input)) {
  6286. try {
  6287. $commandName = $this->find($name)->getName();
  6288. } catch (\InvalidArgumentException $e) {
  6289. }
  6290. }
  6291. if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
  6292. try {
  6293. foreach ($this->getPluginCommands() as $command) {
  6294. if ($this->has($command->getName())) {
  6295. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  6296. } else {
  6297. $this->add($command);
  6298. }
  6299. }
  6300. } catch (NoSslException $e) {
  6301. }
  6302. $this->hasPluginCommands = true;
  6303. }
  6304. $isProxyCommand = false;
  6305. if ($name = $this->getCommandName($input)) {
  6306. try {
  6307. $command = $this->find($name);
  6308. $commandName = $command->getName();
  6309. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  6310. } catch (\InvalidArgumentException $e) {
  6311. }
  6312. }
  6313. if (!$isProxyCommand) {
  6314. $io->writeError(sprintf(
  6315. 'Running %s (%s) with %s on %s',
  6316. Composer::VERSION,
  6317. Composer::RELEASE_DATE,
  6318. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  6319. php_uname('s') . ' / ' . php_uname('r')
  6320. ), true, IOInterface::DEBUG);
  6321. if (PHP_VERSION_ID < 50302) {
  6322. $io->writeError('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.', upgrading is strongly recommended.</warning>');
  6323. }
  6324. if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  6325. $io->writeError('<warning>You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
  6326. }
  6327. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  6328. $io->writeError(sprintf('<warning>Warning: This development build of composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']));
  6329. }
  6330. if (getenv('COMPOSER_NO_INTERACTION')) {
  6331. $input->setInteractive(false);
  6332. }
  6333. if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER')) {
  6334. if (function_exists('posix_getuid') && posix_getuid() === 0) {
  6335. if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
  6336. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  6337. }
  6338. if ($uid = (int) getenv('SUDO_UID')) {
  6339. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  6340. }
  6341. }
  6342. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  6343. }
  6344. Silencer::call(function () use ($io) {
  6345. $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
  6346. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  6347. $io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir()));
  6348. }
  6349. });
  6350. $file = Factory::getComposerFile();
  6351. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  6352. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  6353. foreach ($composer['scripts'] as $script => $dummy) {
  6354. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  6355. if ($this->has($script)) {
  6356. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  6357. } else {
  6358. $this->add(new Command\ScriptAliasCommand($script));
  6359. }
  6360. }
  6361. }
  6362. }
  6363. }
  6364. }
  6365. try {
  6366. if ($input->hasParameterOption('--profile')) {
  6367. $startTime = microtime(true);
  6368. $this->io->enableDebugging($startTime);
  6369. }
  6370. $result = parent::doRun($input, $output);
  6371. if (isset($oldWorkingDir)) {
  6372. chdir($oldWorkingDir);
  6373. }
  6374. if (isset($startTime)) {
  6375. $io->writeError('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MB), time: '.round(microtime(true) - $startTime, 2).'s');
  6376. }
  6377. restore_error_handler();
  6378. return $result;
  6379. } catch (ScriptExecutionException $e) {
  6380. return $e->getCode();
  6381. } catch (\Exception $e) {
  6382. $this->hintCommonErrors($e);
  6383. restore_error_handler();
  6384. throw $e;
  6385. }
  6386. }
  6387. private function getNewWorkingDir(InputInterface $input)
  6388. {
  6389. $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
  6390. if (false !== $workingDir && !is_dir($workingDir)) {
  6391. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  6392. }
  6393. return $workingDir;
  6394. }
  6395. private function hintCommonErrors($exception)
  6396. {
  6397. $io = $this->getIO();
  6398. Silencer::suppress();
  6399. try {
  6400. $composer = $this->getComposer(false, true);
  6401. if ($composer) {
  6402. $config = $composer->getConfig();
  6403. $minSpaceFree = 1024 * 1024;
  6404. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  6405. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  6406. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  6407. ) {
  6408. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  6409. }
  6410. }
  6411. } catch (\Exception $e) {
  6412. }
  6413. Silencer::restore();
  6414. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  6415. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  6416. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows- for details</error>', true, IOInterface::QUIET);
  6417. }
  6418. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  6419. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  6420. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  6421. }
  6422. }
  6423. public function getComposer($required = true, $disablePlugins = null)
  6424. {
  6425. if (null === $disablePlugins) {
  6426. $disablePlugins = $this->disablePluginsByDefault;
  6427. }
  6428. if (null === $this->composer) {
  6429. try {
  6430. $this->composer = Factory::create($this->io, null, $disablePlugins);
  6431. } catch (\InvalidArgumentException $e) {
  6432. if ($required) {
  6433. $this->io->writeError($e->getMessage());
  6434. exit(1);
  6435. }
  6436. } catch (JsonValidationException $e) {
  6437. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  6438. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  6439. throw new JsonValidationException($message);
  6440. }
  6441. }
  6442. return $this->composer;
  6443. }
  6444. public function resetComposer()
  6445. {
  6446. $this->composer = null;
  6447. }
  6448. public function getIO()
  6449. {
  6450. return $this->io;
  6451. }
  6452. public function getHelp()
  6453. {
  6454. return self::$logo . parent::getHelp();
  6455. }
  6456. protected function getDefaultCommands()
  6457. {
  6458. $commands = array_merge(parent::getDefaultCommands(), array(
  6459. new Command\AboutCommand(),
  6460. new Command\ConfigCommand(),
  6461. new Command\DependsCommand(),
  6462. new Command\ProhibitsCommand(),
  6463. new Command\InitCommand(),
  6464. new Command\InstallCommand(),
  6465. new Command\CreateProjectCommand(),
  6466. new Command\UpdateCommand(),
  6467. new Command\SearchCommand(),
  6468. new Command\ValidateCommand(),
  6469. new Command\ShowCommand(),
  6470. new Command\SuggestsCommand(),
  6471. new Command\RequireCommand(),
  6472. new Command\DumpAutoloadCommand(),
  6473. new Command\StatusCommand(),
  6474. new Command\ArchiveCommand(),
  6475. new Command\DiagnoseCommand(),
  6476. new Command\RunScriptCommand(),
  6477. new Command\LicensesCommand(),
  6478. new Command\GlobalCommand(),
  6479. new Command\ClearCacheCommand(),
  6480. new Command\RemoveCommand(),
  6481. new Command\HomeCommand(),
  6482. new Command\ExecCommand(),
  6483. new Command\OutdatedCommand(),
  6484. ));
  6485. if ('phar:' === substr(__FILE__, 0, 5)) {
  6486. $commands[] = new Command\SelfUpdateCommand();
  6487. }
  6488. return $commands;
  6489. }
  6490. public function getLongVersion()
  6491. {
  6492. if (Composer::BRANCH_ALIAS_VERSION) {
  6493. return sprintf(
  6494. '<info>%s</info> version <comment>%s (%s)</comment> %s',
  6495. $this->getName(),
  6496. Composer::BRANCH_ALIAS_VERSION,
  6497. $this->getVersion(),
  6498. Composer::RELEASE_DATE
  6499. );
  6500. }
  6501. return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
  6502. }
  6503. protected function getDefaultInputDefinition()
  6504. {
  6505. $definition = parent::getDefaultInputDefinition();
  6506. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  6507. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  6508. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  6509. return $definition;
  6510. }
  6511. private function getPluginCommands()
  6512. {
  6513. $commands = array();
  6514. $composer = $this->getComposer(false, false);
  6515. if (null === $composer) {
  6516. $composer = Factory::createGlobal($this->io, false);
  6517. }
  6518. if (null !== $composer) {
  6519. $pm = $composer->getPluginManager();
  6520. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', array('composer' => $composer, 'io' => $this->io)) as $capability) {
  6521. $newCommands = $capability->getCommands();
  6522. if (!is_array($newCommands)) {
  6523. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  6524. }
  6525. foreach ($newCommands as $command) {
  6526. if (!$command instanceof Command\BaseCommand) {
  6527. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  6528. }
  6529. }
  6530. $commands = array_merge($commands, $newCommands);
  6531. }
  6532. }
  6533. return $commands;
  6534. }
  6535. }
  6536. <?php
  6537. namespace Composer\Console;
  6538. use Symfony\Component\Console\Formatter\OutputFormatter;
  6539. class HtmlOutputFormatter extends OutputFormatter
  6540. {
  6541. private static $availableForegroundColors = array(
  6542. 30 => 'black',
  6543. 31 => 'red',
  6544. 32 => 'green',
  6545. 33 => 'yellow',
  6546. 34 => 'blue',
  6547. 35 => 'magenta',
  6548. 36 => 'cyan',
  6549. 37 => 'white',
  6550. );
  6551. private static $availableBackgroundColors = array(
  6552. 40 => 'black',
  6553. 41 => 'red',
  6554. 42 => 'green',
  6555. 43 => 'yellow',
  6556. 44 => 'blue',
  6557. 45 => 'magenta',
  6558. 46 => 'cyan',
  6559. 47 => 'white',
  6560. );
  6561. private static $availableOptions = array(
  6562. 1 => 'bold',
  6563. 4 => 'underscore',
  6564. );
  6565. public function __construct(array $styles = array())
  6566. {
  6567. parent::__construct(true, $styles);
  6568. }
  6569. public function format($message)
  6570. {
  6571. $formatted = parent::format($message);
  6572. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  6573. return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
  6574. }
  6575. private function formatHtml($matches)
  6576. {
  6577. $out = '<span style="';
  6578. foreach (explode(';', $matches[1]) as $code) {
  6579. if (isset(self::$availableForegroundColors[$code])) {
  6580. $out .= 'color:'.self::$availableForegroundColors[$code].';';
  6581. } elseif (isset(self::$availableBackgroundColors[$code])) {
  6582. $out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
  6583. } elseif (isset(self::$availableOptions[$code])) {
  6584. switch (self::$availableOptions[$code]) {
  6585. case 'bold':
  6586. $out .= 'font-weight:bold;';
  6587. break;
  6588. case 'underscore':
  6589. $out .= 'text-decoration:underline;';
  6590. break;
  6591. }
  6592. }
  6593. }
  6594. return $out.'">'.$matches[2].'</span>';
  6595. }
  6596. }
  6597. <?php
  6598. namespace Composer\DependencyResolver;
  6599. class Decisions implements \Iterator, \Countable
  6600. {
  6601. const DECISION_LITERAL = 0;
  6602. const DECISION_REASON = 1;
  6603. protected $pool;
  6604. protected $decisionMap;
  6605. protected $decisionQueue = array();
  6606. public function __construct($pool)
  6607. {
  6608. $this->pool = $pool;
  6609. $this->decisionMap = array();
  6610. }
  6611. public function decide($literal, $level, $why)
  6612. {
  6613. $this->addDecision($literal, $level);
  6614. $this->decisionQueue[] = array(
  6615. self::DECISION_LITERAL => $literal,
  6616. self::DECISION_REASON => $why,
  6617. );
  6618. }
  6619. public function satisfy($literal)
  6620. {
  6621. $packageId = abs($literal);
  6622. return (
  6623. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  6624. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  6625. );
  6626. }
  6627. public function conflict($literal)
  6628. {
  6629. $packageId = abs($literal);
  6630. return (
  6631. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  6632. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  6633. );
  6634. }
  6635. public function decided($literalOrPackageId)
  6636. {
  6637. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  6638. }
  6639. public function undecided($literalOrPackageId)
  6640. {
  6641. return empty($this->decisionMap[abs($literalOrPackageId)]);
  6642. }
  6643. public function decidedInstall($literalOrPackageId)
  6644. {
  6645. $packageId = abs($literalOrPackageId);
  6646. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  6647. }
  6648. public function decisionLevel($literalOrPackageId)
  6649. {
  6650. $packageId = abs($literalOrPackageId);
  6651. if (isset($this->decisionMap[$packageId])) {
  6652. return abs($this->decisionMap[$packageId]);
  6653. }
  6654. return 0;
  6655. }
  6656. public function decisionRule($literalOrPackageId)
  6657. {
  6658. $packageId = abs($literalOrPackageId);
  6659. foreach ($this->decisionQueue as $i => $decision) {
  6660. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  6661. return $decision[self::DECISION_REASON];
  6662. }
  6663. }
  6664. return null;
  6665. }
  6666. public function atOffset($queueOffset)
  6667. {
  6668. return $this->decisionQueue[$queueOffset];
  6669. }
  6670. public function validOffset($queueOffset)
  6671. {
  6672. return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
  6673. }
  6674. public function lastReason()
  6675. {
  6676. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
  6677. }
  6678. public function lastLiteral()
  6679. {
  6680. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  6681. }
  6682. public function reset()
  6683. {
  6684. while ($decision = array_pop($this->decisionQueue)) {
  6685. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  6686. }
  6687. }
  6688. public function resetToOffset($offset)
  6689. {
  6690. while (count($this->decisionQueue) > $offset + 1) {
  6691. $decision = array_pop($this->decisionQueue);
  6692. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  6693. }
  6694. }
  6695. public function revertLast()
  6696. {
  6697. $this->decisionMap[abs($this->lastLiteral())] = 0;
  6698. array_pop($this->decisionQueue);
  6699. }
  6700. public function count()
  6701. {
  6702. return count($this->decisionQueue);
  6703. }
  6704. public function rewind()
  6705. {
  6706. end($this->decisionQueue);
  6707. }
  6708. public function current()
  6709. {
  6710. return current($this->decisionQueue);
  6711. }
  6712. public function key()
  6713. {
  6714. return key($this->decisionQueue);
  6715. }
  6716. public function next()
  6717. {
  6718. return prev($this->decisionQueue);
  6719. }
  6720. public function valid()
  6721. {
  6722. return false !== current($this->decisionQueue);
  6723. }
  6724. public function isEmpty()
  6725. {
  6726. return count($this->decisionQueue) === 0;
  6727. }
  6728. protected function addDecision($literal, $level)
  6729. {
  6730. $packageId = abs($literal);
  6731. $previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
  6732. if ($previousDecision != 0) {
  6733. $literalString = $this->pool->literalToString($literal);
  6734. $package = $this->pool->literalToPackage($literal);
  6735. throw new SolverBugException(
  6736. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  6737. );
  6738. }
  6739. if ($literal > 0) {
  6740. $this->decisionMap[$packageId] = $level;
  6741. } else {
  6742. $this->decisionMap[$packageId] = -$level;
  6743. }
  6744. }
  6745. }
  6746. <?php
  6747. namespace Composer\DependencyResolver;
  6748. use Composer\Package\PackageInterface;
  6749. use Composer\Package\AliasPackage;
  6750. use Composer\Package\BasePackage;
  6751. use Composer\Semver\Constraint\Constraint;
  6752. class DefaultPolicy implements PolicyInterface
  6753. {
  6754. private $preferStable;
  6755. private $preferLowest;
  6756. public function __construct($preferStable = false, $preferLowest = false)
  6757. {
  6758. $this->preferStable = $preferStable;
  6759. $this->preferLowest = $preferLowest;
  6760. }
  6761. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
  6762. {
  6763. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  6764. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  6765. }
  6766. $constraint = new Constraint($operator, $b->getVersion());
  6767. $version = new Constraint('==', $a->getVersion());
  6768. return $constraint->matchSpecific($version, true);
  6769. }
  6770. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package, $mustMatchName = false)
  6771. {
  6772. $packages = array();
  6773. foreach ($pool->whatProvides($package->getName(), null, $mustMatchName) as $candidate) {
  6774. if ($candidate !== $package) {
  6775. $packages[] = $candidate;
  6776. }
  6777. }
  6778. return $packages;
  6779. }
  6780. public function getPriority(Pool $pool, PackageInterface $package)
  6781. {
  6782. return $pool->getPriority($package->getRepository());
  6783. }
  6784. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
  6785. {
  6786. $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
  6787. foreach ($packages as &$literals) {
  6788. $policy = $this;
  6789. usort($literals, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  6790. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  6791. });
  6792. }
  6793. foreach ($packages as &$literals) {
  6794. $literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
  6795. $literals = $this->pruneToBestVersion($pool, $literals);
  6796. $literals = $this->pruneRemoteAliases($pool, $literals);
  6797. }
  6798. $selected = call_user_func_array('array_merge', $packages);
  6799. usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  6800. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  6801. });
  6802. return $selected;
  6803. }
  6804. protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
  6805. {
  6806. $packages = array();
  6807. foreach ($literals as $literal) {
  6808. $packageName = $pool->literalToPackage($literal)->getName();
  6809. if (!isset($packages[$packageName])) {
  6810. $packages[$packageName] = array();
  6811. }
  6812. if (isset($installedMap[abs($literal)])) {
  6813. array_unshift($packages[$packageName], $literal);
  6814. } else {
  6815. $packages[$packageName][] = $literal;
  6816. }
  6817. }
  6818. return $packages;
  6819. }
  6820. public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
  6821. {
  6822. if ($a->getRepository() === $b->getRepository()) {
  6823. if ($a->getName() === $b->getName()) {
  6824. $aAliased = $a instanceof AliasPackage;
  6825. $bAliased = $b instanceof AliasPackage;
  6826. if ($aAliased && !$bAliased) {
  6827. return -1;
  6828. }
  6829. if (!$aAliased && $bAliased) {
  6830. return 1;
  6831. }
  6832. }
  6833. if (!$ignoreReplace) {
  6834. if ($this->replaces($a, $b)) {
  6835. return 1;
  6836. }
  6837. if ($this->replaces($b, $a)) {
  6838. return -1;
  6839. }
  6840. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  6841. $requiredVendor = substr($requiredPackage, 0, $pos);
  6842. $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
  6843. $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
  6844. if ($bIsSameVendor !== $aIsSameVendor) {
  6845. return $aIsSameVendor ? -1 : 1;
  6846. }
  6847. }
  6848. }
  6849. if ($a->id === $b->id) {
  6850. return 0;
  6851. }
  6852. return ($a->id < $b->id) ? -1 : 1;
  6853. }
  6854. if (isset($installedMap[$a->id])) {
  6855. return -1;
  6856. }
  6857. if (isset($installedMap[$b->id])) {
  6858. return 1;
  6859. }
  6860. return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
  6861. }
  6862. protected function replaces(PackageInterface $source, PackageInterface $target)
  6863. {
  6864. foreach ($source->getReplaces() as $link) {
  6865. if ($link->getTarget() === $target->getName()
  6866. ) {
  6867. return true;
  6868. }
  6869. }
  6870. return false;
  6871. }
  6872. protected function pruneToBestVersion(Pool $pool, $literals)
  6873. {
  6874. $operator = $this->preferLowest ? '<' : '>';
  6875. $bestLiterals = array($literals[0]);
  6876. $bestPackage = $pool->literalToPackage($literals[0]);
  6877. foreach ($literals as $i => $literal) {
  6878. if (0 === $i) {
  6879. continue;
  6880. }
  6881. $package = $pool->literalToPackage($literal);
  6882. if ($this->versionCompare($package, $bestPackage, $operator)) {
  6883. $bestPackage = $package;
  6884. $bestLiterals = array($literal);
  6885. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  6886. $bestLiterals[] = $literal;
  6887. }
  6888. }
  6889. return $bestLiterals;
  6890. }
  6891. protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
  6892. {
  6893. $selected = array();
  6894. $priority = null;
  6895. foreach ($literals as $literal) {
  6896. $package = $pool->literalToPackage($literal);
  6897. if (isset($installedMap[$package->id])) {
  6898. $selected[] = $literal;
  6899. continue;
  6900. }
  6901. if (null === $priority) {
  6902. $priority = $this->getPriority($pool, $package);
  6903. }
  6904. if ($this->getPriority($pool, $package) != $priority) {
  6905. break;
  6906. }
  6907. $selected[] = $literal;
  6908. }
  6909. return $selected;
  6910. }
  6911. protected function pruneRemoteAliases(Pool $pool, array $literals)
  6912. {
  6913. $hasLocalAlias = false;
  6914. foreach ($literals as $literal) {
  6915. $package = $pool->literalToPackage($literal);
  6916. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  6917. $hasLocalAlias = true;
  6918. break;
  6919. }
  6920. }
  6921. if (!$hasLocalAlias) {
  6922. return $literals;
  6923. }
  6924. $selected = array();
  6925. foreach ($literals as $literal) {
  6926. $package = $pool->literalToPackage($literal);
  6927. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  6928. $selected[] = $literal;
  6929. }
  6930. }
  6931. return $selected;
  6932. }
  6933. }
  6934. <?php
  6935. namespace Composer\DependencyResolver\Operation;
  6936. use Composer\Package\PackageInterface;
  6937. class InstallOperation extends SolverOperation
  6938. {
  6939. protected $package;
  6940. public function __construct(PackageInterface $package, $reason = null)
  6941. {
  6942. parent::__construct($reason);
  6943. $this->package = $package;
  6944. }
  6945. public function getPackage()
  6946. {
  6947. return $this->package;
  6948. }
  6949. public function getJobType()
  6950. {
  6951. return 'install';
  6952. }
  6953. public function __toString()
  6954. {
  6955. return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  6956. }
  6957. }
  6958. <?php
  6959. namespace Composer\DependencyResolver\Operation;
  6960. use Composer\Package\AliasPackage;
  6961. use Composer\Package\PackageInterface;
  6962. class MarkAliasInstalledOperation extends SolverOperation
  6963. {
  6964. protected $package;
  6965. public function __construct(AliasPackage $package, $reason = null)
  6966. {
  6967. parent::__construct($reason);
  6968. $this->package = $package;
  6969. }
  6970. public function getPackage()
  6971. {
  6972. return $this->package;
  6973. }
  6974. public function getJobType()
  6975. {
  6976. return 'markAliasInstalled';
  6977. }
  6978. public function __toString()
  6979. {
  6980. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  6981. }
  6982. }
  6983. <?php
  6984. namespace Composer\DependencyResolver\Operation;
  6985. use Composer\Package\AliasPackage;
  6986. use Composer\Package\PackageInterface;
  6987. class MarkAliasUninstalledOperation extends SolverOperation
  6988. {
  6989. protected $package;
  6990. public function __construct(AliasPackage $package, $reason = null)
  6991. {
  6992. parent::__construct($reason);
  6993. $this->package = $package;
  6994. }
  6995. public function getPackage()
  6996. {
  6997. return $this->package;
  6998. }
  6999. public function getJobType()
  7000. {
  7001. return 'markAliasUninstalled';
  7002. }
  7003. public function __toString()
  7004. {
  7005. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  7006. }
  7007. }
  7008. <?php
  7009. namespace Composer\DependencyResolver\Operation;
  7010. interface OperationInterface
  7011. {
  7012. public function getJobType();
  7013. public function getReason();
  7014. public function __toString();
  7015. }
  7016. <?php
  7017. namespace Composer\DependencyResolver\Operation;
  7018. use Composer\Package\PackageInterface;
  7019. abstract class SolverOperation implements OperationInterface
  7020. {
  7021. protected $reason;
  7022. public function __construct($reason = null)
  7023. {
  7024. $this->reason = $reason;
  7025. }
  7026. public function getReason()
  7027. {
  7028. return $this->reason;
  7029. }
  7030. protected function formatVersion(PackageInterface $package)
  7031. {
  7032. return $package->getFullPrettyVersion();
  7033. }
  7034. }
  7035. <?php
  7036. namespace Composer\DependencyResolver\Operation;
  7037. use Composer\Package\PackageInterface;
  7038. class UninstallOperation extends SolverOperation
  7039. {
  7040. protected $package;
  7041. public function __construct(PackageInterface $package, $reason = null)
  7042. {
  7043. parent::__construct($reason);
  7044. $this->package = $package;
  7045. }
  7046. public function getPackage()
  7047. {
  7048. return $this->package;
  7049. }
  7050. public function getJobType()
  7051. {
  7052. return 'uninstall';
  7053. }
  7054. public function __toString()
  7055. {
  7056. return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  7057. }
  7058. }
  7059. <?php
  7060. namespace Composer\DependencyResolver\Operation;
  7061. use Composer\Package\PackageInterface;
  7062. class UpdateOperation extends SolverOperation
  7063. {
  7064. protected $initialPackage;
  7065. protected $targetPackage;
  7066. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  7067. {
  7068. parent::__construct($reason);
  7069. $this->initialPackage = $initial;
  7070. $this->targetPackage = $target;
  7071. }
  7072. public function getInitialPackage()
  7073. {
  7074. return $this->initialPackage;
  7075. }
  7076. public function getTargetPackage()
  7077. {
  7078. return $this->targetPackage;
  7079. }
  7080. public function getJobType()
  7081. {
  7082. return 'update';
  7083. }
  7084. public function __toString()
  7085. {
  7086. return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
  7087. $this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
  7088. }
  7089. }
  7090. <?php
  7091. namespace Composer\DependencyResolver;
  7092. use Composer\Package\PackageInterface;
  7093. interface PolicyInterface
  7094. {
  7095. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
  7096. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
  7097. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null);
  7098. }
  7099. <?php
  7100. namespace Composer\DependencyResolver;
  7101. use Composer\Package\BasePackage;
  7102. use Composer\Package\AliasPackage;
  7103. use Composer\Package\Version\VersionParser;
  7104. use Composer\Semver\Constraint\ConstraintInterface;
  7105. use Composer\Semver\Constraint\Constraint;
  7106. use Composer\Semver\Constraint\EmptyConstraint;
  7107. use Composer\Repository\RepositoryInterface;
  7108. use Composer\Repository\CompositeRepository;
  7109. use Composer\Repository\ComposerRepository;
  7110. use Composer\Repository\InstalledRepositoryInterface;
  7111. use Composer\Repository\PlatformRepository;
  7112. use Composer\Package\PackageInterface;
  7113. class Pool implements \Countable
  7114. {
  7115. const MATCH_NAME = -1;
  7116. const MATCH_NONE = 0;
  7117. const MATCH = 1;
  7118. const MATCH_PROVIDE = 2;
  7119. const MATCH_REPLACE = 3;
  7120. const MATCH_FILTERED = 4;
  7121. protected $repositories = array();
  7122. protected $providerRepos = array();
  7123. protected $packages = array();
  7124. protected $packageByName = array();
  7125. protected $packageByExactName = array();
  7126. protected $acceptableStabilities;
  7127. protected $stabilityFlags;
  7128. protected $versionParser;
  7129. protected $providerCache = array();
  7130. protected $filterRequires;
  7131. protected $whitelist = null;
  7132. protected $id = 1;
  7133. public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $filterRequires = array())
  7134. {
  7135. $this->versionParser = new VersionParser;
  7136. $this->acceptableStabilities = array();
  7137. foreach (BasePackage::$stabilities as $stability => $value) {
  7138. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  7139. $this->acceptableStabilities[$stability] = $value;
  7140. }
  7141. }
  7142. $this->stabilityFlags = $stabilityFlags;
  7143. $this->filterRequires = $filterRequires;
  7144. foreach ($filterRequires as $name => $constraint) {
  7145. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  7146. unset($this->filterRequires[$name]);
  7147. }
  7148. }
  7149. }
  7150. public function setWhitelist($whitelist)
  7151. {
  7152. $this->whitelist = $whitelist;
  7153. $this->providerCache = array();
  7154. }
  7155. public function addRepository(RepositoryInterface $repo, $rootAliases = array())
  7156. {
  7157. if ($repo instanceof CompositeRepository) {
  7158. $repos = $repo->getRepositories();
  7159. } else {
  7160. $repos = array($repo);
  7161. }
  7162. foreach ($repos as $repo) {
  7163. $this->repositories[] = $repo;
  7164. $exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
  7165. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  7166. $this->providerRepos[] = $repo;
  7167. $repo->setRootAliases($rootAliases);
  7168. $repo->resetPackageIds();
  7169. } else {
  7170. foreach ($repo->getPackages() as $package) {
  7171. $names = $package->getNames();
  7172. $stability = $package->getStability();
  7173. if ($exempt || $this->isPackageAcceptable($names, $stability)) {
  7174. $package->setId($this->id++);
  7175. $this->packages[] = $package;
  7176. $this->packageByExactName[$package->getName()][$package->id] = $package;
  7177. foreach ($names as $provided) {
  7178. $this->packageByName[$provided][] = $package;
  7179. }
  7180. $name = $package->getName();
  7181. if (isset($rootAliases[$name][$package->getVersion()])) {
  7182. $alias = $rootAliases[$name][$package->getVersion()];
  7183. if ($package instanceof AliasPackage) {
  7184. $package = $package->getAliasOf();
  7185. }
  7186. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  7187. $aliasPackage->setRootPackageAlias(true);
  7188. $aliasPackage->setId($this->id++);
  7189. $package->getRepository()->addPackage($aliasPackage);
  7190. $this->packages[] = $aliasPackage;
  7191. $this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
  7192. foreach ($aliasPackage->getNames() as $name) {
  7193. $this->packageByName[$name][] = $aliasPackage;
  7194. }
  7195. }
  7196. }
  7197. }
  7198. }
  7199. }
  7200. }
  7201. public function getPriority(RepositoryInterface $repo)
  7202. {
  7203. $priority = array_search($repo, $this->repositories, true);
  7204. if (false === $priority) {
  7205. throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
  7206. }
  7207. return -$priority;
  7208. }
  7209. public function packageById($id)
  7210. {
  7211. return $this->packages[$id - 1];
  7212. }
  7213. public function count()
  7214. {
  7215. return count($this->packages);
  7216. }
  7217. public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false, $bypassFilters = false)
  7218. {
  7219. if ($bypassFilters) {
  7220. return $this->computeWhatProvides($name, $constraint, $mustMatchName, true);
  7221. }
  7222. $key = ((int) $mustMatchName).$constraint;
  7223. if (isset($this->providerCache[$name][$key])) {
  7224. return $this->providerCache[$name][$key];
  7225. }
  7226. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint, $mustMatchName, $bypassFilters);
  7227. }
  7228. private function computeWhatProvides($name, $constraint, $mustMatchName = false, $bypassFilters = false)
  7229. {
  7230. $candidates = array();
  7231. foreach ($this->providerRepos as $repo) {
  7232. foreach ($repo->whatProvides($this, $name, $bypassFilters) as $candidate) {
  7233. $candidates[] = $candidate;
  7234. if ($candidate->id < 1) {
  7235. $candidate->setId($this->id++);
  7236. $this->packages[$this->id - 2] = $candidate;
  7237. }
  7238. }
  7239. }
  7240. if ($mustMatchName) {
  7241. $candidates = array_filter($candidates, function ($candidate) use ($name) {
  7242. return $candidate->getName() == $name;
  7243. });
  7244. if (isset($this->packageByExactName[$name])) {
  7245. $candidates = array_merge($candidates, $this->packageByExactName[$name]);
  7246. }
  7247. } elseif (isset($this->packageByName[$name])) {
  7248. $candidates = array_merge($candidates, $this->packageByName[$name]);
  7249. }
  7250. $matches = $provideMatches = array();
  7251. $nameMatch = false;
  7252. foreach ($candidates as $candidate) {
  7253. $aliasOfCandidate = null;
  7254. if ($candidate instanceof AliasPackage) {
  7255. $aliasOfCandidate = $candidate->getAliasOf();
  7256. }
  7257. if ($this->whitelist !== null && !$bypassFilters && (
  7258. (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
  7259. ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
  7260. )) {
  7261. continue;
  7262. }
  7263. switch ($this->match($candidate, $name, $constraint, $bypassFilters)) {
  7264. case self::MATCH_NONE:
  7265. break;
  7266. case self::MATCH_NAME:
  7267. $nameMatch = true;
  7268. break;
  7269. case self::MATCH:
  7270. $nameMatch = true;
  7271. $matches[] = $candidate;
  7272. break;
  7273. case self::MATCH_PROVIDE:
  7274. $provideMatches[] = $candidate;
  7275. break;
  7276. case self::MATCH_REPLACE:
  7277. $matches[] = $candidate;
  7278. break;
  7279. case self::MATCH_FILTERED:
  7280. break;
  7281. default:
  7282. throw new \UnexpectedValueException('Unexpected match type');
  7283. }
  7284. }
  7285. if ($nameMatch) {
  7286. return $matches;
  7287. }
  7288. return array_merge($matches, $provideMatches);
  7289. }
  7290. public function literalToPackage($literal)
  7291. {
  7292. $packageId = abs($literal);
  7293. return $this->packageById($packageId);
  7294. }
  7295. public function literalToPrettyString($literal, $installedMap)
  7296. {
  7297. $package = $this->literalToPackage($literal);
  7298. if (isset($installedMap[$package->id])) {
  7299. $prefix = ($literal > 0 ? 'keep' : 'remove');
  7300. } else {
  7301. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  7302. }
  7303. return $prefix.' '.$package->getPrettyString();
  7304. }
  7305. public function isPackageAcceptable($name, $stability)
  7306. {
  7307. foreach ((array) $name as $n) {
  7308. if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
  7309. return true;
  7310. }
  7311. if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
  7312. return true;
  7313. }
  7314. }
  7315. return false;
  7316. }
  7317. private function match($candidate, $name, ConstraintInterface $constraint = null, $bypassFilters)
  7318. {
  7319. $candidateName = $candidate->getName();
  7320. $candidateVersion = $candidate->getVersion();
  7321. $isDev = $candidate->getStability() === 'dev';
  7322. $isAlias = $candidate instanceof AliasPackage;
  7323. if (!$bypassFilters && !$isDev && !$isAlias && isset($this->filterRequires[$name])) {
  7324. $requireFilter = $this->filterRequires[$name];
  7325. } else {
  7326. $requireFilter = new EmptyConstraint;
  7327. }
  7328. if ($candidateName === $name) {
  7329. $pkgConstraint = new Constraint('==', $candidateVersion);
  7330. if ($constraint === null || $constraint->matches($pkgConstraint)) {
  7331. return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
  7332. }
  7333. return self::MATCH_NAME;
  7334. }
  7335. $provides = $candidate->getProvides();
  7336. $replaces = $candidate->getReplaces();
  7337. if (isset($replaces[0]) || isset($provides[0])) {
  7338. foreach ($provides as $link) {
  7339. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  7340. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  7341. }
  7342. }
  7343. foreach ($replaces as $link) {
  7344. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  7345. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  7346. }
  7347. }
  7348. return self::MATCH_NONE;
  7349. }
  7350. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  7351. return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  7352. }
  7353. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  7354. return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  7355. }
  7356. return self::MATCH_NONE;
  7357. }
  7358. }
  7359. <?php
  7360. namespace Composer\DependencyResolver;
  7361. class Problem
  7362. {
  7363. protected $reasonSeen;
  7364. protected $reasons = array();
  7365. protected $section = 0;
  7366. protected $pool;
  7367. public function __construct(Pool $pool)
  7368. {
  7369. $this->pool = $pool;
  7370. }
  7371. public function addRule(Rule $rule)
  7372. {
  7373. $this->addReason(spl_object_hash($rule), array(
  7374. 'rule' => $rule,
  7375. 'job' => $rule->getJob(),
  7376. ));
  7377. }
  7378. public function getReasons()
  7379. {
  7380. return $this->reasons;
  7381. }
  7382. public function getPrettyString(array $installedMap = array())
  7383. {
  7384. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  7385. if (count($reasons) === 1) {
  7386. reset($reasons);
  7387. $reason = current($reasons);
  7388. $rule = $reason['rule'];
  7389. $job = $reason['job'];
  7390. if (isset($job['constraint'])) {
  7391. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  7392. } else {
  7393. $packages = array();
  7394. }
  7395. if ($job && $job['cmd'] === 'install' && empty($packages)) {
  7396. if ($job['packageName'] === 'php' || $job['packageName'] === 'php-64bit' || $job['packageName'] === 'hhvm') {
  7397. $available = $this->pool->whatProvides($job['packageName']);
  7398. $version = count($available) ? $available[0]->getPrettyVersion() : phpversion();
  7399. $msg = "\n - This package requires ".$job['packageName'].$this->constraintToText($job['constraint']).' but ';
  7400. if (defined('HHVM_VERSION')) {
  7401. return $msg . 'your HHVM version does not satisfy that requirement.';
  7402. }
  7403. if ($job['packageName'] === 'hhvm') {
  7404. return $msg . 'you are running this with PHP and not HHVM.';
  7405. }
  7406. return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
  7407. }
  7408. if (0 === stripos($job['packageName'], 'ext-')) {
  7409. $ext = substr($job['packageName'], 4);
  7410. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  7411. return "\n - The requested PHP extension ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error.'. Install or enable PHP\'s '.$ext.' extension.';
  7412. }
  7413. if (0 === stripos($job['packageName'], 'lib-')) {
  7414. if (strtolower($job['packageName']) === 'lib-icu') {
  7415. $error = extension_loaded('intl') ? 'has the wrong version installed, try upgrading the intl extension.' : 'is missing from your system, make sure the intl extension is loaded.';
  7416. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error;
  7417. }
  7418. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' has the wrong version installed or is missing from your system, make sure to load the extension providing it.';
  7419. }
  7420. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $job['packageName'])) {
  7421. $illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $job['packageName']);
  7422. return "\n - The requested package ".$job['packageName'].' could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.';
  7423. }
  7424. if ($providers = $this->pool->whatProvides($job['packageName'], $job['constraint'], true, true)) {
  7425. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' is satisfiable by '.$this->getPackageList($providers).' but these conflict with your requirements or minimum-stability.';
  7426. }
  7427. if ($providers = $this->pool->whatProvides($job['packageName'], null, true, true)) {
  7428. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.';
  7429. }
  7430. return "\n - The requested package ".$job['packageName'].' could not be found in any version, there may be a typo in the package name.';
  7431. }
  7432. }
  7433. $messages = array();
  7434. foreach ($reasons as $reason) {
  7435. $rule = $reason['rule'];
  7436. $job = $reason['job'];
  7437. if ($job) {
  7438. $messages[] = $this->jobToText($job);
  7439. } elseif ($rule) {
  7440. if ($rule instanceof Rule) {
  7441. $messages[] = $rule->getPrettyString($this->pool, $installedMap);
  7442. }
  7443. }
  7444. }
  7445. return "\n - ".implode("\n - ", $messages);
  7446. }
  7447. protected function addReason($id, $reason)
  7448. {
  7449. if (!isset($this->reasonSeen[$id])) {
  7450. $this->reasonSeen[$id] = true;
  7451. $this->reasons[$this->section][] = $reason;
  7452. }
  7453. }
  7454. public function nextSection()
  7455. {
  7456. $this->section++;
  7457. }
  7458. protected function jobToText($job)
  7459. {
  7460. switch ($job['cmd']) {
  7461. case 'install':
  7462. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  7463. if (!$packages) {
  7464. return 'No package found to satisfy install request for '.$job['packageName'].$this->constraintToText($job['constraint']);
  7465. }
  7466. return 'Installation request for '.$job['packageName'].$this->constraintToText($job['constraint']).' -> satisfiable by '.$this->getPackageList($packages).'.';
  7467. case 'update':
  7468. return 'Update request for '.$job['packageName'].$this->constraintToText($job['constraint']).'.';
  7469. case 'remove':
  7470. return 'Removal request for '.$job['packageName'].$this->constraintToText($job['constraint']).'';
  7471. }
  7472. if (isset($job['constraint'])) {
  7473. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  7474. } else {
  7475. $packages = array();
  7476. }
  7477. return 'Job(cmd='.$job['cmd'].', target='.$job['packageName'].', packages=['.$this->getPackageList($packages).'])';
  7478. }
  7479. protected function getPackageList($packages)
  7480. {
  7481. $prepared = array();
  7482. foreach ($packages as $package) {
  7483. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  7484. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  7485. }
  7486. foreach ($prepared as $name => $package) {
  7487. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  7488. }
  7489. return implode(', ', $prepared);
  7490. }
  7491. protected function constraintToText($constraint)
  7492. {
  7493. return ($constraint) ? ' '.$constraint->getPrettyString() : '';
  7494. }
  7495. }
  7496. <?php
  7497. namespace Composer\DependencyResolver;
  7498. use Composer\Semver\Constraint\ConstraintInterface;
  7499. class Request
  7500. {
  7501. protected $jobs;
  7502. public function __construct()
  7503. {
  7504. $this->jobs = array();
  7505. }
  7506. public function install($packageName, ConstraintInterface $constraint = null)
  7507. {
  7508. $this->addJob($packageName, 'install', $constraint);
  7509. }
  7510. public function update($packageName, ConstraintInterface $constraint = null)
  7511. {
  7512. $this->addJob($packageName, 'update', $constraint);
  7513. }
  7514. public function remove($packageName, ConstraintInterface $constraint = null)
  7515. {
  7516. $this->addJob($packageName, 'remove', $constraint);
  7517. }
  7518. public function fix($packageName, ConstraintInterface $constraint = null)
  7519. {
  7520. $this->addJob($packageName, 'install', $constraint, true);
  7521. }
  7522. protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
  7523. {
  7524. $packageName = strtolower($packageName);
  7525. $this->jobs[] = array(
  7526. 'cmd' => $cmd,
  7527. 'packageName' => $packageName,
  7528. 'constraint' => $constraint,
  7529. 'fixed' => $fixed,
  7530. );
  7531. }
  7532. public function updateAll()
  7533. {
  7534. $this->jobs[] = array('cmd' => 'update-all');
  7535. }
  7536. public function getJobs()
  7537. {
  7538. return $this->jobs;
  7539. }
  7540. }
  7541. <?php
  7542. namespace Composer\DependencyResolver;
  7543. use Composer\Package\CompletePackage;
  7544. use Composer\Package\PackageInterface;
  7545. use Composer\Package\Link;
  7546. class Rule
  7547. {
  7548. const RULE_INTERNAL_ALLOW_UPDATE = 1;
  7549. const RULE_JOB_INSTALL = 2;
  7550. const RULE_JOB_REMOVE = 3;
  7551. const RULE_PACKAGE_CONFLICT = 6;
  7552. const RULE_PACKAGE_REQUIRES = 7;
  7553. const RULE_PACKAGE_OBSOLETES = 8;
  7554. const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
  7555. const RULE_PACKAGE_SAME_NAME = 10;
  7556. const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
  7557. const RULE_LEARNED = 12;
  7558. const RULE_PACKAGE_ALIAS = 13;
  7559. const BITFIELD_TYPE = 0;
  7560. const BITFIELD_REASON = 8;
  7561. const BITFIELD_DISABLED = 16;
  7562. public $literals;
  7563. protected $bitfield;
  7564. protected $reasonData;
  7565. public function __construct(array $literals, $reason, $reasonData, $job = null)
  7566. {
  7567. sort($literals);
  7568. $this->literals = $literals;
  7569. $this->reasonData = $reasonData;
  7570. if ($job) {
  7571. $this->job = $job;
  7572. }
  7573. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  7574. ($reason << self::BITFIELD_REASON) |
  7575. (255 << self::BITFIELD_TYPE);
  7576. }
  7577. public function getHash()
  7578. {
  7579. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  7580. return $data['hash'];
  7581. }
  7582. public function getJob()
  7583. {
  7584. return isset($this->job) ? $this->job : null;
  7585. }
  7586. public function getReason()
  7587. {
  7588. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  7589. }
  7590. public function getReasonData()
  7591. {
  7592. return $this->reasonData;
  7593. }
  7594. public function getRequiredPackage()
  7595. {
  7596. if ($this->getReason() === self::RULE_JOB_INSTALL) {
  7597. return $this->reasonData;
  7598. }
  7599. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  7600. return $this->reasonData->getTarget();
  7601. }
  7602. }
  7603. public function equals(Rule $rule)
  7604. {
  7605. if (count($this->literals) != count($rule->literals)) {
  7606. return false;
  7607. }
  7608. for ($i = 0, $n = count($this->literals); $i < $n; $i++) {
  7609. if ($this->literals[$i] !== $rule->literals[$i]) {
  7610. return false;
  7611. }
  7612. }
  7613. return true;
  7614. }
  7615. public function setType($type)
  7616. {
  7617. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  7618. }
  7619. public function getType()
  7620. {
  7621. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  7622. }
  7623. public function disable()
  7624. {
  7625. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  7626. }
  7627. public function enable()
  7628. {
  7629. $this->bitfield = $this->bitfield & ~(255 << self::BITFIELD_DISABLED);
  7630. }
  7631. public function isDisabled()
  7632. {
  7633. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  7634. }
  7635. public function isEnabled()
  7636. {
  7637. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  7638. }
  7639. public function isAssertion()
  7640. {
  7641. return 1 === count($this->literals);
  7642. }
  7643. public function getPrettyString(Pool $pool, array $installedMap = array())
  7644. {
  7645. $ruleText = '';
  7646. foreach ($this->literals as $i => $literal) {
  7647. if ($i != 0) {
  7648. $ruleText .= '|';
  7649. }
  7650. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  7651. }
  7652. switch ($this->getReason()) {
  7653. case self::RULE_INTERNAL_ALLOW_UPDATE:
  7654. return $ruleText;
  7655. case self::RULE_JOB_INSTALL:
  7656. return "Install command rule ($ruleText)";
  7657. case self::RULE_JOB_REMOVE:
  7658. return "Remove command rule ($ruleText)";
  7659. case self::RULE_PACKAGE_CONFLICT:
  7660. $package1 = $pool->literalToPackage($this->literals[0]);
  7661. $package2 = $pool->literalToPackage($this->literals[1]);
  7662. return $package1->getPrettyString().' conflicts with '.$this->formatPackagesUnique($pool, array($package2)).'.';
  7663. case self::RULE_PACKAGE_REQUIRES:
  7664. $literals = $this->literals;
  7665. $sourceLiteral = array_shift($literals);
  7666. $sourcePackage = $pool->literalToPackage($sourceLiteral);
  7667. $requires = array();
  7668. foreach ($literals as $literal) {
  7669. $requires[] = $pool->literalToPackage($literal);
  7670. }
  7671. $text = $this->reasonData->getPrettyString($sourcePackage);
  7672. if ($requires) {
  7673. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
  7674. } else {
  7675. $targetName = $this->reasonData->getTarget();
  7676. if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
  7677. if (defined('HHVM_VERSION')) {
  7678. return $text . ' -> your HHVM version does not satisfy that requirement.';
  7679. }
  7680. if ($targetName === 'hhvm') {
  7681. return $text . ' -> you are running this with PHP and not HHVM.';
  7682. }
  7683. $packages = $pool->whatProvides($targetName);
  7684. $package = count($packages) ? current($packages) : phpversion();
  7685. if (!($package instanceof CompletePackage)) {
  7686. return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
  7687. }
  7688. $extra = $package->getExtra();
  7689. if (!empty($extra['config.platform'])) {
  7690. $text .= ' -> your PHP version ('.phpversion().') overridden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  7691. } else {
  7692. $text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  7693. }
  7694. return $text;
  7695. }
  7696. if (0 === strpos($targetName, 'ext-')) {
  7697. $ext = substr($targetName, 4);
  7698. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  7699. return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
  7700. }
  7701. if (0 === strpos($targetName, 'lib-')) {
  7702. $lib = substr($targetName, 4);
  7703. return $text . ' -> the requested linked library '.$lib.' has the wrong version installed or is missing from your system, make sure to have the extension providing it.';
  7704. }
  7705. if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) {
  7706. return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.';
  7707. }
  7708. return $text . ' -> no matching package found.';
  7709. }
  7710. return $text;
  7711. case self::RULE_PACKAGE_OBSOLETES:
  7712. return $ruleText;
  7713. case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
  7714. return $ruleText;
  7715. case self::RULE_PACKAGE_SAME_NAME:
  7716. return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $this->literals) . '.';
  7717. case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
  7718. return $ruleText;
  7719. case self::RULE_LEARNED:
  7720. return 'Conclusion: '.$ruleText;
  7721. case self::RULE_PACKAGE_ALIAS:
  7722. return $ruleText;
  7723. default:
  7724. return '('.$ruleText.')';
  7725. }
  7726. }
  7727. protected function formatPackagesUnique($pool, array $packages)
  7728. {
  7729. $prepared = array();
  7730. foreach ($packages as $package) {
  7731. if (!is_object($package)) {
  7732. $package = $pool->literalToPackage($package);
  7733. }
  7734. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  7735. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  7736. }
  7737. foreach ($prepared as $name => $package) {
  7738. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  7739. }
  7740. return implode(', ', $prepared);
  7741. }
  7742. public function __toString()
  7743. {
  7744. $result = ($this->isDisabled()) ? 'disabled(' : '(';
  7745. foreach ($this->literals as $i => $literal) {
  7746. if ($i != 0) {
  7747. $result .= '|';
  7748. }
  7749. $result .= $literal;
  7750. }
  7751. $result .= ')';
  7752. return $result;
  7753. }
  7754. }
  7755. <?php
  7756. namespace Composer\DependencyResolver;
  7757. class RuleSet implements \IteratorAggregate, \Countable
  7758. {
  7759. const TYPE_PACKAGE = 0;
  7760. const TYPE_JOB = 1;
  7761. const TYPE_LEARNED = 4;
  7762. public $ruleById;
  7763. protected static $types = array(
  7764. 255 => 'UNKNOWN',
  7765. self::TYPE_PACKAGE => 'PACKAGE',
  7766. self::TYPE_JOB => 'JOB',
  7767. self::TYPE_LEARNED => 'LEARNED',
  7768. );
  7769. protected $rules;
  7770. protected $nextRuleId;
  7771. protected $rulesByHash;
  7772. public function __construct()
  7773. {
  7774. $this->nextRuleId = 0;
  7775. foreach ($this->getTypes() as $type) {
  7776. $this->rules[$type] = array();
  7777. }
  7778. $this->rulesByHash = array();
  7779. }
  7780. public function add(Rule $rule, $type)
  7781. {
  7782. if (!isset(self::$types[$type])) {
  7783. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  7784. }
  7785. if (!isset($this->rules[$type])) {
  7786. $this->rules[$type] = array();
  7787. }
  7788. $this->rules[$type][] = $rule;
  7789. $this->ruleById[$this->nextRuleId] = $rule;
  7790. $rule->setType($type);
  7791. $this->nextRuleId++;
  7792. $hash = $rule->getHash();
  7793. if (!isset($this->rulesByHash[$hash])) {
  7794. $this->rulesByHash[$hash] = array($rule);
  7795. } else {
  7796. $this->rulesByHash[$hash][] = $rule;
  7797. }
  7798. }
  7799. public function count()
  7800. {
  7801. return $this->nextRuleId;
  7802. }
  7803. public function ruleById($id)
  7804. {
  7805. return $this->ruleById[$id];
  7806. }
  7807. public function getRules()
  7808. {
  7809. return $this->rules;
  7810. }
  7811. public function getIterator()
  7812. {
  7813. return new RuleSetIterator($this->getRules());
  7814. }
  7815. public function getIteratorFor($types)
  7816. {
  7817. if (!is_array($types)) {
  7818. $types = array($types);
  7819. }
  7820. $allRules = $this->getRules();
  7821. $rules = array();
  7822. foreach ($types as $type) {
  7823. $rules[$type] = $allRules[$type];
  7824. }
  7825. return new RuleSetIterator($rules);
  7826. }
  7827. public function getIteratorWithout($types)
  7828. {
  7829. if (!is_array($types)) {
  7830. $types = array($types);
  7831. }
  7832. $rules = $this->getRules();
  7833. foreach ($types as $type) {
  7834. unset($rules[$type]);
  7835. }
  7836. return new RuleSetIterator($rules);
  7837. }
  7838. public function getTypes()
  7839. {
  7840. $types = self::$types;
  7841. unset($types[255]);
  7842. return array_keys($types);
  7843. }
  7844. public function containsEqual($rule)
  7845. {
  7846. if (isset($this->rulesByHash[$rule->getHash()])) {
  7847. $potentialDuplicates = $this->rulesByHash[$rule->getHash()];
  7848. foreach ($potentialDuplicates as $potentialDuplicate) {
  7849. if ($rule->equals($potentialDuplicate)) {
  7850. return true;
  7851. }
  7852. }
  7853. }
  7854. return false;
  7855. }
  7856. public function getPrettyString(Pool $pool = null)
  7857. {
  7858. $string = "\n";
  7859. foreach ($this->rules as $type => $rules) {
  7860. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  7861. foreach ($rules as $rule) {
  7862. $string .= ($pool ? $rule->getPrettyString($pool) : $rule)."\n";
  7863. }
  7864. $string .= "\n\n";
  7865. }
  7866. return $string;
  7867. }
  7868. public function __toString()
  7869. {
  7870. return $this->getPrettyString(null);
  7871. }
  7872. }
  7873. <?php
  7874. namespace Composer\DependencyResolver;
  7875. use Composer\Package\PackageInterface;
  7876. use Composer\Package\AliasPackage;
  7877. use Composer\Repository\PlatformRepository;
  7878. class RuleSetGenerator
  7879. {
  7880. protected $policy;
  7881. protected $pool;
  7882. protected $rules;
  7883. protected $jobs;
  7884. protected $installedMap;
  7885. protected $whitelistedMap;
  7886. protected $addedMap;
  7887. public function __construct(PolicyInterface $policy, Pool $pool)
  7888. {
  7889. $this->policy = $policy;
  7890. $this->pool = $pool;
  7891. }
  7892. protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
  7893. {
  7894. $literals = array(-$package->id);
  7895. foreach ($providers as $provider) {
  7896. if ($provider === $package) {
  7897. return null;
  7898. }
  7899. $literals[] = $provider->id;
  7900. }
  7901. return new Rule($literals, $reason, $reasonData);
  7902. }
  7903. protected function createInstallOneOfRule(array $packages, $reason, $job)
  7904. {
  7905. $literals = array();
  7906. foreach ($packages as $package) {
  7907. $literals[] = $package->id;
  7908. }
  7909. return new Rule($literals, $reason, $job['packageName'], $job);
  7910. }
  7911. protected function createRemoveRule(PackageInterface $package, $reason, $job)
  7912. {
  7913. return new Rule(array(-$package->id), $reason, $job['packageName'], $job);
  7914. }
  7915. protected function createConflictRule(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
  7916. {
  7917. if ($issuer === $provider) {
  7918. return null;
  7919. }
  7920. return new Rule(array(-$issuer->id, -$provider->id), $reason, $reasonData);
  7921. }
  7922. private function addRule($type, Rule $newRule = null)
  7923. {
  7924. if (!$newRule || $this->rules->containsEqual($newRule)) {
  7925. return;
  7926. }
  7927. $this->rules->add($newRule, $type);
  7928. }
  7929. protected function whitelistFromPackage(PackageInterface $package)
  7930. {
  7931. $workQueue = new \SplQueue;
  7932. $workQueue->enqueue($package);
  7933. while (!$workQueue->isEmpty()) {
  7934. $package = $workQueue->dequeue();
  7935. if (isset($this->whitelistedMap[$package->id])) {
  7936. continue;
  7937. }
  7938. $this->whitelistedMap[$package->id] = true;
  7939. foreach ($package->getRequires() as $link) {
  7940. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
  7941. foreach ($possibleRequires as $require) {
  7942. $workQueue->enqueue($require);
  7943. }
  7944. }
  7945. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
  7946. foreach ($obsoleteProviders as $provider) {
  7947. if ($provider === $package) {
  7948. continue;
  7949. }
  7950. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  7951. $workQueue->enqueue($provider);
  7952. }
  7953. }
  7954. }
  7955. }
  7956. protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
  7957. {
  7958. $workQueue = new \SplQueue;
  7959. $workQueue->enqueue($package);
  7960. while (!$workQueue->isEmpty()) {
  7961. $package = $workQueue->dequeue();
  7962. if (isset($this->addedMap[$package->id])) {
  7963. continue;
  7964. }
  7965. $this->addedMap[$package->id] = true;
  7966. foreach ($package->getRequires() as $link) {
  7967. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  7968. continue;
  7969. }
  7970. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  7971. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  7972. foreach ($possibleRequires as $require) {
  7973. $workQueue->enqueue($require);
  7974. }
  7975. }
  7976. foreach ($package->getConflicts() as $link) {
  7977. $possibleConflicts = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  7978. foreach ($possibleConflicts as $conflict) {
  7979. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createConflictRule($package, $conflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  7980. }
  7981. }
  7982. $isInstalled = (isset($this->installedMap[$package->id]));
  7983. foreach ($package->getReplaces() as $link) {
  7984. $obsoleteProviders = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  7985. foreach ($obsoleteProviders as $provider) {
  7986. if ($provider === $package) {
  7987. continue;
  7988. }
  7989. if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  7990. $reason = ($isInstalled) ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
  7991. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createConflictRule($package, $provider, $reason, $link));
  7992. }
  7993. }
  7994. }
  7995. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null);
  7996. foreach ($obsoleteProviders as $provider) {
  7997. if ($provider === $package) {
  7998. continue;
  7999. }
  8000. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  8001. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
  8002. } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  8003. $reason = ($package->getName() == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
  8004. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createConflictRule($package, $provider, $reason, $package));
  8005. }
  8006. }
  8007. }
  8008. }
  8009. protected function obsoleteImpossibleForAlias($package, $provider)
  8010. {
  8011. $packageIsAlias = $package instanceof AliasPackage;
  8012. $providerIsAlias = $provider instanceof AliasPackage;
  8013. $impossible = (
  8014. ($packageIsAlias && $package->getAliasOf() === $provider) ||
  8015. ($providerIsAlias && $provider->getAliasOf() === $package) ||
  8016. ($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
  8017. );
  8018. return $impossible;
  8019. }
  8020. protected function whitelistFromJobs()
  8021. {
  8022. foreach ($this->jobs as $job) {
  8023. switch ($job['cmd']) {
  8024. case 'install':
  8025. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
  8026. foreach ($packages as $package) {
  8027. $this->whitelistFromPackage($package);
  8028. }
  8029. break;
  8030. }
  8031. }
  8032. }
  8033. protected function addRulesForJobs($ignorePlatformReqs)
  8034. {
  8035. foreach ($this->jobs as $job) {
  8036. switch ($job['cmd']) {
  8037. case 'install':
  8038. if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  8039. continue;
  8040. }
  8041. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8042. if ($packages) {
  8043. foreach ($packages as $package) {
  8044. if (!isset($this->installedMap[$package->id])) {
  8045. $this->addRulesForPackage($package, $ignorePlatformReqs);
  8046. }
  8047. }
  8048. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_JOB_INSTALL, $job);
  8049. $this->addRule(RuleSet::TYPE_JOB, $rule);
  8050. }
  8051. break;
  8052. case 'remove':
  8053. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8054. foreach ($packages as $package) {
  8055. $rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
  8056. $this->addRule(RuleSet::TYPE_JOB, $rule);
  8057. }
  8058. break;
  8059. }
  8060. }
  8061. }
  8062. public function getRulesFor($jobs, $installedMap, $ignorePlatformReqs = false)
  8063. {
  8064. $this->jobs = $jobs;
  8065. $this->rules = new RuleSet;
  8066. $this->installedMap = $installedMap;
  8067. $this->whitelistedMap = array();
  8068. foreach ($this->installedMap as $package) {
  8069. $this->whitelistFromPackage($package);
  8070. }
  8071. $this->whitelistFromJobs();
  8072. $this->pool->setWhitelist($this->whitelistedMap);
  8073. $this->addedMap = array();
  8074. foreach ($this->installedMap as $package) {
  8075. $this->addRulesForPackage($package, $ignorePlatformReqs);
  8076. }
  8077. $this->addRulesForJobs($ignorePlatformReqs);
  8078. return $this->rules;
  8079. }
  8080. }
  8081. <?php
  8082. namespace Composer\DependencyResolver;
  8083. class RuleSetIterator implements \Iterator
  8084. {
  8085. protected $rules;
  8086. protected $types;
  8087. protected $currentOffset;
  8088. protected $currentType;
  8089. protected $currentTypeOffset;
  8090. public function __construct(array $rules)
  8091. {
  8092. $this->rules = $rules;
  8093. $this->types = array_keys($rules);
  8094. sort($this->types);
  8095. $this->rewind();
  8096. }
  8097. public function current()
  8098. {
  8099. return $this->rules[$this->currentType][$this->currentOffset];
  8100. }
  8101. public function key()
  8102. {
  8103. return $this->currentType;
  8104. }
  8105. public function next()
  8106. {
  8107. $this->currentOffset++;
  8108. if (!isset($this->rules[$this->currentType])) {
  8109. return;
  8110. }
  8111. if ($this->currentOffset >= sizeof($this->rules[$this->currentType])) {
  8112. $this->currentOffset = 0;
  8113. do {
  8114. $this->currentTypeOffset++;
  8115. if (!isset($this->types[$this->currentTypeOffset])) {
  8116. $this->currentType = -1;
  8117. break;
  8118. }
  8119. $this->currentType = $this->types[$this->currentTypeOffset];
  8120. } while (isset($this->types[$this->currentTypeOffset]) && !sizeof($this->rules[$this->currentType]));
  8121. }
  8122. }
  8123. public function rewind()
  8124. {
  8125. $this->currentOffset = 0;
  8126. $this->currentTypeOffset = -1;
  8127. $this->currentType = -1;
  8128. do {
  8129. $this->currentTypeOffset++;
  8130. if (!isset($this->types[$this->currentTypeOffset])) {
  8131. $this->currentType = -1;
  8132. break;
  8133. }
  8134. $this->currentType = $this->types[$this->currentTypeOffset];
  8135. } while (isset($this->types[$this->currentTypeOffset]) && !sizeof($this->rules[$this->currentType]));
  8136. }
  8137. public function valid()
  8138. {
  8139. return isset($this->rules[$this->currentType])
  8140. && isset($this->rules[$this->currentType][$this->currentOffset]);
  8141. }
  8142. }
  8143. <?php
  8144. namespace Composer\DependencyResolver;
  8145. class RuleWatchChain extends \SplDoublyLinkedList
  8146. {
  8147. protected $offset = 0;
  8148. public function seek($offset)
  8149. {
  8150. $this->rewind();
  8151. for ($i = 0; $i < $offset; $i++, $this->next());
  8152. }
  8153. public function remove()
  8154. {
  8155. $offset = $this->key();
  8156. $this->offsetUnset($offset);
  8157. $this->seek($offset);
  8158. }
  8159. }
  8160. <?php
  8161. namespace Composer\DependencyResolver;
  8162. class RuleWatchGraph
  8163. {
  8164. protected $watchChains = array();
  8165. public function insert(RuleWatchNode $node)
  8166. {
  8167. if ($node->getRule()->isAssertion()) {
  8168. return;
  8169. }
  8170. foreach (array($node->watch1, $node->watch2) as $literal) {
  8171. if (!isset($this->watchChains[$literal])) {
  8172. $this->watchChains[$literal] = new RuleWatchChain;
  8173. }
  8174. $this->watchChains[$literal]->unshift($node);
  8175. }
  8176. }
  8177. public function propagateLiteral($decidedLiteral, $level, $decisions)
  8178. {
  8179. $literal = -$decidedLiteral;
  8180. if (!isset($this->watchChains[$literal])) {
  8181. return null;
  8182. }
  8183. $chain = $this->watchChains[$literal];
  8184. $chain->rewind();
  8185. while ($chain->valid()) {
  8186. $node = $chain->current();
  8187. $otherWatch = $node->getOtherWatch($literal);
  8188. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  8189. $ruleLiterals = $node->getRule()->literals;
  8190. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
  8191. return $literal !== $ruleLiteral &&
  8192. $otherWatch !== $ruleLiteral &&
  8193. !$decisions->conflict($ruleLiteral);
  8194. });
  8195. if ($alternativeLiterals) {
  8196. reset($alternativeLiterals);
  8197. $this->moveWatch($literal, current($alternativeLiterals), $node);
  8198. continue;
  8199. }
  8200. if ($decisions->conflict($otherWatch)) {
  8201. return $node->getRule();
  8202. }
  8203. $decisions->decide($otherWatch, $level, $node->getRule());
  8204. }
  8205. $chain->next();
  8206. }
  8207. return null;
  8208. }
  8209. protected function moveWatch($fromLiteral, $toLiteral, $node)
  8210. {
  8211. if (!isset($this->watchChains[$toLiteral])) {
  8212. $this->watchChains[$toLiteral] = new RuleWatchChain;
  8213. }
  8214. $node->moveWatch($fromLiteral, $toLiteral);
  8215. $this->watchChains[$fromLiteral]->remove();
  8216. $this->watchChains[$toLiteral]->unshift($node);
  8217. }
  8218. }
  8219. <?php
  8220. namespace Composer\DependencyResolver;
  8221. class RuleWatchNode
  8222. {
  8223. public $watch1;
  8224. public $watch2;
  8225. protected $rule;
  8226. public function __construct($rule)
  8227. {
  8228. $this->rule = $rule;
  8229. $literals = $rule->literals;
  8230. $this->watch1 = count($literals) > 0 ? $literals[0] : 0;
  8231. $this->watch2 = count($literals) > 1 ? $literals[1] : 0;
  8232. }
  8233. public function watch2OnHighest(Decisions $decisions)
  8234. {
  8235. $literals = $this->rule->literals;
  8236. if (count($literals) < 3) {
  8237. return;
  8238. }
  8239. $watchLevel = 0;
  8240. foreach ($literals as $literal) {
  8241. $level = $decisions->decisionLevel($literal);
  8242. if ($level > $watchLevel) {
  8243. $this->watch2 = $literal;
  8244. $watchLevel = $level;
  8245. }
  8246. }
  8247. }
  8248. public function getRule()
  8249. {
  8250. return $this->rule;
  8251. }
  8252. public function getOtherWatch($literal)
  8253. {
  8254. if ($this->watch1 == $literal) {
  8255. return $this->watch2;
  8256. } else {
  8257. return $this->watch1;
  8258. }
  8259. }
  8260. public function moveWatch($from, $to)
  8261. {
  8262. if ($this->watch1 == $from) {
  8263. $this->watch1 = $to;
  8264. } else {
  8265. $this->watch2 = $to;
  8266. }
  8267. }
  8268. }
  8269. <?php
  8270. namespace Composer\DependencyResolver;
  8271. use Composer\IO\IOInterface;
  8272. use Composer\Repository\RepositoryInterface;
  8273. use Composer\Repository\PlatformRepository;
  8274. class Solver
  8275. {
  8276. const BRANCH_LITERALS = 0;
  8277. const BRANCH_LEVEL = 1;
  8278. protected $policy;
  8279. protected $pool;
  8280. protected $installed;
  8281. protected $rules;
  8282. protected $ruleSetGenerator;
  8283. protected $jobs;
  8284. protected $updateMap = array();
  8285. protected $watchGraph;
  8286. protected $decisions;
  8287. protected $installedMap;
  8288. protected $propagateIndex;
  8289. protected $branches = array();
  8290. protected $problems = array();
  8291. protected $learnedPool = array();
  8292. protected $learnedWhy = array();
  8293. protected $io;
  8294. public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
  8295. {
  8296. $this->io = $io;
  8297. $this->policy = $policy;
  8298. $this->pool = $pool;
  8299. $this->installed = $installed;
  8300. $this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
  8301. }
  8302. public function getRuleSetSize()
  8303. {
  8304. return count($this->rules);
  8305. }
  8306. private function makeAssertionRuleDecisions()
  8307. {
  8308. $decisionStart = count($this->decisions) - 1;
  8309. $rulesCount = count($this->rules);
  8310. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  8311. $rule = $this->rules->ruleById[$ruleIndex];
  8312. if (!$rule->isAssertion() || $rule->isDisabled()) {
  8313. continue;
  8314. }
  8315. $literals = $rule->literals;
  8316. $literal = $literals[0];
  8317. if (!$this->decisions->decided(abs($literal))) {
  8318. $this->decisions->decide($literal, 1, $rule);
  8319. continue;
  8320. }
  8321. if ($this->decisions->satisfy($literal)) {
  8322. continue;
  8323. }
  8324. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  8325. $rule->disable();
  8326. continue;
  8327. }
  8328. $conflict = $this->decisions->decisionRule($literal);
  8329. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  8330. $problem = new Problem($this->pool);
  8331. $problem->addRule($rule);
  8332. $problem->addRule($conflict);
  8333. $this->disableProblem($rule);
  8334. $this->problems[] = $problem;
  8335. continue;
  8336. }
  8337. $problem = new Problem($this->pool);
  8338. $problem->addRule($rule);
  8339. $problem->addRule($conflict);
  8340. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
  8341. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  8342. continue;
  8343. }
  8344. $assertRuleLiterals = $assertRule->literals;
  8345. $assertRuleLiteral = $assertRuleLiterals[0];
  8346. if (abs($literal) !== abs($assertRuleLiteral)) {
  8347. continue;
  8348. }
  8349. $problem->addRule($assertRule);
  8350. $this->disableProblem($assertRule);
  8351. }
  8352. $this->problems[] = $problem;
  8353. $this->decisions->resetToOffset($decisionStart);
  8354. $ruleIndex = -1;
  8355. }
  8356. }
  8357. protected function setupInstalledMap()
  8358. {
  8359. $this->installedMap = array();
  8360. foreach ($this->installed->getPackages() as $package) {
  8361. $this->installedMap[$package->id] = $package;
  8362. }
  8363. }
  8364. protected function checkForRootRequireProblems($ignorePlatformReqs)
  8365. {
  8366. foreach ($this->jobs as $job) {
  8367. switch ($job['cmd']) {
  8368. case 'update':
  8369. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8370. foreach ($packages as $package) {
  8371. if (isset($this->installedMap[$package->id])) {
  8372. $this->updateMap[$package->id] = true;
  8373. }
  8374. }
  8375. break;
  8376. case 'update-all':
  8377. foreach ($this->installedMap as $package) {
  8378. $this->updateMap[$package->id] = true;
  8379. }
  8380. break;
  8381. case 'install':
  8382. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  8383. break;
  8384. }
  8385. if (!$this->pool->whatProvides($job['packageName'], $job['constraint'])) {
  8386. $problem = new Problem($this->pool);
  8387. $problem->addRule(new Rule(array(), null, null, $job));
  8388. $this->problems[] = $problem;
  8389. }
  8390. break;
  8391. }
  8392. }
  8393. }
  8394. public function solve(Request $request, $ignorePlatformReqs = false)
  8395. {
  8396. $this->jobs = $request->getJobs();
  8397. $this->setupInstalledMap();
  8398. $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs);
  8399. $this->checkForRootRequireProblems($ignorePlatformReqs);
  8400. $this->decisions = new Decisions($this->pool);
  8401. $this->watchGraph = new RuleWatchGraph;
  8402. foreach ($this->rules as $rule) {
  8403. $this->watchGraph->insert(new RuleWatchNode($rule));
  8404. }
  8405. $this->makeAssertionRuleDecisions();
  8406. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  8407. $before = microtime(true);
  8408. $this->runSat(true);
  8409. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  8410. foreach ($this->installedMap as $packageId => $void) {
  8411. if ($this->decisions->undecided($packageId)) {
  8412. $this->decisions->decide(-$packageId, 1, null);
  8413. }
  8414. }
  8415. if ($this->problems) {
  8416. throw new SolverProblemsException($this->problems, $this->installedMap);
  8417. }
  8418. $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
  8419. return $transaction->getOperations();
  8420. }
  8421. protected function propagate($level)
  8422. {
  8423. while ($this->decisions->validOffset($this->propagateIndex)) {
  8424. $decision = $this->decisions->atOffset($this->propagateIndex);
  8425. $conflict = $this->watchGraph->propagateLiteral(
  8426. $decision[Decisions::DECISION_LITERAL],
  8427. $level,
  8428. $this->decisions
  8429. );
  8430. $this->propagateIndex++;
  8431. if ($conflict) {
  8432. return $conflict;
  8433. }
  8434. }
  8435. return null;
  8436. }
  8437. private function revert($level)
  8438. {
  8439. while (!$this->decisions->isEmpty()) {
  8440. $literal = $this->decisions->lastLiteral();
  8441. if ($this->decisions->undecided($literal)) {
  8442. break;
  8443. }
  8444. $decisionLevel = $this->decisions->decisionLevel($literal);
  8445. if ($decisionLevel <= $level) {
  8446. break;
  8447. }
  8448. $this->decisions->revertLast();
  8449. $this->propagateIndex = count($this->decisions);
  8450. }
  8451. while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  8452. array_pop($this->branches);
  8453. }
  8454. }
  8455. private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
  8456. {
  8457. $level++;
  8458. $this->decisions->decide($literal, $level, $rule);
  8459. while (true) {
  8460. $rule = $this->propagate($level);
  8461. if (!$rule) {
  8462. break;
  8463. }
  8464. if ($level == 1) {
  8465. return $this->analyzeUnsolvable($rule, $disableRules);
  8466. }
  8467. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  8468. if ($newLevel <= 0 || $newLevel >= $level) {
  8469. throw new SolverBugException(
  8470. "Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
  8471. );
  8472. } elseif (!$newRule) {
  8473. throw new SolverBugException(
  8474. "No rule was learned from analyzing $rule at level $level."
  8475. );
  8476. }
  8477. $level = $newLevel;
  8478. $this->revert($level);
  8479. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  8480. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  8481. $ruleNode = new RuleWatchNode($newRule);
  8482. $ruleNode->watch2OnHighest($this->decisions);
  8483. $this->watchGraph->insert($ruleNode);
  8484. $this->decisions->decide($learnLiteral, $level, $newRule);
  8485. }
  8486. return $level;
  8487. }
  8488. private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
  8489. {
  8490. $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage());
  8491. $selectedLiteral = array_shift($literals);
  8492. if (count($literals)) {
  8493. $this->branches[] = array($literals, $level);
  8494. }
  8495. return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
  8496. }
  8497. protected function analyze($level, Rule $rule)
  8498. {
  8499. $analyzedRule = $rule;
  8500. $ruleLevel = 1;
  8501. $num = 0;
  8502. $l1num = 0;
  8503. $seen = array();
  8504. $learnedLiterals = array(null);
  8505. $decisionId = count($this->decisions);
  8506. $this->learnedPool[] = array();
  8507. while (true) {
  8508. $this->learnedPool[count($this->learnedPool) - 1][] = $rule;
  8509. foreach ($rule->literals as $literal) {
  8510. if ($this->decisions->satisfy($literal)) {
  8511. continue;
  8512. }
  8513. if (isset($seen[abs($literal)])) {
  8514. continue;
  8515. }
  8516. $seen[abs($literal)] = true;
  8517. $l = $this->decisions->decisionLevel($literal);
  8518. if (1 === $l) {
  8519. $l1num++;
  8520. } elseif ($level === $l) {
  8521. $num++;
  8522. } else {
  8523. $learnedLiterals[] = $literal;
  8524. if ($l > $ruleLevel) {
  8525. $ruleLevel = $l;
  8526. }
  8527. }
  8528. }
  8529. $l1retry = true;
  8530. while ($l1retry) {
  8531. $l1retry = false;
  8532. if (!$num && !--$l1num) {
  8533. break 2;
  8534. }
  8535. while (true) {
  8536. if ($decisionId <= 0) {
  8537. throw new SolverBugException(
  8538. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  8539. );
  8540. }
  8541. $decisionId--;
  8542. $decision = $this->decisions->atOffset($decisionId);
  8543. $literal = $decision[Decisions::DECISION_LITERAL];
  8544. if (isset($seen[abs($literal)])) {
  8545. break;
  8546. }
  8547. }
  8548. unset($seen[abs($literal)]);
  8549. if ($num && 0 === --$num) {
  8550. $learnedLiterals[0] = -abs($literal);
  8551. if (!$l1num) {
  8552. break 2;
  8553. }
  8554. foreach ($learnedLiterals as $i => $learnedLiteral) {
  8555. if ($i !== 0) {
  8556. unset($seen[abs($learnedLiteral)]);
  8557. }
  8558. }
  8559. $l1num++;
  8560. $l1retry = true;
  8561. }
  8562. }
  8563. $decision = $this->decisions->atOffset($decisionId);
  8564. $rule = $decision[Decisions::DECISION_REASON];
  8565. }
  8566. $why = count($this->learnedPool) - 1;
  8567. if (!$learnedLiterals[0]) {
  8568. throw new SolverBugException(
  8569. "Did not find a learnable literal in analyzed rule $analyzedRule."
  8570. );
  8571. }
  8572. $newRule = new Rule($learnedLiterals, Rule::RULE_LEARNED, $why);
  8573. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  8574. }
  8575. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule)
  8576. {
  8577. $why = spl_object_hash($conflictRule);
  8578. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  8579. $learnedWhy = $this->learnedWhy[$why];
  8580. $problemRules = $this->learnedPool[$learnedWhy];
  8581. foreach ($problemRules as $problemRule) {
  8582. $this->analyzeUnsolvableRule($problem, $problemRule);
  8583. }
  8584. return;
  8585. }
  8586. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  8587. return;
  8588. }
  8589. $problem->nextSection();
  8590. $problem->addRule($conflictRule);
  8591. }
  8592. private function analyzeUnsolvable(Rule $conflictRule, $disableRules)
  8593. {
  8594. $problem = new Problem($this->pool);
  8595. $problem->addRule($conflictRule);
  8596. $this->analyzeUnsolvableRule($problem, $conflictRule);
  8597. $this->problems[] = $problem;
  8598. $seen = array();
  8599. $literals = $conflictRule->literals;
  8600. foreach ($literals as $literal) {
  8601. if ($this->decisions->satisfy($literal)) {
  8602. continue;
  8603. }
  8604. $seen[abs($literal)] = true;
  8605. }
  8606. foreach ($this->decisions as $decision) {
  8607. $literal = $decision[Decisions::DECISION_LITERAL];
  8608. if (!isset($seen[abs($literal)])) {
  8609. continue;
  8610. }
  8611. $why = $decision[Decisions::DECISION_REASON];
  8612. $problem->addRule($why);
  8613. $this->analyzeUnsolvableRule($problem, $why);
  8614. $literals = $why->literals;
  8615. foreach ($literals as $literal) {
  8616. if ($this->decisions->satisfy($literal)) {
  8617. continue;
  8618. }
  8619. $seen[abs($literal)] = true;
  8620. }
  8621. }
  8622. if ($disableRules) {
  8623. foreach ($this->problems[count($this->problems) - 1] as $reason) {
  8624. $this->disableProblem($reason['rule']);
  8625. }
  8626. $this->resetSolver();
  8627. return 1;
  8628. }
  8629. return 0;
  8630. }
  8631. private function disableProblem(Rule $why)
  8632. {
  8633. $job = $why->getJob();
  8634. if (!$job) {
  8635. $why->disable();
  8636. return;
  8637. }
  8638. foreach ($this->rules as $rule) {
  8639. if ($job === $rule->getJob()) {
  8640. $rule->disable();
  8641. }
  8642. }
  8643. }
  8644. private function resetSolver()
  8645. {
  8646. $this->decisions->reset();
  8647. $this->propagateIndex = 0;
  8648. $this->branches = array();
  8649. $this->enableDisableLearnedRules();
  8650. $this->makeAssertionRuleDecisions();
  8651. }
  8652. private function enableDisableLearnedRules()
  8653. {
  8654. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  8655. $why = $this->learnedWhy[spl_object_hash($rule)];
  8656. $problemRules = $this->learnedPool[$why];
  8657. $foundDisabled = false;
  8658. foreach ($problemRules as $problemRule) {
  8659. if ($problemRule->isDisabled()) {
  8660. $foundDisabled = true;
  8661. break;
  8662. }
  8663. }
  8664. if ($foundDisabled && $rule->isEnabled()) {
  8665. $rule->disable();
  8666. } elseif (!$foundDisabled && $rule->isDisabled()) {
  8667. $rule->enable();
  8668. }
  8669. }
  8670. }
  8671. private function runSat($disableRules = true)
  8672. {
  8673. $this->propagateIndex = 0;
  8674. $decisionQueue = array();
  8675. $decisionSupplementQueue = array();
  8676. $disableRules = array();
  8677. $level = 1;
  8678. $systemLevel = $level + 1;
  8679. $installedPos = 0;
  8680. while (true) {
  8681. if (1 === $level) {
  8682. $conflictRule = $this->propagate($level);
  8683. if (null !== $conflictRule) {
  8684. if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
  8685. continue;
  8686. }
  8687. return;
  8688. }
  8689. }
  8690. if ($level < $systemLevel) {
  8691. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
  8692. foreach ($iterator as $rule) {
  8693. if ($rule->isEnabled()) {
  8694. $decisionQueue = array();
  8695. $noneSatisfied = true;
  8696. foreach ($rule->literals as $literal) {
  8697. if ($this->decisions->satisfy($literal)) {
  8698. $noneSatisfied = false;
  8699. break;
  8700. }
  8701. if ($literal > 0 && $this->decisions->undecided($literal)) {
  8702. $decisionQueue[] = $literal;
  8703. }
  8704. }
  8705. if ($noneSatisfied && count($decisionQueue)) {
  8706. if (count($this->installed) != count($this->updateMap)) {
  8707. $prunedQueue = array();
  8708. foreach ($decisionQueue as $literal) {
  8709. if (isset($this->installedMap[abs($literal)])) {
  8710. $prunedQueue[] = $literal;
  8711. if (isset($this->updateMap[abs($literal)])) {
  8712. $prunedQueue = $decisionQueue;
  8713. break;
  8714. }
  8715. }
  8716. }
  8717. $decisionQueue = $prunedQueue;
  8718. }
  8719. }
  8720. if ($noneSatisfied && count($decisionQueue)) {
  8721. $oLevel = $level;
  8722. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  8723. if (0 === $level) {
  8724. return;
  8725. }
  8726. if ($level <= $oLevel) {
  8727. break;
  8728. }
  8729. }
  8730. }
  8731. }
  8732. $systemLevel = $level + 1;
  8733. $iterator->next();
  8734. if ($iterator->valid()) {
  8735. continue;
  8736. }
  8737. }
  8738. if ($level < $systemLevel) {
  8739. $systemLevel = $level;
  8740. }
  8741. for ($i = 0, $n = 0; $n < count($this->rules); $i++, $n++) {
  8742. if ($i == count($this->rules)) {
  8743. $i = 0;
  8744. }
  8745. $rule = $this->rules->ruleById[$i];
  8746. $literals = $rule->literals;
  8747. if ($rule->isDisabled()) {
  8748. continue;
  8749. }
  8750. $decisionQueue = array();
  8751. foreach ($literals as $literal) {
  8752. if ($literal <= 0) {
  8753. if (!$this->decisions->decidedInstall(abs($literal))) {
  8754. continue 2;
  8755. }
  8756. } else {
  8757. if ($this->decisions->decidedInstall(abs($literal))) {
  8758. continue 2;
  8759. }
  8760. if ($this->decisions->undecided(abs($literal))) {
  8761. $decisionQueue[] = $literal;
  8762. }
  8763. }
  8764. }
  8765. if (count($decisionQueue) < 2) {
  8766. continue;
  8767. }
  8768. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  8769. if (0 === $level) {
  8770. return;
  8771. }
  8772. $n = -1;
  8773. }
  8774. if ($level < $systemLevel) {
  8775. continue;
  8776. }
  8777. if (count($this->branches)) {
  8778. $lastLiteral = null;
  8779. $lastLevel = null;
  8780. $lastBranchIndex = 0;
  8781. $lastBranchOffset = 0;
  8782. for ($i = count($this->branches) - 1; $i >= 0; $i--) {
  8783. list($literals, $l) = $this->branches[$i];
  8784. foreach ($literals as $offset => $literal) {
  8785. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  8786. $lastLiteral = $literal;
  8787. $lastBranchIndex = $i;
  8788. $lastBranchOffset = $offset;
  8789. $lastLevel = $l;
  8790. }
  8791. }
  8792. }
  8793. if ($lastLiteral) {
  8794. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  8795. $level = $lastLevel;
  8796. $this->revert($level);
  8797. $why = $this->decisions->lastReason();
  8798. $level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
  8799. if ($level == 0) {
  8800. return;
  8801. }
  8802. continue;
  8803. }
  8804. }
  8805. break;
  8806. }
  8807. }
  8808. }
  8809. <?php
  8810. namespace Composer\DependencyResolver;
  8811. class SolverBugException extends \RuntimeException
  8812. {
  8813. public function __construct($message)
  8814. {
  8815. parent::__construct(
  8816. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  8817. "Please report the command you ran, the exact error you received, and your composer.json on https://github.com/composer/composer/issues - thank you!\n");
  8818. }
  8819. }
  8820. <?php
  8821. namespace Composer\DependencyResolver;
  8822. class SolverProblemsException extends \RuntimeException
  8823. {
  8824. protected $problems;
  8825. protected $installedMap;
  8826. public function __construct(array $problems, array $installedMap)
  8827. {
  8828. $this->problems = $problems;
  8829. $this->installedMap = $installedMap;
  8830. parent::__construct($this->createMessage(), 2);
  8831. }
  8832. protected function createMessage()
  8833. {
  8834. $text = "\n";
  8835. $hasExtensionProblems = false;
  8836. foreach ($this->problems as $i => $problem) {
  8837. $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
  8838. if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
  8839. $hasExtensionProblems = true;
  8840. }
  8841. }
  8842. if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
  8843. $text .= "\nPotential causes:\n - A typo in the package name\n - The package is not available in a stable-enough version according to your minimum-stability setting\n see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.\n\nRead <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.";
  8844. }
  8845. if ($hasExtensionProblems) {
  8846. $text .= $this->createExtensionHint();
  8847. }
  8848. return $text;
  8849. }
  8850. public function getProblems()
  8851. {
  8852. return $this->problems;
  8853. }
  8854. private function createExtensionHint()
  8855. {
  8856. $paths = array();
  8857. if (($iniPath = php_ini_loaded_file()) !== false) {
  8858. $paths[] = $iniPath;
  8859. }
  8860. if (!defined('HHVM_VERSION') && $additionalIniPaths = php_ini_scanned_files()) {
  8861. $paths = array_merge($paths, array_map("trim", explode(",", $additionalIniPaths)));
  8862. }
  8863. if (count($paths) === 0) {
  8864. return '';
  8865. }
  8866. $text = "\n To enable extensions, verify that they are enabled in those .ini files:\n - ";
  8867. $text .= implode("\n - ", $paths);
  8868. $text .= "\n You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
  8869. return $text;
  8870. }
  8871. private function hasExtensionProblems(array $reasonSets)
  8872. {
  8873. foreach ($reasonSets as $reasonSet) {
  8874. foreach ($reasonSet as $reason) {
  8875. if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
  8876. return true;
  8877. }
  8878. }
  8879. }
  8880. return false;
  8881. }
  8882. }
  8883. <?php
  8884. namespace Composer\DependencyResolver;
  8885. use Composer\Package\AliasPackage;
  8886. class Transaction
  8887. {
  8888. protected $policy;
  8889. protected $pool;
  8890. protected $installedMap;
  8891. protected $decisions;
  8892. protected $transaction;
  8893. public function __construct($policy, $pool, $installedMap, $decisions)
  8894. {
  8895. $this->policy = $policy;
  8896. $this->pool = $pool;
  8897. $this->installedMap = $installedMap;
  8898. $this->decisions = $decisions;
  8899. $this->transaction = array();
  8900. }
  8901. public function getOperations()
  8902. {
  8903. $installMeansUpdateMap = $this->findUpdates();
  8904. $updateMap = array();
  8905. $installMap = array();
  8906. $uninstallMap = array();
  8907. foreach ($this->decisions as $i => $decision) {
  8908. $literal = $decision[Decisions::DECISION_LITERAL];
  8909. $reason = $decision[Decisions::DECISION_REASON];
  8910. $package = $this->pool->literalToPackage($literal);
  8911. if (($literal > 0) == (isset($this->installedMap[$package->id]))) {
  8912. continue;
  8913. }
  8914. if ($literal > 0) {
  8915. if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
  8916. $source = $installMeansUpdateMap[abs($literal)];
  8917. $updateMap[$package->id] = array(
  8918. 'package' => $package,
  8919. 'source' => $source,
  8920. 'reason' => $reason,
  8921. );
  8922. unset($installMeansUpdateMap[abs($literal)]);
  8923. $ignoreRemove[$source->id] = true;
  8924. } else {
  8925. $installMap[$package->id] = array(
  8926. 'package' => $package,
  8927. 'reason' => $reason,
  8928. );
  8929. }
  8930. }
  8931. }
  8932. foreach ($this->decisions as $i => $decision) {
  8933. $literal = $decision[Decisions::DECISION_LITERAL];
  8934. $reason = $decision[Decisions::DECISION_REASON];
  8935. $package = $this->pool->literalToPackage($literal);
  8936. if ($literal <= 0 &&
  8937. isset($this->installedMap[$package->id]) &&
  8938. !isset($ignoreRemove[$package->id])) {
  8939. $uninstallMap[$package->id] = array(
  8940. 'package' => $package,
  8941. 'reason' => $reason,
  8942. );
  8943. }
  8944. }
  8945. $this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
  8946. return $this->transaction;
  8947. }
  8948. protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
  8949. {
  8950. $queue = array_map(function ($operation) {
  8951. return $operation['package'];
  8952. },
  8953. $this->findRootPackages($installMap, $updateMap)
  8954. );
  8955. $visited = array();
  8956. while (!empty($queue)) {
  8957. $package = array_pop($queue);
  8958. $packageId = $package->id;
  8959. if (!isset($visited[$packageId])) {
  8960. array_push($queue, $package);
  8961. if ($package instanceof AliasPackage) {
  8962. array_push($queue, $package->getAliasOf());
  8963. } else {
  8964. foreach ($package->getRequires() as $link) {
  8965. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8966. foreach ($possibleRequires as $require) {
  8967. array_push($queue, $require);
  8968. }
  8969. }
  8970. }
  8971. $visited[$package->id] = true;
  8972. } else {
  8973. if (isset($installMap[$packageId])) {
  8974. $this->install(
  8975. $installMap[$packageId]['package'],
  8976. $installMap[$packageId]['reason']
  8977. );
  8978. unset($installMap[$packageId]);
  8979. }
  8980. if (isset($updateMap[$packageId])) {
  8981. $this->update(
  8982. $updateMap[$packageId]['source'],
  8983. $updateMap[$packageId]['package'],
  8984. $updateMap[$packageId]['reason']
  8985. );
  8986. unset($updateMap[$packageId]);
  8987. }
  8988. }
  8989. }
  8990. foreach ($uninstallMap as $uninstall) {
  8991. $this->uninstall($uninstall['package'], $uninstall['reason']);
  8992. }
  8993. }
  8994. protected function findRootPackages($installMap, $updateMap)
  8995. {
  8996. $packages = $installMap + $updateMap;
  8997. $roots = $packages;
  8998. foreach ($packages as $packageId => $operation) {
  8999. $package = $operation['package'];
  9000. if (!isset($roots[$packageId])) {
  9001. continue;
  9002. }
  9003. foreach ($package->getRequires() as $link) {
  9004. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9005. foreach ($possibleRequires as $require) {
  9006. if ($require !== $package) {
  9007. unset($roots[$require->id]);
  9008. }
  9009. }
  9010. }
  9011. }
  9012. return $roots;
  9013. }
  9014. protected function findUpdates()
  9015. {
  9016. $installMeansUpdateMap = array();
  9017. foreach ($this->decisions as $i => $decision) {
  9018. $literal = $decision[Decisions::DECISION_LITERAL];
  9019. $package = $this->pool->literalToPackage($literal);
  9020. if ($package instanceof AliasPackage) {
  9021. continue;
  9022. }
  9023. if ($literal <= 0 && isset($this->installedMap[$package->id])) {
  9024. $updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
  9025. $literals = array($package->id);
  9026. foreach ($updates as $update) {
  9027. $literals[] = $update->id;
  9028. }
  9029. foreach ($literals as $updateLiteral) {
  9030. if ($updateLiteral !== $literal) {
  9031. $installMeansUpdateMap[abs($updateLiteral)] = $package;
  9032. }
  9033. }
  9034. }
  9035. }
  9036. return $installMeansUpdateMap;
  9037. }
  9038. protected function install($package, $reason)
  9039. {
  9040. if ($package instanceof AliasPackage) {
  9041. return $this->markAliasInstalled($package, $reason);
  9042. }
  9043. $this->transaction[] = new Operation\InstallOperation($package, $reason);
  9044. }
  9045. protected function update($from, $to, $reason)
  9046. {
  9047. $this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
  9048. }
  9049. protected function uninstall($package, $reason)
  9050. {
  9051. if ($package instanceof AliasPackage) {
  9052. return $this->markAliasUninstalled($package, $reason);
  9053. }
  9054. $this->transaction[] = new Operation\UninstallOperation($package, $reason);
  9055. }
  9056. protected function markAliasInstalled($package, $reason)
  9057. {
  9058. $this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
  9059. }
  9060. protected function markAliasUninstalled($package, $reason)
  9061. {
  9062. $this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
  9063. }
  9064. }
  9065. <?php
  9066. namespace Composer\Downloader;
  9067. use Composer\Package\PackageInterface;
  9068. use Symfony\Component\Finder\Finder;
  9069. use Composer\IO\IOInterface;
  9070. abstract class ArchiveDownloader extends FileDownloader
  9071. {
  9072. public function download(PackageInterface $package, $path)
  9073. {
  9074. $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  9075. $retries = 3;
  9076. while ($retries--) {
  9077. $fileName = parent::download($package, $path);
  9078. $this->io->writeError(' Extracting archive', true, IOInterface::VERBOSE);
  9079. try {
  9080. $this->filesystem->ensureDirectoryExists($temporaryDir);
  9081. try {
  9082. $this->extract($fileName, $temporaryDir);
  9083. } catch (\Exception $e) {
  9084. parent::clearLastCacheWrite($package);
  9085. throw $e;
  9086. }
  9087. $this->filesystem->unlink($fileName);
  9088. $contentDir = $this->getFolderContent($temporaryDir);
  9089. if (1 === count($contentDir) && is_dir(reset($contentDir))) {
  9090. $contentDir = $this->getFolderContent((string) reset($contentDir));
  9091. }
  9092. foreach ($contentDir as $file) {
  9093. $file = (string) $file;
  9094. $this->filesystem->rename($file, $path . '/' . basename($file));
  9095. }
  9096. $this->filesystem->removeDirectory($temporaryDir);
  9097. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
  9098. $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
  9099. }
  9100. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
  9101. $this->filesystem->removeDirectory($this->config->get('vendor-dir'));
  9102. }
  9103. } catch (\Exception $e) {
  9104. $this->filesystem->removeDirectory($path);
  9105. $this->filesystem->removeDirectory($temporaryDir);
  9106. if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) {
  9107. if ($this->io->isDebug()) {
  9108. $this->io->writeError(' Invalid zip file ('.$e->getMessage().'), retrying...');
  9109. } else {
  9110. $this->io->writeError(' Invalid zip file, retrying...');
  9111. }
  9112. usleep(500000);
  9113. continue;
  9114. }
  9115. throw $e;
  9116. }
  9117. break;
  9118. }
  9119. $this->io->writeError('');
  9120. }
  9121. protected function getFileName(PackageInterface $package, $path)
  9122. {
  9123. return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  9124. }
  9125. protected function processUrl(PackageInterface $package, $url)
  9126. {
  9127. if ($package->getDistReference() && strpos($url, 'github.com')) {
  9128. if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  9129. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $package->getDistReference();
  9130. } elseif ($package->getDistReference() && preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  9131. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $package->getDistReference();
  9132. } elseif ($package->getDistReference() && preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  9133. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $package->getDistReference();
  9134. }
  9135. } elseif ($package->getDistReference() && strpos($url, 'bitbucket.org')) {
  9136. if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  9137. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $package->getDistReference() . '.' . $match[4];
  9138. }
  9139. }
  9140. return parent::processUrl($package, $url);
  9141. }
  9142. abstract protected function extract($file, $path);
  9143. private function getFolderContent($dir)
  9144. {
  9145. $finder = Finder::create()
  9146. ->ignoreVCS(false)
  9147. ->ignoreDotFiles(false)
  9148. ->depth(0)
  9149. ->in($dir);
  9150. return iterator_to_array($finder);
  9151. }
  9152. }
  9153. <?php
  9154. namespace Composer\Downloader;
  9155. use Composer\Package\PackageInterface;
  9156. interface ChangeReportInterface
  9157. {
  9158. public function getLocalChanges(PackageInterface $package, $path);
  9159. }
  9160. <?php
  9161. namespace Composer\Downloader;
  9162. use Composer\Package\PackageInterface;
  9163. use Composer\IO\IOInterface;
  9164. use Composer\Util\Filesystem;
  9165. class DownloadManager
  9166. {
  9167. private $io;
  9168. private $preferDist = false;
  9169. private $preferSource = false;
  9170. private $packagePreferences = array();
  9171. private $filesystem;
  9172. private $downloaders = array();
  9173. public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
  9174. {
  9175. $this->io = $io;
  9176. $this->preferSource = $preferSource;
  9177. $this->filesystem = $filesystem ?: new Filesystem();
  9178. }
  9179. public function setPreferSource($preferSource)
  9180. {
  9181. $this->preferSource = $preferSource;
  9182. return $this;
  9183. }
  9184. public function setPreferDist($preferDist)
  9185. {
  9186. $this->preferDist = $preferDist;
  9187. return $this;
  9188. }
  9189. public function setPreferences(array $preferences)
  9190. {
  9191. $this->packagePreferences = $preferences;
  9192. return $this;
  9193. }
  9194. public function setOutputProgress($outputProgress)
  9195. {
  9196. foreach ($this->downloaders as $downloader) {
  9197. $downloader->setOutputProgress($outputProgress);
  9198. }
  9199. return $this;
  9200. }
  9201. public function setDownloader($type, DownloaderInterface $downloader)
  9202. {
  9203. $type = strtolower($type);
  9204. $this->downloaders[$type] = $downloader;
  9205. return $this;
  9206. }
  9207. public function getDownloader($type)
  9208. {
  9209. $type = strtolower($type);
  9210. if (!isset($this->downloaders[$type])) {
  9211. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  9212. }
  9213. return $this->downloaders[$type];
  9214. }
  9215. public function getDownloaderForInstalledPackage(PackageInterface $package)
  9216. {
  9217. $installationSource = $package->getInstallationSource();
  9218. if ('metapackage' === $package->getType()) {
  9219. return;
  9220. }
  9221. if ('dist' === $installationSource) {
  9222. $downloader = $this->getDownloader($package->getDistType());
  9223. } elseif ('source' === $installationSource) {
  9224. $downloader = $this->getDownloader($package->getSourceType());
  9225. } else {
  9226. throw new \InvalidArgumentException(
  9227. 'Package '.$package.' seems not been installed properly'
  9228. );
  9229. }
  9230. if ($installationSource !== $downloader->getInstallationSource()) {
  9231. throw new \LogicException(sprintf(
  9232. 'Downloader "%s" is a %s type downloader and can not be used to download %s',
  9233. get_class($downloader), $downloader->getInstallationSource(), $installationSource
  9234. ));
  9235. }
  9236. return $downloader;
  9237. }
  9238. public function download(PackageInterface $package, $targetDir, $preferSource = null)
  9239. {
  9240. $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
  9241. $sourceType = $package->getSourceType();
  9242. $distType = $package->getDistType();
  9243. $sources = array();
  9244. if ($sourceType) {
  9245. $sources[] = 'source';
  9246. }
  9247. if ($distType) {
  9248. $sources[] = 'dist';
  9249. }
  9250. if (empty($sources)) {
  9251. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  9252. }
  9253. if (!$preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  9254. $sources = array_reverse($sources);
  9255. }
  9256. $this->filesystem->ensureDirectoryExists($targetDir);
  9257. foreach ($sources as $i => $source) {
  9258. if (isset($e)) {
  9259. $this->io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  9260. }
  9261. $package->setInstallationSource($source);
  9262. try {
  9263. $downloader = $this->getDownloaderForInstalledPackage($package);
  9264. if ($downloader) {
  9265. $downloader->download($package, $targetDir);
  9266. }
  9267. break;
  9268. } catch (\RuntimeException $e) {
  9269. if ($i === count($sources) - 1) {
  9270. throw $e;
  9271. }
  9272. $this->io->writeError(
  9273. ' <warning>Failed to download '.
  9274. $package->getPrettyName().
  9275. ' from ' . $source . ': '.
  9276. $e->getMessage().'</warning>'
  9277. );
  9278. }
  9279. }
  9280. }
  9281. public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
  9282. {
  9283. $downloader = $this->getDownloaderForInstalledPackage($initial);
  9284. if (!$downloader) {
  9285. return;
  9286. }
  9287. $installationSource = $initial->getInstallationSource();
  9288. if ('dist' === $installationSource) {
  9289. $initialType = $initial->getDistType();
  9290. $targetType = $target->getDistType();
  9291. } else {
  9292. $initialType = $initial->getSourceType();
  9293. $targetType = $target->getSourceType();
  9294. }
  9295. if ($target->isDev() && 'dist' === $installationSource) {
  9296. $downloader->remove($initial, $targetDir);
  9297. $this->download($target, $targetDir);
  9298. return;
  9299. }
  9300. if ($initialType === $targetType) {
  9301. $target->setInstallationSource($installationSource);
  9302. try {
  9303. $downloader->update($initial, $target, $targetDir);
  9304. return;
  9305. } catch (\RuntimeException $e) {
  9306. if (!$this->io->isInteractive()) {
  9307. throw $e;
  9308. }
  9309. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  9310. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
  9311. throw $e;
  9312. }
  9313. }
  9314. }
  9315. $downloader->remove($initial, $targetDir);
  9316. $this->download($target, $targetDir, 'source' === $installationSource);
  9317. }
  9318. public function remove(PackageInterface $package, $targetDir)
  9319. {
  9320. $downloader = $this->getDownloaderForInstalledPackage($package);
  9321. if ($downloader) {
  9322. $downloader->remove($package, $targetDir);
  9323. }
  9324. }
  9325. protected function resolvePackageInstallPreference(PackageInterface $package)
  9326. {
  9327. foreach ($this->packagePreferences as $pattern => $preference) {
  9328. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  9329. if (preg_match($pattern, $package->getName())) {
  9330. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  9331. return 'dist';
  9332. }
  9333. return 'source';
  9334. }
  9335. }
  9336. return $package->isDev() ? 'source' : 'dist';
  9337. }
  9338. }
  9339. <?php
  9340. namespace Composer\Downloader;
  9341. use Composer\Package\PackageInterface;
  9342. interface DownloaderInterface
  9343. {
  9344. public function getInstallationSource();
  9345. public function download(PackageInterface $package, $path);
  9346. public function update(PackageInterface $initial, PackageInterface $target, $path);
  9347. public function remove(PackageInterface $package, $path);
  9348. public function setOutputProgress($outputProgress);
  9349. }
  9350. <?php
  9351. namespace Composer\Downloader;
  9352. use Composer\Package\PackageInterface;
  9353. interface DvcsDownloaderInterface
  9354. {
  9355. public function getUnpushedChanges(PackageInterface $package, $path);
  9356. }
  9357. <?php
  9358. namespace Composer\Downloader;
  9359. use Composer\Config;
  9360. use Composer\Cache;
  9361. use Composer\Factory;
  9362. use Composer\IO\IOInterface;
  9363. use Composer\Package\PackageInterface;
  9364. use Composer\Plugin\PluginEvents;
  9365. use Composer\Plugin\PreFileDownloadEvent;
  9366. use Composer\EventDispatcher\EventDispatcher;
  9367. use Composer\Util\Filesystem;
  9368. use Composer\Util\RemoteFilesystem;
  9369. class FileDownloader implements DownloaderInterface
  9370. {
  9371. protected $io;
  9372. protected $config;
  9373. protected $rfs;
  9374. protected $filesystem;
  9375. protected $cache;
  9376. protected $outputProgress = true;
  9377. private $lastCacheWrites = array();
  9378. private $eventDispatcher;
  9379. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
  9380. {
  9381. $this->io = $io;
  9382. $this->config = $config;
  9383. $this->eventDispatcher = $eventDispatcher;
  9384. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  9385. $this->filesystem = $filesystem ?: new Filesystem();
  9386. $this->cache = $cache;
  9387. if ($this->cache && $this->cache->gcIsNecessary()) {
  9388. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  9389. }
  9390. }
  9391. public function getInstallationSource()
  9392. {
  9393. return 'dist';
  9394. }
  9395. public function download(PackageInterface $package, $path)
  9396. {
  9397. if (!$package->getDistUrl()) {
  9398. throw new \InvalidArgumentException('The given package is missing url information');
  9399. }
  9400. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  9401. $urls = $package->getDistUrls();
  9402. while ($url = array_shift($urls)) {
  9403. try {
  9404. return $this->doDownload($package, $path, $url);
  9405. } catch (\Exception $e) {
  9406. if ($this->io->isDebug()) {
  9407. $this->io->writeError('');
  9408. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  9409. } elseif (count($urls)) {
  9410. $this->io->writeError('');
  9411. $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')');
  9412. }
  9413. if (!count($urls)) {
  9414. throw $e;
  9415. }
  9416. }
  9417. }
  9418. $this->io->writeError('');
  9419. }
  9420. protected function doDownload(PackageInterface $package, $path, $url)
  9421. {
  9422. $this->filesystem->emptyDirectory($path);
  9423. $fileName = $this->getFileName($package, $path);
  9424. $processedUrl = $this->processUrl($package, $url);
  9425. $hostname = parse_url($processedUrl, PHP_URL_HOST);
  9426. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $processedUrl);
  9427. if ($this->eventDispatcher) {
  9428. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  9429. }
  9430. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  9431. try {
  9432. $checksum = $package->getDistSha1Checksum();
  9433. $cacheKey = $this->getCacheKey($package, $processedUrl);
  9434. if (!$this->cache || ($checksum && $checksum !== $this->cache->sha1($cacheKey)) || !$this->cache->copyTo($cacheKey, $fileName)) {
  9435. if (!$this->outputProgress) {
  9436. $this->io->writeError(' Downloading');
  9437. }
  9438. $retries = 3;
  9439. while ($retries--) {
  9440. try {
  9441. $rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
  9442. break;
  9443. } catch (TransportException $e) {
  9444. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  9445. throw $e;
  9446. }
  9447. $this->io->writeError(' Download failed, retrying...', true, IOInterface::VERBOSE);
  9448. usleep(500000);
  9449. }
  9450. }
  9451. if ($this->cache) {
  9452. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  9453. $this->cache->copyFrom($cacheKey, $fileName);
  9454. }
  9455. } else {
  9456. $this->io->writeError(' Loading from cache');
  9457. }
  9458. if (!file_exists($fileName)) {
  9459. throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
  9460. .' directory is writable and you have internet connectivity');
  9461. }
  9462. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  9463. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
  9464. }
  9465. } catch (\Exception $e) {
  9466. $this->filesystem->removeDirectory($path);
  9467. $this->clearLastCacheWrite($package);
  9468. throw $e;
  9469. }
  9470. return $fileName;
  9471. }
  9472. public function setOutputProgress($outputProgress)
  9473. {
  9474. $this->outputProgress = $outputProgress;
  9475. return $this;
  9476. }
  9477. protected function clearLastCacheWrite(PackageInterface $package)
  9478. {
  9479. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  9480. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  9481. unset($this->lastCacheWrites[$package->getName()]);
  9482. }
  9483. }
  9484. public function update(PackageInterface $initial, PackageInterface $target, $path)
  9485. {
  9486. $this->remove($initial, $path);
  9487. $this->download($target, $path);
  9488. }
  9489. public function remove(PackageInterface $package, $path)
  9490. {
  9491. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  9492. if (!$this->filesystem->removeDirectory($path)) {
  9493. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  9494. }
  9495. }
  9496. protected function getFileName(PackageInterface $package, $path)
  9497. {
  9498. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  9499. }
  9500. protected function processUrl(PackageInterface $package, $url)
  9501. {
  9502. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  9503. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  9504. }
  9505. return $url;
  9506. }
  9507. private function getCacheKey(PackageInterface $package, $processedUrl)
  9508. {
  9509. $cacheKey = sha1($processedUrl);
  9510. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  9511. }
  9512. }
  9513. <?php
  9514. namespace Composer\Downloader;
  9515. class FilesystemException extends \Exception
  9516. {
  9517. public function __construct($message = '', $code = 0, \Exception $previous = null)
  9518. {
  9519. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  9520. }
  9521. }
  9522. <?php
  9523. namespace Composer\Downloader;
  9524. use Composer\Package\PackageInterface;
  9525. use Composer\Util\ProcessExecutor;
  9526. class FossilDownloader extends VcsDownloader
  9527. {
  9528. public function doDownload(PackageInterface $package, $path, $url)
  9529. {
  9530. $this->config->prohibitUrlByConfig($url, $this->io);
  9531. $url = ProcessExecutor::escape($url);
  9532. $ref = ProcessExecutor::escape($package->getSourceReference());
  9533. $repoFile = $path . '.fossil';
  9534. $this->io->writeError(" Cloning ".$package->getSourceReference($repoFile));
  9535. $command = sprintf('fossil clone %s %s', $url, ProcessExecutor::escape($repoFile));
  9536. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  9537. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9538. }
  9539. $command = sprintf('fossil open %s', ProcessExecutor::escape($repoFile));
  9540. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  9541. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9542. }
  9543. $command = sprintf('fossil update %s', $ref);
  9544. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  9545. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9546. }
  9547. }
  9548. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  9549. {
  9550. $this->config->prohibitUrlByConfig($url, $this->io);
  9551. $url = ProcessExecutor::escape($url);
  9552. $ref = ProcessExecutor::escape($target->getSourceReference());
  9553. $this->io->writeError(" Updating to ".$target->getSourceReference());
  9554. if (!$this->hasMetadataRepository($path)) {
  9555. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  9556. }
  9557. $command = sprintf('fossil pull && fossil up %s', $ref);
  9558. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  9559. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9560. }
  9561. }
  9562. public function getLocalChanges(PackageInterface $package, $path)
  9563. {
  9564. if (!$this->hasMetadataRepository($path)) {
  9565. return null;
  9566. }
  9567. $this->process->execute('fossil changes', $output, realpath($path));
  9568. return trim($output) ?: null;
  9569. }
  9570. protected function getCommitLogs($fromReference, $toReference, $path)
  9571. {
  9572. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', $toReference);
  9573. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  9574. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9575. }
  9576. $log = '';
  9577. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  9578. foreach ($this->process->splitLines($output) as $line) {
  9579. if (preg_match($match, $line))
  9580. {
  9581. break;
  9582. }
  9583. $log .= $line;
  9584. }
  9585. return $log;
  9586. }
  9587. protected function hasMetadataRepository($path)
  9588. {
  9589. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  9590. }
  9591. }
  9592. <?php
  9593. namespace Composer\Downloader;
  9594. use Composer\Package\PackageInterface;
  9595. use Composer\Util\Git as GitUtil;
  9596. use Composer\Util\Platform;
  9597. use Composer\Util\ProcessExecutor;
  9598. use Composer\IO\IOInterface;
  9599. use Composer\Util\Filesystem;
  9600. use Composer\Config;
  9601. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  9602. {
  9603. private $hasStashedChanges = false;
  9604. private $hasDiscardedChanges = false;
  9605. private $gitUtil;
  9606. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  9607. {
  9608. parent::__construct($io, $config, $process, $fs);
  9609. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  9610. }
  9611. public function doDownload(PackageInterface $package, $path, $url)
  9612. {
  9613. GitUtil::cleanEnv();
  9614. $path = $this->normalizePath($path);
  9615. $cachePath = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $url).'/';
  9616. $cacheOptions = '';
  9617. $ref = $package->getSourceReference();
  9618. $flag = Platform::isWindows() ? '/D ' : '';
  9619. $gitVersion = $this->gitUtil->getVersion();
  9620. $msg = " Cloning ".$ref;
  9621. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=')) {
  9622. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  9623. try {
  9624. $this->gitUtil->syncMirror($url, $cachePath);
  9625. if (is_dir($cachePath)) {
  9626. $cacheOptions = sprintf('--dissociate --reference %s ', ProcessExecutor::escape($cachePath));
  9627. $msg = " Cloning ".$ref.' from cache';
  9628. }
  9629. } catch (\RuntimeException $e) {}
  9630. }
  9631. $command = 'git clone --no-checkout %s %s '.$cacheOptions.'&& cd '.$flag.'%2$s && git remote add composer %1$s && git fetch composer';
  9632. $this->io->writeError($msg);
  9633. $commandCallable = function ($url) use ($ref, $path, $command) {
  9634. return sprintf($command, ProcessExecutor::escape($url), ProcessExecutor::escape($path), ProcessExecutor::escape($ref));
  9635. };
  9636. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  9637. if ($url !== $package->getSourceUrl()) {
  9638. $this->updateOriginUrl($path, $package->getSourceUrl());
  9639. } else {
  9640. $this->setPushUrl($path, $url);
  9641. }
  9642. if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
  9643. if ($package->getDistReference() === $package->getSourceReference()) {
  9644. $package->setDistReference($newRef);
  9645. }
  9646. $package->setSourceReference($newRef);
  9647. }
  9648. }
  9649. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  9650. {
  9651. GitUtil::cleanEnv();
  9652. if (!$this->hasMetadataRepository($path)) {
  9653. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  9654. }
  9655. $updateOriginUrl = false;
  9656. if (
  9657. 0 === $this->process->execute('git remote -v', $output, $path)
  9658. && preg_match('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  9659. && preg_match('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  9660. ) {
  9661. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  9662. $updateOriginUrl = true;
  9663. }
  9664. }
  9665. $ref = $target->getSourceReference();
  9666. $this->io->writeError(" Checking out ".$ref);
  9667. $command = 'git remote set-url composer %s && git fetch composer && git fetch --tags composer';
  9668. $commandCallable = function ($url) use ($command) {
  9669. return sprintf($command, ProcessExecutor::escape($url));
  9670. };
  9671. $this->gitUtil->runCommand($commandCallable, $url, $path);
  9672. if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
  9673. if ($target->getDistReference() === $target->getSourceReference()) {
  9674. $target->setDistReference($newRef);
  9675. }
  9676. $target->setSourceReference($newRef);
  9677. }
  9678. if ($updateOriginUrl) {
  9679. $this->updateOriginUrl($path, $target->getSourceUrl());
  9680. }
  9681. }
  9682. public function getLocalChanges(PackageInterface $package, $path)
  9683. {
  9684. GitUtil::cleanEnv();
  9685. if (!$this->hasMetadataRepository($path)) {
  9686. return;
  9687. }
  9688. $command = 'git status --porcelain --untracked-files=no';
  9689. if (0 !== $this->process->execute($command, $output, $path)) {
  9690. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9691. }
  9692. return trim($output) ?: null;
  9693. }
  9694. public function getUnpushedChanges(PackageInterface $package, $path)
  9695. {
  9696. GitUtil::cleanEnv();
  9697. $path = $this->normalizePath($path);
  9698. if (!$this->hasMetadataRepository($path)) {
  9699. return;
  9700. }
  9701. $command = 'git show-ref --head -d';
  9702. if (0 !== $this->process->execute($command, $output, $path)) {
  9703. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9704. }
  9705. $refs = trim($output);
  9706. if (!preg_match('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  9707. return;
  9708. }
  9709. $headRef = $match[1];
  9710. if (!preg_match_all('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  9711. return;
  9712. }
  9713. $branch = $matches[1][0];
  9714. $unpushedChanges = null;
  9715. for ($i = 0; $i <= 1; $i++) {
  9716. foreach ($matches[1] as $candidate) {
  9717. if (preg_match('{^[a-f0-9]+ refs/remotes/((?:composer|origin)/'.preg_quote($candidate).')$}mi', $refs, $match)) {
  9718. $branch = $candidate;
  9719. $remoteBranch = $match[1];
  9720. break;
  9721. }
  9722. }
  9723. if (!isset($remoteBranch)) {
  9724. $unpushedChanges = 'Branch ' . $branch . ' could not be found on the origin remote and appears to be unpushed';
  9725. } else {
  9726. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  9727. if (0 !== $this->process->execute($command, $output, $path)) {
  9728. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9729. }
  9730. $unpushedChanges = trim($output) ?: null;
  9731. }
  9732. if ($unpushedChanges && $i === 0) {
  9733. $this->process->execute('git fetch composer && git fetch origin', $output, $path);
  9734. }
  9735. if (!$unpushedChanges) {
  9736. break;
  9737. }
  9738. }
  9739. return $unpushedChanges;
  9740. }
  9741. protected function cleanChanges(PackageInterface $package, $path, $update)
  9742. {
  9743. GitUtil::cleanEnv();
  9744. $path = $this->normalizePath($path);
  9745. $unpushed = $this->getUnpushedChanges($package, $path);
  9746. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  9747. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  9748. }
  9749. if (!$changes = $this->getLocalChanges($package, $path)) {
  9750. return;
  9751. }
  9752. if (!$this->io->isInteractive()) {
  9753. $discardChanges = $this->config->get('discard-changes');
  9754. if (true === $discardChanges) {
  9755. return $this->discardChanges($path);
  9756. }
  9757. if ('stash' === $discardChanges) {
  9758. if (!$update) {
  9759. return parent::cleanChanges($package, $path, $update);
  9760. }
  9761. return $this->stashChanges($path);
  9762. }
  9763. return parent::cleanChanges($package, $path, $update);
  9764. }
  9765. $changes = array_map(function ($elem) {
  9766. return ' '.$elem;
  9767. }, preg_split('{\s*\r?\n\s*}', $changes));
  9768. $this->io->writeError(' <error>The package has modified files:</error>');
  9769. $this->io->writeError(array_slice($changes, 0, 10));
  9770. if (count($changes) > 10) {
  9771. $this->io->writeError(' <info>'.count($changes) - 10 . ' more files modified, choose "v" to view the full list</info>');
  9772. }
  9773. while (true) {
  9774. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  9775. case 'y':
  9776. $this->discardChanges($path);
  9777. break 2;
  9778. case 's':
  9779. if (!$update) {
  9780. goto help;
  9781. }
  9782. $this->stashChanges($path);
  9783. break 2;
  9784. case 'n':
  9785. throw new \RuntimeException('Update aborted');
  9786. case 'v':
  9787. $this->io->writeError($changes);
  9788. break;
  9789. case 'd':
  9790. $this->viewDiff($path);
  9791. break;
  9792. case '?':
  9793. default:
  9794. help:
  9795. $this->io->writeError(array(
  9796. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  9797. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  9798. ' v - view modified files',
  9799. ' d - view local modifications (diff)',
  9800. ));
  9801. if ($update) {
  9802. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  9803. }
  9804. $this->io->writeError(' ? - print help');
  9805. break;
  9806. }
  9807. }
  9808. }
  9809. protected function reapplyChanges($path)
  9810. {
  9811. $path = $this->normalizePath($path);
  9812. if ($this->hasStashedChanges) {
  9813. $this->hasStashedChanges = false;
  9814. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  9815. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  9816. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  9817. }
  9818. }
  9819. $this->hasDiscardedChanges = false;
  9820. }
  9821. protected function updateToCommit($path, $reference, $branch, $date)
  9822. {
  9823. $force = $this->hasDiscardedChanges || $this->hasStashedChanges ? '-f ' : '';
  9824. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  9825. $branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
  9826. $branches = null;
  9827. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  9828. $branches = $output;
  9829. }
  9830. $gitRef = $reference;
  9831. if (!preg_match('{^[a-f0-9]{40}$}', $reference)
  9832. && $branches
  9833. && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  9834. ) {
  9835. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  9836. if (0 === $this->process->execute($command, $output, $path)) {
  9837. return;
  9838. }
  9839. }
  9840. if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
  9841. if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  9842. $branch = 'v' . $branch;
  9843. }
  9844. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  9845. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  9846. if (0 === $this->process->execute($command, $output, $path)
  9847. || 0 === $this->process->execute($fallbackCommand, $output, $path)
  9848. ) {
  9849. $command = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  9850. if (0 === $this->process->execute($command, $output, $path)) {
  9851. return;
  9852. }
  9853. }
  9854. }
  9855. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  9856. if (0 === $this->process->execute($command, $output, $path)) {
  9857. return;
  9858. }
  9859. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  9860. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  9861. }
  9862. throw new \RuntimeException(GitUtil::sanitizeUrl('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()));
  9863. }
  9864. protected function updateOriginUrl($path, $url)
  9865. {
  9866. $this->process->execute(sprintf('git remote set-url origin %s', ProcessExecutor::escape($url)), $output, $path);
  9867. $this->setPushUrl($path, $url);
  9868. }
  9869. protected function setPushUrl($path, $url)
  9870. {
  9871. if (preg_match('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  9872. $protocols = $this->config->get('github-protocols');
  9873. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  9874. if (!in_array('ssh', $protocols, true)) {
  9875. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  9876. }
  9877. $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
  9878. $this->process->execute($cmd, $ignoredOutput, $path);
  9879. }
  9880. }
  9881. protected function getCommitLogs($fromReference, $toReference, $path)
  9882. {
  9883. $path = $this->normalizePath($path);
  9884. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"', $fromReference, $toReference);
  9885. if (0 !== $this->process->execute($command, $output, $path)) {
  9886. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9887. }
  9888. return $output;
  9889. }
  9890. protected function discardChanges($path)
  9891. {
  9892. $path = $this->normalizePath($path);
  9893. if (0 !== $this->process->execute('git reset --hard', $output, $path)) {
  9894. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  9895. }
  9896. $this->hasDiscardedChanges = true;
  9897. }
  9898. protected function stashChanges($path)
  9899. {
  9900. $path = $this->normalizePath($path);
  9901. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  9902. throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
  9903. }
  9904. $this->hasStashedChanges = true;
  9905. }
  9906. protected function viewDiff($path)
  9907. {
  9908. $path = $this->normalizePath($path);
  9909. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  9910. throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
  9911. }
  9912. $this->io->writeError($output);
  9913. }
  9914. protected function normalizePath($path)
  9915. {
  9916. if (Platform::isWindows() && strlen($path) > 0) {
  9917. $basePath = $path;
  9918. $removed = array();
  9919. while (!is_dir($basePath) && $basePath !== '\\') {
  9920. array_unshift($removed, basename($basePath));
  9921. $basePath = dirname($basePath);
  9922. }
  9923. if ($basePath === '\\') {
  9924. return $path;
  9925. }
  9926. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  9927. }
  9928. return $path;
  9929. }
  9930. protected function hasMetadataRepository($path)
  9931. {
  9932. $path = $this->normalizePath($path);
  9933. return is_dir($path.'/.git');
  9934. }
  9935. }
  9936. <?php
  9937. namespace Composer\Downloader;
  9938. use Composer\Config;
  9939. use Composer\Cache;
  9940. use Composer\EventDispatcher\EventDispatcher;
  9941. use Composer\Package\PackageInterface;
  9942. use Composer\Util\Platform;
  9943. use Composer\Util\ProcessExecutor;
  9944. use Composer\Util\RemoteFilesystem;
  9945. use Composer\IO\IOInterface;
  9946. class GzipDownloader extends ArchiveDownloader
  9947. {
  9948. protected $process;
  9949. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  9950. {
  9951. $this->process = $process ?: new ProcessExecutor($io);
  9952. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  9953. }
  9954. protected function extract($file, $path)
  9955. {
  9956. $targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
  9957. if (!Platform::isWindows()) {
  9958. $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  9959. if (0 === $this->process->execute($command, $ignoredOutput)) {
  9960. return;
  9961. }
  9962. if (extension_loaded('zlib')) {
  9963. $this->extractUsingExt($file, $targetFilepath);
  9964. return;
  9965. }
  9966. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  9967. throw new \RuntimeException($processError);
  9968. }
  9969. $this->extractUsingExt($file, $targetFilepath);
  9970. }
  9971. protected function getFileName(PackageInterface $package, $path)
  9972. {
  9973. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  9974. }
  9975. private function extractUsingExt($file, $targetFilepath)
  9976. {
  9977. $archiveFile = gzopen($file, 'rb');
  9978. $targetFile = fopen($targetFilepath, 'wb');
  9979. while ($string = gzread($archiveFile, 4096)) {
  9980. fwrite($targetFile, $string, Platform::strlen($string));
  9981. }
  9982. gzclose($archiveFile);
  9983. fclose($targetFile);
  9984. }
  9985. }
  9986. <?php
  9987. namespace Composer\Downloader;
  9988. use Composer\Package\PackageInterface;
  9989. use Composer\Util\ProcessExecutor;
  9990. class HgDownloader extends VcsDownloader
  9991. {
  9992. public function doDownload(PackageInterface $package, $path, $url)
  9993. {
  9994. $this->config->prohibitUrlByConfig($url, $this->io);
  9995. $url = ProcessExecutor::escape($url);
  9996. $ref = ProcessExecutor::escape($package->getSourceReference());
  9997. $this->io->writeError(" Cloning ".$package->getSourceReference());
  9998. $command = sprintf('hg clone %s %s', $url, ProcessExecutor::escape($path));
  9999. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  10000. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10001. }
  10002. $command = sprintf('hg up %s', $ref);
  10003. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10004. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10005. }
  10006. }
  10007. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10008. {
  10009. $this->config->prohibitUrlByConfig($url, $this->io);
  10010. $url = ProcessExecutor::escape($url);
  10011. $ref = ProcessExecutor::escape($target->getSourceReference());
  10012. $this->io->writeError(" Updating to ".$target->getSourceReference());
  10013. if (!$this->hasMetadataRepository($path)) {
  10014. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10015. }
  10016. $command = sprintf('hg pull %s && hg up %s', $url, $ref);
  10017. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10018. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10019. }
  10020. }
  10021. public function getLocalChanges(PackageInterface $package, $path)
  10022. {
  10023. if (!is_dir($path.'/.hg')) {
  10024. return null;
  10025. }
  10026. $this->process->execute('hg st', $output, realpath($path));
  10027. return trim($output) ?: null;
  10028. }
  10029. protected function getCommitLogs($fromReference, $toReference, $path)
  10030. {
  10031. $command = sprintf('hg log -r %s:%s --style compact', $fromReference, $toReference);
  10032. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  10033. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10034. }
  10035. return $output;
  10036. }
  10037. protected function hasMetadataRepository($path)
  10038. {
  10039. return is_dir($path . '/.hg');
  10040. }
  10041. }
  10042. <?php
  10043. namespace Composer\Downloader;
  10044. use Composer\Package\Dumper\ArrayDumper;
  10045. use Composer\Package\PackageInterface;
  10046. use Composer\Package\Version\VersionGuesser;
  10047. use Composer\Package\Version\VersionParser;
  10048. use Composer\Util\Platform;
  10049. use Composer\Util\ProcessExecutor;
  10050. use Symfony\Component\Filesystem\Exception\IOException;
  10051. use Symfony\Component\Filesystem\Filesystem;
  10052. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  10053. {
  10054. const STRATEGY_SYMLINK = 10;
  10055. const STRATEGY_MIRROR = 20;
  10056. public function download(PackageInterface $package, $path)
  10057. {
  10058. $url = $package->getDistUrl();
  10059. $realUrl = realpath($url);
  10060. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  10061. throw new \RuntimeException(sprintf(
  10062. 'Source path "%s" is not found for package %s', $url, $package->getName()
  10063. ));
  10064. }
  10065. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  10066. throw new \RuntimeException(sprintf(
  10067. 'Package %s cannot install to "%s" inside its source at "%s"',
  10068. $package->getName(), realpath($path), $realUrl
  10069. ));
  10070. }
  10071. $transportOptions = $package->getTransportOptions() + array('symlink' => null);
  10072. $currentStrategy = self::STRATEGY_SYMLINK;
  10073. $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
  10074. if (true === $transportOptions['symlink']) {
  10075. $currentStrategy = self::STRATEGY_SYMLINK;
  10076. $allowedStrategies = array(self::STRATEGY_SYMLINK);
  10077. } elseif (false === $transportOptions['symlink']) {
  10078. $currentStrategy = self::STRATEGY_MIRROR;
  10079. $allowedStrategies = array(self::STRATEGY_MIRROR);
  10080. }
  10081. $fileSystem = new Filesystem();
  10082. $this->filesystem->removeDirectory($path);
  10083. $this->io->writeError(sprintf(
  10084. ' - Installing <info>%s</info> (<comment>%s</comment>)',
  10085. $package->getName(),
  10086. $package->getFullPrettyVersion()
  10087. ));
  10088. if (self::STRATEGY_SYMLINK == $currentStrategy) {
  10089. try {
  10090. if (Platform::isWindows()) {
  10091. $this->filesystem->junction($realUrl, $path);
  10092. $this->io->writeError(sprintf(' Junctioned from %s', $url));
  10093. } else {
  10094. $absolutePath = $path;
  10095. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  10096. $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
  10097. }
  10098. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  10099. $path = rtrim($path, "/");
  10100. $fileSystem->symlink($shortestPath, $path);
  10101. $this->io->writeError(sprintf(' Symlinked from %s', $url));
  10102. }
  10103. } catch (IOException $e) {
  10104. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
  10105. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  10106. $currentStrategy = self::STRATEGY_MIRROR;
  10107. } else {
  10108. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  10109. }
  10110. }
  10111. }
  10112. if (self::STRATEGY_MIRROR == $currentStrategy) {
  10113. $fileSystem->mirror($realUrl, $path);
  10114. $this->io->writeError(sprintf(' Mirrored from %s', $url));
  10115. }
  10116. $this->io->writeError('');
  10117. }
  10118. public function remove(PackageInterface $package, $path)
  10119. {
  10120. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  10121. $this->io->writeError(" - Removing junction for <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  10122. if (!$this->filesystem->removeJunction($path)) {
  10123. $this->io->writeError("<warn>Could not remove junction at " . $path . " - is another process locking it?</warn>");
  10124. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  10125. }
  10126. } else {
  10127. parent::remove($package, $path);
  10128. }
  10129. }
  10130. public function getVcsReference(PackageInterface $package, $path)
  10131. {
  10132. $parser = new VersionParser;
  10133. $guesser = new VersionGuesser($this->config, new ProcessExecutor($this->io), $parser);
  10134. $dumper = new ArrayDumper;
  10135. $packageConfig = $dumper->dump($package);
  10136. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  10137. return $packageVersion['commit'];
  10138. }
  10139. }
  10140. }
  10141. <?php
  10142. namespace Composer\Downloader;
  10143. use Composer\Util\Filesystem;
  10144. class PearPackageExtractor
  10145. {
  10146. private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
  10147. private $filesystem;
  10148. private $file;
  10149. public function __construct($file)
  10150. {
  10151. if (!is_file($file)) {
  10152. throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
  10153. }
  10154. $this->filesystem = new Filesystem();
  10155. $this->file = $file;
  10156. }
  10157. public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
  10158. {
  10159. $extractionPath = $target.'/tarball';
  10160. try {
  10161. $archive = new \PharData($this->file);
  10162. $archive->extractTo($extractionPath, null, true);
  10163. if (!is_file($this->combine($extractionPath, '/package.xml'))) {
  10164. throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
  10165. }
  10166. $fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
  10167. $this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
  10168. $this->filesystem->removeDirectory($extractionPath);
  10169. } catch (\Exception $exception) {
  10170. throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
  10171. }
  10172. }
  10173. private function copyFiles($files, $source, $target, $roles, $vars)
  10174. {
  10175. foreach ($files as $file) {
  10176. $from = $this->combine($source, $file['from']);
  10177. $to = $this->combine($target, $roles[$file['role']]);
  10178. $to = $this->combine($to, $file['to']);
  10179. $tasks = $file['tasks'];
  10180. $this->copyFile($from, $to, $tasks, $vars);
  10181. }
  10182. }
  10183. private function copyFile($from, $to, $tasks, $vars)
  10184. {
  10185. if (!is_file($from)) {
  10186. throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
  10187. }
  10188. $this->filesystem->ensureDirectoryExists(dirname($to));
  10189. if (0 == count($tasks)) {
  10190. $copied = copy($from, $to);
  10191. } else {
  10192. $content = file_get_contents($from);
  10193. $replacements = array();
  10194. foreach ($tasks as $task) {
  10195. $pattern = $task['from'];
  10196. $varName = $task['to'];
  10197. if (isset($vars[$varName])) {
  10198. if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
  10199. $replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
  10200. } else {
  10201. $replacements[$pattern] = $vars[$varName];
  10202. }
  10203. }
  10204. }
  10205. $content = strtr($content, $replacements);
  10206. $copied = file_put_contents($to, $content);
  10207. }
  10208. if (false === $copied) {
  10209. throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
  10210. }
  10211. }
  10212. private function buildCopyActions($source, array $roles, $vars)
  10213. {
  10214. $package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
  10215. if (false === $package) {
  10216. throw new \RuntimeException('Package definition file is not valid.');
  10217. }
  10218. $packageSchemaVersion = $package['version'];
  10219. if ('1.0' == $packageSchemaVersion) {
  10220. $children = $package->release->filelist->children();
  10221. $packageName = (string) $package->name;
  10222. $packageVersion = (string) $package->release->version;
  10223. $sourceDir = $packageName . '-' . $packageVersion;
  10224. $result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
  10225. } elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
  10226. $children = $package->contents->children();
  10227. $packageName = (string) $package->name;
  10228. $packageVersion = (string) $package->version->release;
  10229. $sourceDir = $packageName . '-' . $packageVersion;
  10230. $result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
  10231. $namespaces = $package->getNamespaces();
  10232. $package->registerXPathNamespace('ns', $namespaces['']);
  10233. $releaseNodes = $package->xpath('ns:phprelease');
  10234. $this->applyRelease($result, $releaseNodes, $vars);
  10235. } else {
  10236. throw new \RuntimeException('Unsupported schema version of package definition file.');
  10237. }
  10238. return $result;
  10239. }
  10240. private function applyRelease(&$actions, $releaseNodes, $vars)
  10241. {
  10242. foreach ($releaseNodes as $releaseNode) {
  10243. $requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
  10244. if ($requiredOs && $vars['os'] != $requiredOs) {
  10245. continue;
  10246. }
  10247. if ($releaseNode->filelist) {
  10248. foreach ($releaseNode->filelist->children() as $action) {
  10249. if ('install' == $action->getName()) {
  10250. $name = (string) $action['name'];
  10251. $as = (string) $action['as'];
  10252. if (isset($actions[$name])) {
  10253. $actions[$name]['to'] = $as;
  10254. }
  10255. } elseif ('ignore' == $action->getName()) {
  10256. $name = (string) $action['name'];
  10257. unset($actions[$name]);
  10258. } else {
  10259. }
  10260. }
  10261. }
  10262. break;
  10263. }
  10264. }
  10265. private function buildSourceList10($children, $targetRoles, $source, $target, $role, $packageName)
  10266. {
  10267. $result = array();
  10268. foreach ($children as $child) {
  10269. if ($child->getName() == 'dir') {
  10270. $dirSource = $this->combine($source, (string) $child['name']);
  10271. $dirTarget = $child['baseinstalldir'] ?: $target;
  10272. $dirRole = $child['role'] ?: $role;
  10273. $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  10274. $result = array_merge($result, $dirFiles);
  10275. } elseif ($child->getName() == 'file') {
  10276. $fileRole = (string) $child['role'] ?: $role;
  10277. if (isset($targetRoles[$fileRole])) {
  10278. $fileName = (string) ($child['name'] ?: $child[0]);
  10279. $fileSource = $this->combine($source, $fileName);
  10280. $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName);
  10281. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  10282. $fileTarget = $packageName . '/' . $fileTarget;
  10283. }
  10284. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
  10285. }
  10286. }
  10287. }
  10288. return $result;
  10289. }
  10290. private function buildSourceList20($children, $targetRoles, $source, $target, $role, $packageName)
  10291. {
  10292. $result = array();
  10293. foreach ($children as $child) {
  10294. if ('dir' == $child->getName()) {
  10295. $dirSource = $this->combine($source, $child['name']);
  10296. $dirTarget = $child['baseinstalldir'] ?: $target;
  10297. $dirRole = $child['role'] ?: $role;
  10298. $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  10299. $result = array_merge($result, $dirFiles);
  10300. } elseif ('file' == $child->getName()) {
  10301. $fileRole = (string) $child['role'] ?: $role;
  10302. if (isset($targetRoles[$fileRole])) {
  10303. $fileSource = $this->combine($source, (string) $child['name']);
  10304. $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']);
  10305. $fileTasks = array();
  10306. foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
  10307. if ('replace' == $taskNode->getName()) {
  10308. $fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
  10309. }
  10310. }
  10311. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  10312. $fileTarget = $packageName . '/' . $fileTarget;
  10313. }
  10314. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
  10315. }
  10316. }
  10317. }
  10318. return $result;
  10319. }
  10320. private function combine($left, $right)
  10321. {
  10322. return rtrim($left, '/') . '/' . ltrim($right, '/');
  10323. }
  10324. }
  10325. <?php
  10326. namespace Composer\Downloader;
  10327. use Composer\Package\PackageInterface;
  10328. use Composer\Repository\VcsRepository;
  10329. use Composer\Util\Perforce;
  10330. class PerforceDownloader extends VcsDownloader
  10331. {
  10332. protected $perforce;
  10333. public function doDownload(PackageInterface $package, $path, $url)
  10334. {
  10335. $ref = $package->getSourceReference();
  10336. $label = $this->getLabelFromSourceReference($ref);
  10337. $this->io->writeError(' Cloning ' . $ref);
  10338. $this->initPerforce($package, $path, $url);
  10339. $this->perforce->setStream($ref);
  10340. $this->perforce->p4Login();
  10341. $this->perforce->writeP4ClientSpec();
  10342. $this->perforce->connectClient();
  10343. $this->perforce->syncCodeBase($label);
  10344. $this->perforce->cleanupClientSpec();
  10345. }
  10346. private function getLabelFromSourceReference($ref)
  10347. {
  10348. $pos = strpos($ref, '@');
  10349. if (false !== $pos) {
  10350. return substr($ref, $pos + 1);
  10351. }
  10352. return null;
  10353. }
  10354. public function initPerforce(PackageInterface $package, $path, $url)
  10355. {
  10356. if (!empty($this->perforce)) {
  10357. $this->perforce->initializePath($path);
  10358. return;
  10359. }
  10360. $repository = $package->getRepository();
  10361. $repoConfig = null;
  10362. if ($repository instanceof VcsRepository) {
  10363. $repoConfig = $this->getRepoConfig($repository);
  10364. }
  10365. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  10366. }
  10367. private function getRepoConfig(VcsRepository $repository)
  10368. {
  10369. return $repository->getRepoConfig();
  10370. }
  10371. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10372. {
  10373. $this->doDownload($target, $path, $url);
  10374. }
  10375. public function getLocalChanges(PackageInterface $package, $path)
  10376. {
  10377. $this->io->writeError('Perforce driver does not check for local changes before overriding', true);
  10378. return;
  10379. }
  10380. protected function getCommitLogs($fromReference, $toReference, $path)
  10381. {
  10382. $commitLogs = $this->perforce->getCommitLogs($fromReference, $toReference);
  10383. return $commitLogs;
  10384. }
  10385. public function setPerforce($perforce)
  10386. {
  10387. $this->perforce = $perforce;
  10388. }
  10389. protected function hasMetadataRepository($path)
  10390. {
  10391. return true;
  10392. }
  10393. }
  10394. <?php
  10395. namespace Composer\Downloader;
  10396. class PharDownloader extends ArchiveDownloader
  10397. {
  10398. protected function extract($file, $path)
  10399. {
  10400. $archive = new \Phar($file);
  10401. $archive->extractTo($path, null, true);
  10402. }
  10403. }
  10404. <?php
  10405. namespace Composer\Downloader;
  10406. use Composer\Config;
  10407. use Composer\Cache;
  10408. use Composer\EventDispatcher\EventDispatcher;
  10409. use Composer\Util\Platform;
  10410. use Composer\Util\ProcessExecutor;
  10411. use Composer\Util\RemoteFilesystem;
  10412. use Composer\IO\IOInterface;
  10413. use RarArchive;
  10414. class RarDownloader extends ArchiveDownloader
  10415. {
  10416. protected $process;
  10417. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  10418. {
  10419. $this->process = $process ?: new ProcessExecutor($io);
  10420. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  10421. }
  10422. protected function extract($file, $path)
  10423. {
  10424. $processError = null;
  10425. if (!Platform::isWindows()) {
  10426. $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' && chmod -R u+w ' . ProcessExecutor::escape($path);
  10427. if (0 === $this->process->execute($command, $ignoredOutput)) {
  10428. return;
  10429. }
  10430. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  10431. }
  10432. if (!class_exists('RarArchive')) {
  10433. $iniPath = php_ini_loaded_file();
  10434. if ($iniPath) {
  10435. $iniMessage = 'The php.ini used by your command-line PHP is: ' . $iniPath;
  10436. } else {
  10437. $iniMessage = 'A php.ini file does not exist. You will have to create one.';
  10438. }
  10439. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  10440. . $iniMessage . "\n" . $processError;
  10441. if (!Platform::isWindows()) {
  10442. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  10443. }
  10444. throw new \RuntimeException($error);
  10445. }
  10446. $rarArchive = RarArchive::open($file);
  10447. if (false === $rarArchive) {
  10448. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  10449. }
  10450. $entries = $rarArchive->getEntries();
  10451. if (false === $entries) {
  10452. throw new \RuntimeException('Could not retrieve RAR archive entries');
  10453. }
  10454. foreach ($entries as $entry) {
  10455. if (false === $entry->extract($path)) {
  10456. throw new \RuntimeException('Could not extract entry');
  10457. }
  10458. }
  10459. $rarArchive->close();
  10460. }
  10461. }
  10462. <?php
  10463. namespace Composer\Downloader;
  10464. use Composer\Package\PackageInterface;
  10465. use Composer\Util\Svn as SvnUtil;
  10466. use Composer\Repository\VcsRepository;
  10467. class SvnDownloader extends VcsDownloader
  10468. {
  10469. protected $cacheCredentials = true;
  10470. public function doDownload(PackageInterface $package, $path, $url)
  10471. {
  10472. SvnUtil::cleanEnv();
  10473. $ref = $package->getSourceReference();
  10474. $repo = $package->getRepository();
  10475. if ($repo instanceof VcsRepository) {
  10476. $repoConfig = $repo->getRepoConfig();
  10477. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  10478. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  10479. }
  10480. }
  10481. $this->io->writeError(" Checking out ".$package->getSourceReference());
  10482. $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  10483. }
  10484. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10485. {
  10486. SvnUtil::cleanEnv();
  10487. $ref = $target->getSourceReference();
  10488. if (!$this->hasMetadataRepository($path)) {
  10489. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10490. }
  10491. $flags = "";
  10492. if (0 === $this->process->execute('svn --version', $output)) {
  10493. if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match) && version_compare($match[1], '1.7.0', '>=')) {
  10494. $flags .= ' --ignore-ancestry';
  10495. }
  10496. }
  10497. $this->io->writeError(" Checking out " . $ref);
  10498. $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  10499. }
  10500. public function getLocalChanges(PackageInterface $package, $path)
  10501. {
  10502. if (!$this->hasMetadataRepository($path)) {
  10503. return null;
  10504. }
  10505. $this->process->execute('svn status --ignore-externals', $output, $path);
  10506. return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
  10507. }
  10508. protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
  10509. {
  10510. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  10511. $util->setCacheCredentials($this->cacheCredentials);
  10512. try {
  10513. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  10514. } catch (\RuntimeException $e) {
  10515. throw new \RuntimeException(
  10516. 'Package could not be downloaded, '.$e->getMessage()
  10517. );
  10518. }
  10519. }
  10520. protected function cleanChanges(PackageInterface $package, $path, $update)
  10521. {
  10522. if (!$changes = $this->getLocalChanges($package, $path)) {
  10523. return;
  10524. }
  10525. if (!$this->io->isInteractive()) {
  10526. if (true === $this->config->get('discard-changes')) {
  10527. return $this->discardChanges($path);
  10528. }
  10529. return parent::cleanChanges($package, $path, $update);
  10530. }
  10531. $changes = array_map(function ($elem) {
  10532. return ' '.$elem;
  10533. }, preg_split('{\s*\r?\n\s*}', $changes));
  10534. $this->io->writeError(' <error>The package has modified files:</error>');
  10535. $this->io->writeError(array_slice($changes, 0, 10));
  10536. if (count($changes) > 10) {
  10537. $this->io->writeError(' <info>'.count($changes) - 10 . ' more files modified, choose "v" to view the full list</info>');
  10538. }
  10539. while (true) {
  10540. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  10541. case 'y':
  10542. $this->discardChanges($path);
  10543. break 2;
  10544. case 'n':
  10545. throw new \RuntimeException('Update aborted');
  10546. case 'v':
  10547. $this->io->writeError($changes);
  10548. break;
  10549. case '?':
  10550. default:
  10551. $this->io->writeError(array(
  10552. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  10553. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  10554. ' v - view modified files',
  10555. ' ? - print help',
  10556. ));
  10557. break;
  10558. }
  10559. }
  10560. }
  10561. protected function getCommitLogs($fromReference, $toReference, $path)
  10562. {
  10563. if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
  10564. $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
  10565. $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
  10566. $command = sprintf('svn log -r%s:%s --incremental', $fromRevision, $toRevision);
  10567. if (0 !== $this->process->execute($command, $output, $path)) {
  10568. throw new \RuntimeException(
  10569. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  10570. );
  10571. }
  10572. } else {
  10573. $output = "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  10574. }
  10575. return $output;
  10576. }
  10577. protected function discardChanges($path)
  10578. {
  10579. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  10580. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  10581. }
  10582. }
  10583. protected function hasMetadataRepository($path)
  10584. {
  10585. return is_dir($path.'/.svn');
  10586. }
  10587. }
  10588. <?php
  10589. namespace Composer\Downloader;
  10590. class TarDownloader extends ArchiveDownloader
  10591. {
  10592. protected function extract($file, $path)
  10593. {
  10594. $archive = new \PharData($file);
  10595. $archive->extractTo($path, null, true);
  10596. }
  10597. }
  10598. <?php
  10599. namespace Composer\Downloader;
  10600. class TransportException extends \RuntimeException
  10601. {
  10602. protected $headers;
  10603. protected $response;
  10604. protected $statusCode;
  10605. public function setHeaders($headers)
  10606. {
  10607. $this->headers = $headers;
  10608. }
  10609. public function getHeaders()
  10610. {
  10611. return $this->headers;
  10612. }
  10613. public function setResponse($response)
  10614. {
  10615. $this->response = $response;
  10616. }
  10617. public function getResponse()
  10618. {
  10619. return $this->response;
  10620. }
  10621. public function setStatusCode($statusCode)
  10622. {
  10623. $this->statusCode = $statusCode;
  10624. }
  10625. public function getStatusCode()
  10626. {
  10627. return $this->statusCode;
  10628. }
  10629. }
  10630. <?php
  10631. namespace Composer\Downloader;
  10632. use Composer\Package\PackageInterface;
  10633. interface VcsCapableDownloaderInterface
  10634. {
  10635. public function getVcsReference(PackageInterface $package, $path);
  10636. }
  10637. <?php
  10638. namespace Composer\Downloader;
  10639. use Composer\Config;
  10640. use Composer\Package\Dumper\ArrayDumper;
  10641. use Composer\Package\PackageInterface;
  10642. use Composer\Package\Version\VersionGuesser;
  10643. use Composer\Package\Version\VersionParser;
  10644. use Composer\Util\ProcessExecutor;
  10645. use Composer\IO\IOInterface;
  10646. use Composer\Util\Filesystem;
  10647. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  10648. {
  10649. protected $io;
  10650. protected $config;
  10651. protected $process;
  10652. protected $filesystem;
  10653. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  10654. {
  10655. $this->io = $io;
  10656. $this->config = $config;
  10657. $this->process = $process ?: new ProcessExecutor($io);
  10658. $this->filesystem = $fs ?: new Filesystem($this->process);
  10659. }
  10660. public function getInstallationSource()
  10661. {
  10662. return 'source';
  10663. }
  10664. public function download(PackageInterface $package, $path)
  10665. {
  10666. if (!$package->getSourceReference()) {
  10667. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  10668. }
  10669. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  10670. $this->filesystem->emptyDirectory($path);
  10671. $urls = $package->getSourceUrls();
  10672. while ($url = array_shift($urls)) {
  10673. try {
  10674. if (Filesystem::isLocalPath($url)) {
  10675. $url = realpath($url);
  10676. }
  10677. $this->doDownload($package, $path, $url);
  10678. break;
  10679. } catch (\Exception $e) {
  10680. if ($e instanceof \PHPUnit_Framework_Exception) {
  10681. throw $e;
  10682. }
  10683. if ($this->io->isDebug()) {
  10684. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  10685. } elseif (count($urls)) {
  10686. $this->io->writeError(' Failed, trying the next URL');
  10687. }
  10688. if (!count($urls)) {
  10689. throw $e;
  10690. }
  10691. }
  10692. }
  10693. $this->io->writeError('');
  10694. }
  10695. public function update(PackageInterface $initial, PackageInterface $target, $path)
  10696. {
  10697. if (!$target->getSourceReference()) {
  10698. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  10699. }
  10700. $name = $target->getName();
  10701. if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
  10702. if ($target->getSourceType() === 'svn') {
  10703. $from = $initial->getSourceReference();
  10704. $to = $target->getSourceReference();
  10705. } else {
  10706. $from = substr($initial->getSourceReference(), 0, 7);
  10707. $to = substr($target->getSourceReference(), 0, 7);
  10708. }
  10709. $name .= ' '.$initial->getPrettyVersion();
  10710. } else {
  10711. $from = $initial->getFullPrettyVersion();
  10712. $to = $target->getFullPrettyVersion();
  10713. }
  10714. $this->io->writeError(" - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
  10715. $this->cleanChanges($initial, $path, true);
  10716. $urls = $target->getSourceUrls();
  10717. $exception = null;
  10718. while ($url = array_shift($urls)) {
  10719. try {
  10720. if (Filesystem::isLocalPath($url)) {
  10721. $url = realpath($url);
  10722. }
  10723. $this->doUpdate($initial, $target, $path, $url);
  10724. $exception = null;
  10725. break;
  10726. } catch (\Exception $exception) {
  10727. if ($exception instanceof \PHPUnit_Framework_Exception) {
  10728. throw $exception;
  10729. }
  10730. if ($this->io->isDebug()) {
  10731. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  10732. } elseif (count($urls)) {
  10733. $this->io->writeError(' Failed, trying the next URL');
  10734. }
  10735. }
  10736. }
  10737. $this->reapplyChanges($path);
  10738. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  10739. $message = 'Pulling in changes:';
  10740. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  10741. if (!trim($logs)) {
  10742. $message = 'Rolling back changes:';
  10743. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  10744. }
  10745. if (trim($logs)) {
  10746. $logs = implode("\n", array_map(function ($line) {
  10747. return ' ' . $line;
  10748. }, explode("\n", $logs)));
  10749. $logs = str_replace('<', '\<', $logs);
  10750. $this->io->writeError(' '.$message);
  10751. $this->io->writeError($logs);
  10752. }
  10753. }
  10754. if (!$urls && $exception) {
  10755. throw $exception;
  10756. }
  10757. $this->io->writeError('');
  10758. }
  10759. public function remove(PackageInterface $package, $path)
  10760. {
  10761. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
  10762. $this->cleanChanges($package, $path, false);
  10763. if (!$this->filesystem->removeDirectory($path)) {
  10764. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  10765. }
  10766. }
  10767. public function setOutputProgress($outputProgress)
  10768. {
  10769. return $this;
  10770. }
  10771. public function getVcsReference(PackageInterface $package, $path)
  10772. {
  10773. $parser = new VersionParser;
  10774. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  10775. $dumper = new ArrayDumper;
  10776. $packageConfig = $dumper->dump($package);
  10777. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  10778. return $packageVersion['commit'];
  10779. }
  10780. }
  10781. protected function cleanChanges(PackageInterface $package, $path, $update)
  10782. {
  10783. if (null !== $this->getLocalChanges($package, $path)) {
  10784. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  10785. }
  10786. }
  10787. protected function reapplyChanges($path)
  10788. {
  10789. }
  10790. abstract protected function doDownload(PackageInterface $package, $path, $url);
  10791. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
  10792. abstract protected function getCommitLogs($fromReference, $toReference, $path);
  10793. abstract protected function hasMetadataRepository($path);
  10794. }
  10795. <?php
  10796. namespace Composer\Downloader;
  10797. use Composer\Config;
  10798. use Composer\Cache;
  10799. use Composer\EventDispatcher\EventDispatcher;
  10800. use Composer\Package\PackageInterface;
  10801. use Composer\Util\ProcessExecutor;
  10802. use Composer\Util\RemoteFilesystem;
  10803. use Composer\IO\IOInterface;
  10804. class XzDownloader extends ArchiveDownloader
  10805. {
  10806. protected $process;
  10807. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  10808. {
  10809. $this->process = $process ?: new ProcessExecutor($io);
  10810. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  10811. }
  10812. protected function extract($file, $path)
  10813. {
  10814. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  10815. if (0 === $this->process->execute($command, $ignoredOutput)) {
  10816. return;
  10817. }
  10818. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  10819. throw new \RuntimeException($processError);
  10820. }
  10821. protected function getFileName(PackageInterface $package, $path)
  10822. {
  10823. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10824. }
  10825. }
  10826. <?php
  10827. namespace Composer\Downloader;
  10828. use Composer\Config;
  10829. use Composer\Cache;
  10830. use Composer\EventDispatcher\EventDispatcher;
  10831. use Composer\Package\PackageInterface;
  10832. use Composer\Util\Platform;
  10833. use Composer\Util\ProcessExecutor;
  10834. use Composer\Util\RemoteFilesystem;
  10835. use Composer\IO\IOInterface;
  10836. use Symfony\Component\Process\ExecutableFinder;
  10837. use ZipArchive;
  10838. class ZipDownloader extends ArchiveDownloader
  10839. {
  10840. protected $process;
  10841. protected static $hasSystemUnzip;
  10842. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  10843. {
  10844. $this->process = $process ?: new ProcessExecutor($io);
  10845. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  10846. }
  10847. public function download(PackageInterface $package, $path)
  10848. {
  10849. if (null === self::$hasSystemUnzip) {
  10850. $finder = new ExecutableFinder;
  10851. self::$hasSystemUnzip = (bool) $finder->find('unzip');
  10852. }
  10853. if (!class_exists('ZipArchive') && !self::$hasSystemUnzip) {
  10854. $iniPath = php_ini_loaded_file();
  10855. if ($iniPath) {
  10856. $iniMessage = 'The php.ini used by your command-line PHP is: ' . $iniPath;
  10857. } else {
  10858. $iniMessage = 'A php.ini file does not exist. You will have to create one.';
  10859. }
  10860. $error = "The zip extension and unzip command are both missing, skipping.\n" . $iniMessage;
  10861. throw new \RuntimeException($error);
  10862. }
  10863. return parent::download($package, $path);
  10864. }
  10865. protected function extract($file, $path)
  10866. {
  10867. $processError = null;
  10868. if (self::$hasSystemUnzip && !(class_exists('ZipArchive') && Platform::isWindows())) {
  10869. $command = 'unzip '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
  10870. if (!Platform::isWindows()) {
  10871. $command .= ' && chmod -R u+w ' . ProcessExecutor::escape($path);
  10872. }
  10873. try {
  10874. if (0 === $this->process->execute($command, $ignoredOutput)) {
  10875. return;
  10876. }
  10877. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  10878. } catch (\Exception $e) {
  10879. $processError = 'Failed to execute ' . $command . "\n\n" . $e->getMessage();
  10880. }
  10881. if (!class_exists('ZipArchive')) {
  10882. throw new \RuntimeException($processError);
  10883. }
  10884. }
  10885. $zipArchive = new ZipArchive();
  10886. if (true !== ($retval = $zipArchive->open($file))) {
  10887. throw new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n".$processError), $retval);
  10888. }
  10889. if (true !== $zipArchive->extractTo($path)) {
  10890. throw new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n".$processError));
  10891. }
  10892. $zipArchive->close();
  10893. }
  10894. protected function getErrorMessage($retval, $file)
  10895. {
  10896. switch ($retval) {
  10897. case ZipArchive::ER_EXISTS:
  10898. return sprintf("File '%s' already exists.", $file);
  10899. case ZipArchive::ER_INCONS:
  10900. return sprintf("Zip archive '%s' is inconsistent.", $file);
  10901. case ZipArchive::ER_INVAL:
  10902. return sprintf("Invalid argument (%s)", $file);
  10903. case ZipArchive::ER_MEMORY:
  10904. return sprintf("Malloc failure (%s)", $file);
  10905. case ZipArchive::ER_NOENT:
  10906. return sprintf("No such zip file: '%s'", $file);
  10907. case ZipArchive::ER_NOZIP:
  10908. return sprintf("'%s' is not a zip archive.", $file);
  10909. case ZipArchive::ER_OPEN:
  10910. return sprintf("Can't open zip file: %s", $file);
  10911. case ZipArchive::ER_READ:
  10912. return sprintf("Zip read error (%s)", $file);
  10913. case ZipArchive::ER_SEEK:
  10914. return sprintf("Zip seek error (%s)", $file);
  10915. default:
  10916. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  10917. }
  10918. }
  10919. }
  10920. <?php
  10921. namespace Composer\EventDispatcher;
  10922. class Event
  10923. {
  10924. protected $name;
  10925. protected $args;
  10926. protected $flags;
  10927. private $propagationStopped = false;
  10928. public function __construct($name, array $args = array(), array $flags = array())
  10929. {
  10930. $this->name = $name;
  10931. $this->args = $args;
  10932. $this->flags = $flags;
  10933. }
  10934. public function getName()
  10935. {
  10936. return $this->name;
  10937. }
  10938. public function getArguments()
  10939. {
  10940. return $this->args;
  10941. }
  10942. public function getFlags()
  10943. {
  10944. return $this->flags;
  10945. }
  10946. public function isPropagationStopped()
  10947. {
  10948. return $this->propagationStopped;
  10949. }
  10950. public function stopPropagation()
  10951. {
  10952. $this->propagationStopped = true;
  10953. }
  10954. }
  10955. <?php
  10956. namespace Composer\EventDispatcher;
  10957. use Composer\DependencyResolver\PolicyInterface;
  10958. use Composer\DependencyResolver\Pool;
  10959. use Composer\DependencyResolver\Request;
  10960. use Composer\Installer\InstallerEvent;
  10961. use Composer\IO\IOInterface;
  10962. use Composer\Composer;
  10963. use Composer\DependencyResolver\Operation\OperationInterface;
  10964. use Composer\Repository\CompositeRepository;
  10965. use Composer\Script;
  10966. use Composer\Script\CommandEvent;
  10967. use Composer\Script\PackageEvent;
  10968. use Composer\Util\ProcessExecutor;
  10969. use Symfony\Component\Process\PhpExecutableFinder;
  10970. class EventDispatcher
  10971. {
  10972. protected $composer;
  10973. protected $io;
  10974. protected $loader;
  10975. protected $process;
  10976. protected $listeners;
  10977. private $eventStack;
  10978. public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
  10979. {
  10980. $this->composer = $composer;
  10981. $this->io = $io;
  10982. $this->process = $process ?: new ProcessExecutor($io);
  10983. $this->eventStack = array();
  10984. }
  10985. public function dispatch($eventName, Event $event = null)
  10986. {
  10987. if (null === $event) {
  10988. $event = new Event($eventName);
  10989. }
  10990. return $this->doDispatch($event);
  10991. }
  10992. public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
  10993. {
  10994. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  10995. }
  10996. public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  10997. {
  10998. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations, $operation));
  10999. }
  11000. public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  11001. {
  11002. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations));
  11003. }
  11004. protected function doDispatch(Event $event)
  11005. {
  11006. $pathStr = 'PATH';
  11007. if (!isset($_SERVER[$pathStr]) && isset($_SERVER['Path'])) {
  11008. $pathStr = 'Path';
  11009. }
  11010. $binDir = $this->composer->getConfig()->get('bin-dir');
  11011. if (is_dir($binDir)) {
  11012. $binDir = realpath($binDir);
  11013. if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) {
  11014. $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr);
  11015. putenv($pathStr.'='.$_SERVER[$pathStr]);
  11016. }
  11017. }
  11018. $listeners = $this->getListeners($event);
  11019. $this->pushEvent($event);
  11020. $return = 0;
  11021. foreach ($listeners as $callable) {
  11022. if (!is_string($callable) && is_callable($callable)) {
  11023. $event = $this->checkListenerExpectedEvent($callable, $event);
  11024. $return = false === call_user_func($callable, $event) ? 1 : 0;
  11025. } elseif ($this->isComposerScript($callable)) {
  11026. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  11027. $scriptName = substr($callable, 1);
  11028. $args = $event->getArguments();
  11029. $flags = $event->getFlags();
  11030. if (substr($callable, 0, 10) === '@composer ') {
  11031. $finder = new PhpExecutableFinder();
  11032. $phpPath = $finder->find();
  11033. if (!$phpPath) {
  11034. throw new \RuntimeException('Failed to locate PHP binary to execute '.$scriptName);
  11035. }
  11036. $exec = $phpPath . ' ' . realpath($_SERVER['argv'][0]) . substr($callable, 9);
  11037. if (0 !== ($exitCode = $this->process->execute($exec))) {
  11038. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()));
  11039. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  11040. }
  11041. } else {
  11042. if (!$this->getListeners(new Event($scriptName))) {
  11043. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable));
  11044. }
  11045. $return = $this->dispatch($scriptName, new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags));
  11046. }
  11047. } elseif ($this->isPhpScript($callable)) {
  11048. $className = substr($callable, 0, strpos($callable, '::'));
  11049. $methodName = substr($callable, strpos($callable, '::') + 2);
  11050. if (!class_exists($className)) {
  11051. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>');
  11052. continue;
  11053. }
  11054. if (!is_callable($callable)) {
  11055. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>');
  11056. continue;
  11057. }
  11058. try {
  11059. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  11060. } catch (\Exception $e) {
  11061. $message = "Script %s handling the %s event terminated with an exception";
  11062. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>');
  11063. throw $e;
  11064. }
  11065. } else {
  11066. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  11067. $exec = $callable . ($args === '' ? '' : ' '.$args);
  11068. if ($this->io->isVerbose()) {
  11069. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  11070. } else {
  11071. $this->io->writeError(sprintf('> %s', $exec));
  11072. }
  11073. if (0 !== ($exitCode = $this->process->execute($exec))) {
  11074. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()));
  11075. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  11076. }
  11077. }
  11078. if ($event->isPropagationStopped()) {
  11079. break;
  11080. }
  11081. }
  11082. $this->popEvent();
  11083. return $return;
  11084. }
  11085. protected function executeEventPhpScript($className, $methodName, Event $event)
  11086. {
  11087. $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
  11088. if ($this->io->isVerbose()) {
  11089. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  11090. } else {
  11091. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  11092. }
  11093. return $className::$methodName($event);
  11094. }
  11095. protected function checkListenerExpectedEvent($target, Event $event)
  11096. {
  11097. if (in_array($event->getName(), array(
  11098. 'init',
  11099. 'command',
  11100. 'pre-file-download',
  11101. ), true)) {
  11102. return $event;
  11103. }
  11104. try {
  11105. $reflected = new \ReflectionParameter($target, 0);
  11106. } catch (\Exception $e) {
  11107. return $event;
  11108. }
  11109. $typehint = $reflected->getClass();
  11110. if (!$typehint instanceof \ReflectionClass) {
  11111. return $event;
  11112. }
  11113. $expected = $typehint->getName();
  11114. if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
  11115. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  11116. $event = new \Composer\Script\CommandEvent(
  11117. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(), $event->getArguments()
  11118. );
  11119. }
  11120. if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
  11121. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  11122. $event = new \Composer\Script\PackageEvent(
  11123. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(),
  11124. $event->getPolicy(), $event->getPool(), $event->getInstalledRepo(), $event->getRequest(),
  11125. $event->getOperations(), $event->getOperation()
  11126. );
  11127. }
  11128. if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
  11129. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  11130. $event = new \Composer\Script\Event(
  11131. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(),
  11132. $event->getArguments(), $event->getFlags()
  11133. );
  11134. }
  11135. return $event;
  11136. }
  11137. private function serializeCallback($cb)
  11138. {
  11139. if (is_array($cb) && count($cb) === 2) {
  11140. if (is_object($cb[0])) {
  11141. $cb[0] = get_class($cb[0]);
  11142. }
  11143. if (is_string($cb[0]) && is_string($cb[1])) {
  11144. $cb = implode('::', $cb);
  11145. }
  11146. }
  11147. if (is_string($cb)) {
  11148. return $cb;
  11149. }
  11150. return var_export($cb, true);
  11151. }
  11152. public function addListener($eventName, $listener, $priority = 0)
  11153. {
  11154. $this->listeners[$eventName][$priority][] = $listener;
  11155. }
  11156. public function addSubscriber(EventSubscriberInterface $subscriber)
  11157. {
  11158. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  11159. if (is_string($params)) {
  11160. $this->addListener($eventName, array($subscriber, $params));
  11161. } elseif (is_string($params[0])) {
  11162. $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
  11163. } else {
  11164. foreach ($params as $listener) {
  11165. $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
  11166. }
  11167. }
  11168. }
  11169. }
  11170. protected function getListeners(Event $event)
  11171. {
  11172. $scriptListeners = $this->getScriptListeners($event);
  11173. if (!isset($this->listeners[$event->getName()][0])) {
  11174. $this->listeners[$event->getName()][0] = array();
  11175. }
  11176. krsort($this->listeners[$event->getName()]);
  11177. $listeners = $this->listeners;
  11178. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  11179. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  11180. }
  11181. public function hasEventListeners(Event $event)
  11182. {
  11183. $listeners = $this->getListeners($event);
  11184. return count($listeners) > 0;
  11185. }
  11186. protected function getScriptListeners(Event $event)
  11187. {
  11188. $package = $this->composer->getPackage();
  11189. $scripts = $package->getScripts();
  11190. if (empty($scripts[$event->getName()])) {
  11191. return array();
  11192. }
  11193. if ($this->loader) {
  11194. $this->loader->unregister();
  11195. }
  11196. $generator = $this->composer->getAutoloadGenerator();
  11197. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  11198. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  11199. $map = $generator->parseAutoloads($packageMap, $package);
  11200. $this->loader = $generator->createLoader($map);
  11201. $this->loader->register();
  11202. return $scripts[$event->getName()];
  11203. }
  11204. protected function isPhpScript($callable)
  11205. {
  11206. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  11207. }
  11208. protected function isComposerScript($callable)
  11209. {
  11210. return '@' === substr($callable, 0, 1);
  11211. }
  11212. protected function pushEvent(Event $event)
  11213. {
  11214. $eventName = $event->getName();
  11215. if (in_array($eventName, $this->eventStack)) {
  11216. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  11217. }
  11218. return array_push($this->eventStack, $eventName);
  11219. }
  11220. protected function popEvent()
  11221. {
  11222. return array_pop($this->eventStack);
  11223. }
  11224. }
  11225. <?php
  11226. namespace Composer\EventDispatcher;
  11227. interface EventSubscriberInterface
  11228. {
  11229. public static function getSubscribedEvents();
  11230. }
  11231. <?php
  11232. namespace Composer\EventDispatcher;
  11233. class ScriptExecutionException extends \RuntimeException
  11234. {
  11235. }
  11236. <?php
  11237. namespace Composer\Exception;
  11238. class NoSslException extends \RuntimeException
  11239. {
  11240. }
  11241. <?php
  11242. namespace Composer;
  11243. use Composer\Config\JsonConfigSource;
  11244. use Composer\Json\JsonFile;
  11245. use Composer\IO\IOInterface;
  11246. use Composer\Package\Archiver;
  11247. use Composer\Package\Version\VersionGuesser;
  11248. use Composer\Repository\RepositoryManager;
  11249. use Composer\Repository\RepositoryFactory;
  11250. use Composer\Repository\WritableRepositoryInterface;
  11251. use Composer\Util\Filesystem;
  11252. use Composer\Util\Platform;
  11253. use Composer\Util\ProcessExecutor;
  11254. use Composer\Util\RemoteFilesystem;
  11255. use Composer\Util\Silencer;
  11256. use Composer\Plugin\PluginEvents;
  11257. use Composer\EventDispatcher\Event;
  11258. use Seld\JsonLint\DuplicateKeyException;
  11259. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  11260. use Composer\EventDispatcher\EventDispatcher;
  11261. use Composer\Autoload\AutoloadGenerator;
  11262. use Composer\Package\Version\VersionParser;
  11263. use Composer\Downloader\TransportException;
  11264. use Seld\JsonLint\JsonParser;
  11265. class Factory
  11266. {
  11267. protected static function getHomeDir()
  11268. {
  11269. $home = getenv('COMPOSER_HOME');
  11270. if ($home) {
  11271. return $home;
  11272. }
  11273. if (Platform::isWindows()) {
  11274. if (!getenv('APPDATA')) {
  11275. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  11276. }
  11277. return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
  11278. }
  11279. $userDir = self::getUserDir();
  11280. if (is_dir($userDir . '/.composer')) {
  11281. return $userDir . '/.composer';
  11282. }
  11283. if (self::useXdg()) {
  11284. $xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
  11285. return $xdgConfig . '/composer';
  11286. }
  11287. return $userDir . '/.composer';
  11288. }
  11289. protected static function getCacheDir($home)
  11290. {
  11291. $cacheDir = getenv('COMPOSER_CACHE_DIR');
  11292. if ($cacheDir) {
  11293. return $cacheDir;
  11294. }
  11295. $homeEnv = getenv('COMPOSER_HOME');
  11296. if ($homeEnv) {
  11297. return $homeEnv . '/cache';
  11298. }
  11299. if (Platform::isWindows()) {
  11300. if ($cacheDir = getenv('LOCALAPPDATA')) {
  11301. $cacheDir .= '/Composer';
  11302. } else {
  11303. $cacheDir = $home . '/cache';
  11304. }
  11305. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  11306. }
  11307. $userDir = self::getUserDir();
  11308. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  11309. return $home . '/cache';
  11310. }
  11311. if (self::useXdg()) {
  11312. $xdgCache = getenv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  11313. return $xdgCache . '/composer';
  11314. }
  11315. return $home . '/cache';
  11316. }
  11317. protected static function getDataDir($home)
  11318. {
  11319. $homeEnv = getenv('COMPOSER_HOME');
  11320. if ($homeEnv) {
  11321. return $homeEnv;
  11322. }
  11323. if (Platform::isWindows()) {
  11324. return strtr($home, '\\', '/');
  11325. }
  11326. $userDir = self::getUserDir();
  11327. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  11328. $xdgData = getenv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  11329. return $xdgData . '/composer';
  11330. }
  11331. return $home;
  11332. }
  11333. public static function createConfig(IOInterface $io = null, $cwd = null)
  11334. {
  11335. $cwd = $cwd ?: getcwd();
  11336. $config = new Config(true, $cwd);
  11337. $home = self::getHomeDir();
  11338. $config->merge(array('config' => array(
  11339. 'home' => $home,
  11340. 'cache-dir' => self::getCacheDir($home),
  11341. 'data-dir' => self::getDataDir($home),
  11342. )));
  11343. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  11344. foreach ($dirs as $dir) {
  11345. if (!file_exists($dir . '/.htaccess')) {
  11346. if (!is_dir($dir)) {
  11347. Silencer::call('mkdir', $dir, 0777, true);
  11348. }
  11349. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  11350. }
  11351. }
  11352. $file = new JsonFile($config->get('home').'/config.json');
  11353. if ($file->exists()) {
  11354. if ($io && $io->isDebug()) {
  11355. $io->writeError('Loading config file ' . $file->getPath());
  11356. }
  11357. $config->merge($file->read());
  11358. }
  11359. $config->setConfigSource(new JsonConfigSource($file));
  11360. $file = new JsonFile($config->get('home').'/auth.json');
  11361. if ($file->exists()) {
  11362. if ($io && $io->isDebug()) {
  11363. $io->writeError('Loading config file ' . $file->getPath());
  11364. }
  11365. $config->merge(array('config' => $file->read()));
  11366. }
  11367. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  11368. if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
  11369. $authData = json_decode($composerAuthEnv, true);
  11370. if (is_null($authData)) {
  11371. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  11372. }
  11373. if ($io && $io->isDebug()) {
  11374. $io->writeError('Loading auth config from COMPOSER_AUTH');
  11375. }
  11376. $config->merge(array('config' => $authData));
  11377. }
  11378. return $config;
  11379. }
  11380. public static function getComposerFile()
  11381. {
  11382. return trim(getenv('COMPOSER')) ?: './composer.json';
  11383. }
  11384. public static function createAdditionalStyles()
  11385. {
  11386. return array(
  11387. 'highlight' => new OutputFormatterStyle('red'),
  11388. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  11389. );
  11390. }
  11391. public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  11392. {
  11393. return RepositoryFactory::defaultRepos($io, $config, $rm);
  11394. }
  11395. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true)
  11396. {
  11397. $cwd = $cwd ?: getcwd();
  11398. if (null === $localConfig) {
  11399. $localConfig = static::getComposerFile();
  11400. }
  11401. if (is_string($localConfig)) {
  11402. $composerFile = $localConfig;
  11403. $file = new JsonFile($localConfig, null, $io);
  11404. if (!$file->exists()) {
  11405. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  11406. $message = 'Composer could not find a composer.json file in '.$cwd;
  11407. } else {
  11408. $message = 'Composer could not find the config file: '.$localConfig;
  11409. }
  11410. $instructions = 'To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section';
  11411. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  11412. }
  11413. $file->validateSchema(JsonFile::LAX_SCHEMA);
  11414. $jsonParser = new JsonParser;
  11415. try {
  11416. $jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
  11417. } catch (DuplicateKeyException $e) {
  11418. $details = $e->getDetails();
  11419. $io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
  11420. }
  11421. $localConfig = $file->read();
  11422. }
  11423. $config = static::createConfig($io, $cwd);
  11424. $config->merge($localConfig);
  11425. if (isset($composerFile)) {
  11426. $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
  11427. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  11428. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  11429. if ($localAuthFile->exists()) {
  11430. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  11431. $config->merge(array('config' => $localAuthFile->read()));
  11432. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  11433. }
  11434. }
  11435. $vendorDir = $config->get('vendor-dir');
  11436. $composer = new Composer();
  11437. $composer->setConfig($config);
  11438. if ($fullLoad) {
  11439. $io->loadConfiguration($config);
  11440. }
  11441. $rfs = self::createRemoteFilesystem($io, $config);
  11442. $dispatcher = new EventDispatcher($composer, $io);
  11443. $composer->setEventDispatcher($dispatcher);
  11444. $rm = RepositoryFactory::manager($io, $config, $dispatcher, $rfs);
  11445. $composer->setRepositoryManager($rm);
  11446. $this->addLocalRepository($io, $rm, $vendorDir);
  11447. if (!$fullLoad && !isset($localConfig['version'])) {
  11448. $localConfig['version'] = '1.0.0';
  11449. }
  11450. $parser = new VersionParser;
  11451. $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser);
  11452. $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser);
  11453. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  11454. $composer->setPackage($package);
  11455. $im = $this->createInstallationManager();
  11456. $composer->setInstallationManager($im);
  11457. if ($fullLoad) {
  11458. $dm = $this->createDownloadManager($io, $config, $dispatcher, $rfs);
  11459. $composer->setDownloadManager($dm);
  11460. $generator = new AutoloadGenerator($dispatcher, $io);
  11461. $composer->setAutoloadGenerator($generator);
  11462. }
  11463. $this->createDefaultInstallers($im, $composer, $io);
  11464. if ($fullLoad) {
  11465. $globalComposer = null;
  11466. if (realpath($config->get('home')) !== $cwd) {
  11467. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
  11468. }
  11469. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  11470. $composer->setPluginManager($pm);
  11471. $pm->loadInstalledPlugins();
  11472. }
  11473. if ($fullLoad && isset($composerFile)) {
  11474. $lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  11475. ? substr($composerFile, 0, -4).'lock'
  11476. : $composerFile . '.lock';
  11477. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
  11478. $composer->setLocker($locker);
  11479. }
  11480. if ($fullLoad) {
  11481. $initEvent = new Event(PluginEvents::INIT);
  11482. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  11483. if ($rm->getLocalRepository()) {
  11484. $this->purgePackages($rm->getLocalRepository(), $im);
  11485. }
  11486. }
  11487. return $composer;
  11488. }
  11489. public static function createGlobal(IOInterface $io, $disablePlugins = false)
  11490. {
  11491. $factory = new static();
  11492. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, true);
  11493. }
  11494. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir)
  11495. {
  11496. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io)));
  11497. }
  11498. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, $fullLoad = false)
  11499. {
  11500. $composer = null;
  11501. try {
  11502. $composer = self::createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
  11503. } catch (\Exception $e) {
  11504. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  11505. }
  11506. return $composer;
  11507. }
  11508. public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  11509. {
  11510. $cache = null;
  11511. if ($config->get('cache-files-ttl') > 0) {
  11512. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  11513. }
  11514. $dm = new Downloader\DownloadManager($io);
  11515. switch ($preferred = $config->get('preferred-install')) {
  11516. case 'dist':
  11517. $dm->setPreferDist(true);
  11518. break;
  11519. case 'source':
  11520. $dm->setPreferSource(true);
  11521. break;
  11522. case 'auto':
  11523. default:
  11524. break;
  11525. }
  11526. if (is_array($preferred)) {
  11527. $dm->setPreferences($preferred);
  11528. }
  11529. $executor = new ProcessExecutor($io);
  11530. $fs = new Filesystem($executor);
  11531. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
  11532. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
  11533. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $executor, $fs));
  11534. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
  11535. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
  11536. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  11537. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  11538. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  11539. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  11540. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  11541. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  11542. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  11543. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  11544. return $dm;
  11545. }
  11546. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
  11547. {
  11548. if (null === $dm) {
  11549. $io = new IO\NullIO();
  11550. $io->loadConfiguration($config);
  11551. $dm = $this->createDownloadManager($io, $config);
  11552. }
  11553. $am = new Archiver\ArchiveManager($dm);
  11554. $am->addArchiver(new Archiver\ZipArchiver);
  11555. $am->addArchiver(new Archiver\PharArchiver);
  11556. return $am;
  11557. }
  11558. protected function createPluginManager(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  11559. {
  11560. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  11561. }
  11562. protected function createInstallationManager()
  11563. {
  11564. return new Installer\InstallationManager();
  11565. }
  11566. protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
  11567. {
  11568. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
  11569. $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
  11570. $im->addInstaller(new Installer\PluginInstaller($io, $composer));
  11571. $im->addInstaller(new Installer\MetapackageInstaller($io));
  11572. }
  11573. protected function purgePackages(WritableRepositoryInterface $repo, Installer\InstallationManager $im)
  11574. {
  11575. foreach ($repo->getPackages() as $package) {
  11576. if (!$im->isPackageInstalled($repo, $package)) {
  11577. $repo->removePackage($package);
  11578. }
  11579. }
  11580. }
  11581. public static function create(IOInterface $io, $config = null, $disablePlugins = false)
  11582. {
  11583. $factory = new static();
  11584. return $factory->createComposer($io, $config, $disablePlugins);
  11585. }
  11586. public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
  11587. {
  11588. static $warned = false;
  11589. $disableTls = false;
  11590. if ($config && $config->get('disable-tls') === true) {
  11591. if (!$warned) {
  11592. $io->write('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  11593. }
  11594. $warned = true;
  11595. $disableTls = true;
  11596. } elseif (!extension_loaded('openssl')) {
  11597. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  11598. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  11599. }
  11600. $remoteFilesystemOptions = array();
  11601. if ($disableTls === false) {
  11602. if ($config && $config->get('cafile')) {
  11603. $remoteFilesystemOptions['ssl']['cafile'] = $config->get('cafile');
  11604. }
  11605. if ($config && $config->get('capath')) {
  11606. $remoteFilesystemOptions['ssl']['capath'] = $config->get('capath');
  11607. }
  11608. $remoteFilesystemOptions = array_replace_recursive($remoteFilesystemOptions, $options);
  11609. }
  11610. try {
  11611. $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
  11612. } catch (TransportException $e) {
  11613. if (false !== strpos($e->getMessage(), 'cafile')) {
  11614. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  11615. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  11616. if (PHP_VERSION_ID < 50600) {
  11617. $io->write('<error>It is recommended you upgrade to PHP 5.6+ which can detect your system CA file automatically.</error>');
  11618. }
  11619. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  11620. }
  11621. throw $e;
  11622. }
  11623. return $remoteFilesystem;
  11624. }
  11625. private static function useXdg()
  11626. {
  11627. foreach (array_keys($_SERVER) as $key) {
  11628. if (substr($key, 0, 4) === 'XDG_') {
  11629. return true;
  11630. }
  11631. }
  11632. return false;
  11633. }
  11634. private static function getUserDir()
  11635. {
  11636. $home = getenv('HOME');
  11637. if (!$home) {
  11638. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  11639. }
  11640. return rtrim(strtr($home, '\\', '/'), '/');
  11641. }
  11642. }
  11643. <?php
  11644. namespace Composer\IO;
  11645. use Composer\Config;
  11646. use Composer\Util\ProcessExecutor;
  11647. use Psr\Log\LoggerInterface;
  11648. use Psr\Log\LogLevel;
  11649. abstract class BaseIO implements IOInterface, LoggerInterface
  11650. {
  11651. protected $authentications = array();
  11652. public function getAuthentications()
  11653. {
  11654. return $this->authentications;
  11655. }
  11656. public function hasAuthentication($repositoryName)
  11657. {
  11658. return isset($this->authentications[$repositoryName]);
  11659. }
  11660. public function getAuthentication($repositoryName)
  11661. {
  11662. if (isset($this->authentications[$repositoryName])) {
  11663. return $this->authentications[$repositoryName];
  11664. }
  11665. return array('username' => null, 'password' => null);
  11666. }
  11667. public function setAuthentication($repositoryName, $username, $password = null)
  11668. {
  11669. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  11670. }
  11671. protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
  11672. {
  11673. if ($this->hasAuthentication($repositoryName)) {
  11674. $auth = $this->getAuthentication($repositoryName);
  11675. if ($auth['username'] === $username && $auth['password'] === $password) {
  11676. return;
  11677. }
  11678. $this->writeError(
  11679. sprintf(
  11680. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  11681. $repositoryName
  11682. )
  11683. );
  11684. }
  11685. $this->setAuthentication($repositoryName, $username, $password);
  11686. }
  11687. public function loadConfiguration(Config $config)
  11688. {
  11689. $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
  11690. $githubOauth = $config->get('github-oauth') ?: array();
  11691. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  11692. $httpBasic = $config->get('http-basic') ?: array();
  11693. foreach ($bitbucketOauth as $domain => $cred) {
  11694. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  11695. }
  11696. foreach ($githubOauth as $domain => $token) {
  11697. if (!preg_match('{^[a-z0-9]+$}', $token)) {
  11698. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  11699. }
  11700. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  11701. }
  11702. foreach ($gitlabOauth as $domain => $token) {
  11703. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  11704. }
  11705. foreach ($httpBasic as $domain => $cred) {
  11706. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  11707. }
  11708. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  11709. }
  11710. public function emergency($message, array $context = array())
  11711. {
  11712. return $this->log(LogLevel::EMERGENCY, $message, $context);
  11713. }
  11714. public function alert($message, array $context = array())
  11715. {
  11716. return $this->log(LogLevel::ALERT, $message, $context);
  11717. }
  11718. public function critical($message, array $context = array())
  11719. {
  11720. return $this->log(LogLevel::CRITICAL, $message, $context);
  11721. }
  11722. public function error($message, array $context = array())
  11723. {
  11724. return $this->log(LogLevel::ERROR, $message, $context);
  11725. }
  11726. public function warning($message, array $context = array())
  11727. {
  11728. return $this->log(LogLevel::WARNING, $message, $context);
  11729. }
  11730. public function notice($message, array $context = array())
  11731. {
  11732. return $this->log(LogLevel::NOTICE, $message, $context);
  11733. }
  11734. public function info($message, array $context = array())
  11735. {
  11736. return $this->log(LogLevel::INFO, $message, $context);
  11737. }
  11738. public function debug($message, array $context = array())
  11739. {
  11740. return $this->log(LogLevel::DEBUG, $message, $context);
  11741. }
  11742. public function log($level, $message, array $context = array())
  11743. {
  11744. if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
  11745. $this->writeError('<error>'.$message.'</error>', true, self::NORMAL);
  11746. } elseif ($level === LogLevel::WARNING) {
  11747. $this->writeError('<warning>'.$message.'</warning>', true, self::NORMAL);
  11748. } elseif ($level === LogLevel::NOTICE) {
  11749. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  11750. } elseif ($level === LogLevel::INFO) {
  11751. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  11752. } else {
  11753. $this->writeError($message, true, self::DEBUG);
  11754. }
  11755. }
  11756. }
  11757. <?php
  11758. namespace Composer\IO;
  11759. use Symfony\Component\Console\Output\StreamOutput;
  11760. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  11761. use Symfony\Component\Console\Input\StringInput;
  11762. use Symfony\Component\Console\Helper\HelperSet;
  11763. class BufferIO extends ConsoleIO
  11764. {
  11765. public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
  11766. {
  11767. $input = new StringInput($input);
  11768. $input->setInteractive(false);
  11769. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  11770. parent::__construct($input, $output, new HelperSet(array()));
  11771. }
  11772. public function getOutput()
  11773. {
  11774. fseek($this->output->getStream(), 0);
  11775. $output = stream_get_contents($this->output->getStream());
  11776. $output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
  11777. $pre = strip_tags($matches[1]);
  11778. if (strlen($pre) === strlen($matches[2])) {
  11779. return '';
  11780. }
  11781. return rtrim($matches[1])."\n";
  11782. }, $output);
  11783. return $output;
  11784. }
  11785. }
  11786. <?php
  11787. namespace Composer\IO;
  11788. use Symfony\Component\Console\Input\InputInterface;
  11789. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  11790. use Symfony\Component\Console\Output\OutputInterface;
  11791. use Symfony\Component\Console\Helper\HelperSet;
  11792. use Symfony\Component\Console\Question\ConfirmationQuestion;
  11793. use Symfony\Component\Console\Question\Question;
  11794. class ConsoleIO extends BaseIO
  11795. {
  11796. protected $input;
  11797. protected $output;
  11798. protected $helperSet;
  11799. protected $lastMessage;
  11800. protected $lastMessageErr;
  11801. private $startTime;
  11802. private $verbosityMap;
  11803. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  11804. {
  11805. $this->input = $input;
  11806. $this->output = $output;
  11807. $this->helperSet = $helperSet;
  11808. $this->verbosityMap = array(
  11809. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  11810. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  11811. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  11812. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  11813. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  11814. );
  11815. }
  11816. public function enableDebugging($startTime)
  11817. {
  11818. $this->startTime = $startTime;
  11819. }
  11820. public function isInteractive()
  11821. {
  11822. return $this->input->isInteractive();
  11823. }
  11824. public function isDecorated()
  11825. {
  11826. return $this->output->isDecorated();
  11827. }
  11828. public function isVerbose()
  11829. {
  11830. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
  11831. }
  11832. public function isVeryVerbose()
  11833. {
  11834. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
  11835. }
  11836. public function isDebug()
  11837. {
  11838. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
  11839. }
  11840. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  11841. {
  11842. $this->doWrite($messages, $newline, false, $verbosity);
  11843. }
  11844. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  11845. {
  11846. $this->doWrite($messages, $newline, true, $verbosity);
  11847. }
  11848. private function doWrite($messages, $newline, $stderr, $verbosity)
  11849. {
  11850. $sfVerbosity = $this->verbosityMap[$verbosity];
  11851. if ($sfVerbosity > $this->output->getVerbosity()) {
  11852. return;
  11853. }
  11854. if (OutputInterface::VERBOSITY_QUIET === 0) {
  11855. $sfVerbosity = OutputInterface::OUTPUT_NORMAL;
  11856. }
  11857. if (null !== $this->startTime) {
  11858. $memoryUsage = memory_get_usage() / 1024 / 1024;
  11859. $timeSpent = microtime(true) - $this->startTime;
  11860. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
  11861. return sprintf('[%.1fMB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  11862. }, (array) $messages);
  11863. }
  11864. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  11865. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  11866. $this->lastMessageErr = join($newline ? "\n" : '', (array) $messages);
  11867. return;
  11868. }
  11869. $this->output->write($messages, $newline, $sfVerbosity);
  11870. $this->lastMessage = join($newline ? "\n" : '', (array) $messages);
  11871. }
  11872. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  11873. {
  11874. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  11875. }
  11876. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  11877. {
  11878. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  11879. }
  11880. private function doOverwrite($messages, $newline, $size, $stderr, $verbosity)
  11881. {
  11882. $messages = join($newline ? "\n" : '', (array) $messages);
  11883. if (!isset($size)) {
  11884. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  11885. }
  11886. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  11887. $this->doWrite($messages, false, $stderr, $verbosity);
  11888. $fill = $size - strlen(strip_tags($messages));
  11889. if ($fill > 0) {
  11890. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  11891. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  11892. }
  11893. if ($newline) {
  11894. $this->doWrite('', true, $stderr, $verbosity);
  11895. }
  11896. if ($stderr) {
  11897. $this->lastMessageErr = $messages;
  11898. } else {
  11899. $this->lastMessage = $messages;
  11900. }
  11901. }
  11902. public function ask($question, $default = null)
  11903. {
  11904. $helper = $this->helperSet->get('question');
  11905. $question = new Question($question, $default);
  11906. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  11907. }
  11908. public function askConfirmation($question, $default = true)
  11909. {
  11910. $helper = $this->helperSet->get('question');
  11911. $question = new ConfirmationQuestion($question, $default);
  11912. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  11913. }
  11914. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  11915. {
  11916. $helper = $this->helperSet->get('question');
  11917. $question = new Question($question, $default);
  11918. $question->setValidator($validator);
  11919. $question->setMaxAttempts($attempts);
  11920. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  11921. }
  11922. public function askAndHideAnswer($question)
  11923. {
  11924. $this->writeError($question, false);
  11925. return \Seld\CliPrompt\CliPrompt::hiddenPrompt(true);
  11926. }
  11927. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  11928. {
  11929. if ($this->isInteractive()) {
  11930. return $this->helperSet->get('dialog')->select($this->getErrorOutput(), $question, $choices, $default, $attempts, $errorMessage, $multiselect);
  11931. }
  11932. return $default;
  11933. }
  11934. private function getErrorOutput()
  11935. {
  11936. if ($this->output instanceof ConsoleOutputInterface) {
  11937. return $this->output->getErrorOutput();
  11938. }
  11939. return $this->output;
  11940. }
  11941. }
  11942. <?php
  11943. namespace Composer\IO;
  11944. use Composer\Config;
  11945. interface IOInterface
  11946. {
  11947. const QUIET = 1;
  11948. const NORMAL = 2;
  11949. const VERBOSE = 4;
  11950. const VERY_VERBOSE = 8;
  11951. const DEBUG = 16;
  11952. public function isInteractive();
  11953. public function isVerbose();
  11954. public function isVeryVerbose();
  11955. public function isDebug();
  11956. public function isDecorated();
  11957. public function write($messages, $newline = true, $verbosity = self::NORMAL);
  11958. public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
  11959. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  11960. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  11961. public function ask($question, $default = null);
  11962. public function askConfirmation($question, $default = true);
  11963. public function askAndValidate($question, $validator, $attempts = null, $default = null);
  11964. public function askAndHideAnswer($question);
  11965. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
  11966. public function getAuthentications();
  11967. public function hasAuthentication($repositoryName);
  11968. public function getAuthentication($repositoryName);
  11969. public function setAuthentication($repositoryName, $username, $password = null);
  11970. public function loadConfiguration(Config $config);
  11971. }
  11972. <?php
  11973. namespace Composer\IO;
  11974. class NullIO extends BaseIO
  11975. {
  11976. public function isInteractive()
  11977. {
  11978. return false;
  11979. }
  11980. public function isVerbose()
  11981. {
  11982. return false;
  11983. }
  11984. public function isVeryVerbose()
  11985. {
  11986. return false;
  11987. }
  11988. public function isDebug()
  11989. {
  11990. return false;
  11991. }
  11992. public function isDecorated()
  11993. {
  11994. return false;
  11995. }
  11996. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  11997. {
  11998. }
  11999. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  12000. {
  12001. }
  12002. public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  12003. {
  12004. }
  12005. public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  12006. {
  12007. }
  12008. public function ask($question, $default = null)
  12009. {
  12010. return $default;
  12011. }
  12012. public function askConfirmation($question, $default = true)
  12013. {
  12014. return $default;
  12015. }
  12016. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  12017. {
  12018. return $default;
  12019. }
  12020. public function askAndHideAnswer($question)
  12021. {
  12022. return null;
  12023. }
  12024. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  12025. {
  12026. return $default;
  12027. }
  12028. }
  12029. <?php
  12030. namespace Composer;
  12031. use Composer\Autoload\AutoloadGenerator;
  12032. use Composer\DependencyResolver\DefaultPolicy;
  12033. use Composer\DependencyResolver\Operation\UpdateOperation;
  12034. use Composer\DependencyResolver\Operation\InstallOperation;
  12035. use Composer\DependencyResolver\Operation\UninstallOperation;
  12036. use Composer\DependencyResolver\Operation\OperationInterface;
  12037. use Composer\DependencyResolver\PolicyInterface;
  12038. use Composer\DependencyResolver\Pool;
  12039. use Composer\DependencyResolver\Request;
  12040. use Composer\DependencyResolver\Rule;
  12041. use Composer\DependencyResolver\Solver;
  12042. use Composer\DependencyResolver\SolverProblemsException;
  12043. use Composer\Downloader\DownloadManager;
  12044. use Composer\EventDispatcher\EventDispatcher;
  12045. use Composer\Installer\InstallationManager;
  12046. use Composer\Installer\InstallerEvents;
  12047. use Composer\Installer\NoopInstaller;
  12048. use Composer\Installer\SuggestedPackagesReporter;
  12049. use Composer\IO\IOInterface;
  12050. use Composer\Package\AliasPackage;
  12051. use Composer\Package\CompletePackage;
  12052. use Composer\Package\Link;
  12053. use Composer\Package\Loader\ArrayLoader;
  12054. use Composer\Package\Dumper\ArrayDumper;
  12055. use Composer\Semver\Constraint\Constraint;
  12056. use Composer\Package\Locker;
  12057. use Composer\Package\PackageInterface;
  12058. use Composer\Package\RootPackageInterface;
  12059. use Composer\Repository\CompositeRepository;
  12060. use Composer\Repository\InstalledArrayRepository;
  12061. use Composer\Repository\PlatformRepository;
  12062. use Composer\Repository\RepositoryInterface;
  12063. use Composer\Repository\RepositoryManager;
  12064. use Composer\Repository\WritableRepositoryInterface;
  12065. use Composer\Script\ScriptEvents;
  12066. class Installer
  12067. {
  12068. protected $io;
  12069. protected $config;
  12070. protected $package;
  12071. protected $downloadManager;
  12072. protected $repositoryManager;
  12073. protected $locker;
  12074. protected $installationManager;
  12075. protected $eventDispatcher;
  12076. protected $autoloadGenerator;
  12077. protected $preferSource = false;
  12078. protected $preferDist = false;
  12079. protected $optimizeAutoloader = false;
  12080. protected $classMapAuthoritative = false;
  12081. protected $devMode = false;
  12082. protected $dryRun = false;
  12083. protected $verbose = false;
  12084. protected $update = false;
  12085. protected $dumpAutoloader = true;
  12086. protected $runScripts = true;
  12087. protected $ignorePlatformReqs = false;
  12088. protected $preferStable = false;
  12089. protected $preferLowest = false;
  12090. protected $skipSuggest = false;
  12091. protected $updateWhitelist = null;
  12092. protected $whitelistDependencies = false;
  12093. protected $suggestedPackagesReporter;
  12094. protected $additionalInstalledRepository;
  12095. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  12096. {
  12097. $this->io = $io;
  12098. $this->config = $config;
  12099. $this->package = $package;
  12100. $this->downloadManager = $downloadManager;
  12101. $this->repositoryManager = $repositoryManager;
  12102. $this->locker = $locker;
  12103. $this->installationManager = $installationManager;
  12104. $this->eventDispatcher = $eventDispatcher;
  12105. $this->autoloadGenerator = $autoloadGenerator;
  12106. }
  12107. public function run()
  12108. {
  12109. gc_collect_cycles();
  12110. gc_disable();
  12111. if (!$this->update && !$this->locker->isLocked()) {
  12112. $this->update = true;
  12113. }
  12114. if ($this->dryRun) {
  12115. $this->verbose = true;
  12116. $this->runScripts = false;
  12117. $this->installationManager->addInstaller(new NoopInstaller);
  12118. $this->mockLocalRepositories($this->repositoryManager);
  12119. }
  12120. if ($this->runScripts) {
  12121. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  12122. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  12123. }
  12124. $this->downloadManager->setPreferSource($this->preferSource);
  12125. $this->downloadManager->setPreferDist($this->preferDist);
  12126. $localRepo = $this->repositoryManager->getLocalRepository();
  12127. if ($this->update) {
  12128. $platformOverrides = $this->config->get('platform') ?: array();
  12129. } else {
  12130. $platformOverrides = $this->locker->getPlatformOverrides();
  12131. }
  12132. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  12133. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  12134. $aliases = $this->getRootAliases();
  12135. $this->aliasPlatformPackages($platformRepo, $aliases);
  12136. if (!$this->suggestedPackagesReporter) {
  12137. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  12138. }
  12139. try {
  12140. list($res, $devPackages) = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases);
  12141. if ($res !== 0) {
  12142. return $res;
  12143. }
  12144. } catch (\Exception $e) {
  12145. if (!$this->dryRun) {
  12146. $this->installationManager->notifyInstalls($this->io);
  12147. }
  12148. throw $e;
  12149. }
  12150. if (!$this->dryRun) {
  12151. $this->installationManager->notifyInstalls($this->io);
  12152. }
  12153. if ($this->devMode && !$this->skipSuggest) {
  12154. $this->suggestedPackagesReporter->output($installedRepo);
  12155. }
  12156. foreach ($localRepo->getPackages() as $package) {
  12157. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  12158. continue;
  12159. }
  12160. $replacement = (is_string($package->getReplacementPackage()))
  12161. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  12162. : 'No replacement was suggested';
  12163. $this->io->writeError(
  12164. sprintf(
  12165. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  12166. $package->getPrettyName(),
  12167. $replacement
  12168. )
  12169. );
  12170. }
  12171. if (!$this->dryRun) {
  12172. if ($this->update) {
  12173. $localRepo->reload();
  12174. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  12175. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  12176. $updatedLock = $this->locker->setLockData(
  12177. array_diff($localRepo->getCanonicalPackages(), $devPackages),
  12178. $devPackages,
  12179. $platformReqs,
  12180. $platformDevReqs,
  12181. $aliases,
  12182. $this->package->getMinimumStability(),
  12183. $this->package->getStabilityFlags(),
  12184. $this->preferStable || $this->package->getPreferStable(),
  12185. $this->preferLowest,
  12186. $this->config->get('platform') ?: array()
  12187. );
  12188. if ($updatedLock) {
  12189. $this->io->writeError('<info>Writing lock file</info>');
  12190. }
  12191. }
  12192. if ($this->dumpAutoloader) {
  12193. if ($this->optimizeAutoloader) {
  12194. $this->io->writeError('<info>Generating optimized autoload files</info>');
  12195. } else {
  12196. $this->io->writeError('<info>Generating autoload files</info>');
  12197. }
  12198. $this->autoloadGenerator->setDevMode($this->devMode);
  12199. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  12200. $this->autoloadGenerator->setRunScripts($this->runScripts);
  12201. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  12202. }
  12203. if ($this->runScripts) {
  12204. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  12205. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  12206. }
  12207. foreach ($localRepo->getPackages() as $package) {
  12208. $this->installationManager->ensureBinariesPresence($package);
  12209. }
  12210. $vendorDir = $this->config->get('vendor-dir');
  12211. if (is_dir($vendorDir)) {
  12212. @touch($vendorDir);
  12213. }
  12214. }
  12215. if (!defined('HHVM_VERSION')) {
  12216. gc_enable();
  12217. }
  12218. return 0;
  12219. }
  12220. protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases)
  12221. {
  12222. $lockedRepository = null;
  12223. $repositories = null;
  12224. if (!$this->update || (!empty($this->updateWhitelist) && $this->locker->isLocked())) {
  12225. try {
  12226. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  12227. } catch (\RuntimeException $e) {
  12228. if ($this->package->getDevRequires()) {
  12229. throw $e;
  12230. }
  12231. $lockedRepository = $this->locker->getLockedRepository();
  12232. }
  12233. }
  12234. $this->whitelistUpdateDependencies(
  12235. $localRepo,
  12236. $this->package->getRequires(),
  12237. $this->package->getDevRequires()
  12238. );
  12239. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  12240. $policy = $this->createPolicy();
  12241. $pool = $this->createPool($this->update ? null : $lockedRepository);
  12242. $pool->addRepository($installedRepo, $aliases);
  12243. if ($this->update) {
  12244. $repositories = $this->repositoryManager->getRepositories();
  12245. foreach ($repositories as $repository) {
  12246. $pool->addRepository($repository, $aliases);
  12247. }
  12248. }
  12249. if ($lockedRepository) {
  12250. $pool->addRepository($lockedRepository, $aliases);
  12251. }
  12252. $request = $this->createRequest($this->package, $platformRepo);
  12253. if ($this->update) {
  12254. $removedUnstablePackages = array();
  12255. foreach ($localRepo->getPackages() as $package) {
  12256. if (
  12257. !$pool->isPackageAcceptable($package->getNames(), $package->getStability())
  12258. && $this->installationManager->isPackageInstalled($localRepo, $package)
  12259. ) {
  12260. $removedUnstablePackages[$package->getName()] = true;
  12261. $request->remove($package->getName(), new Constraint('=', $package->getVersion()));
  12262. }
  12263. }
  12264. $this->io->writeError('<info>Updating dependencies'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  12265. $request->updateAll();
  12266. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  12267. foreach ($links as $link) {
  12268. $request->install($link->getTarget(), $link->getConstraint());
  12269. }
  12270. if ($this->updateWhitelist) {
  12271. $currentPackages = $this->getCurrentPackages($installedRepo);
  12272. $candidates = array();
  12273. foreach ($links as $link) {
  12274. $candidates[$link->getTarget()] = true;
  12275. $rootRequires[$link->getTarget()] = $link;
  12276. }
  12277. foreach ($currentPackages as $package) {
  12278. $candidates[$package->getName()] = true;
  12279. }
  12280. foreach ($candidates as $candidate => $dummy) {
  12281. foreach ($currentPackages as $curPackage) {
  12282. if ($curPackage->getName() === $candidate) {
  12283. if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
  12284. $constraint = new Constraint('=', $curPackage->getVersion());
  12285. $description = $this->locker->isLocked() ? '(locked at' : '(installed at';
  12286. $requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : '';
  12287. $constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')');
  12288. $request->install($curPackage->getName(), $constraint);
  12289. }
  12290. break;
  12291. }
  12292. }
  12293. }
  12294. }
  12295. } else {
  12296. $this->io->writeError('<info>Installing dependencies'.($this->devMode ? ' (including require-dev)' : '').' from lock file</info>');
  12297. if (!$this->locker->isFresh()) {
  12298. $this->io->writeError('<warning>Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.</warning>', true, IOInterface::QUIET);
  12299. }
  12300. foreach ($lockedRepository->getPackages() as $package) {
  12301. $version = $package->getVersion();
  12302. if (isset($aliases[$package->getName()][$version])) {
  12303. $version = $aliases[$package->getName()][$version]['alias_normalized'];
  12304. }
  12305. $constraint = new Constraint('=', $version);
  12306. $constraint->setPrettyString($package->getPrettyVersion());
  12307. $request->install($package->getName(), $constraint);
  12308. }
  12309. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  12310. $request->install($link->getTarget(), $link->getConstraint());
  12311. }
  12312. }
  12313. $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-links');
  12314. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
  12315. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  12316. try {
  12317. $operations = $solver->solve($request, $this->ignorePlatformReqs);
  12318. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
  12319. } catch (SolverProblemsException $e) {
  12320. $this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>', true, IOInterface::QUIET);
  12321. $this->io->writeError($e->getMessage());
  12322. return array(max(1, $e->getCode()), array());
  12323. }
  12324. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  12325. $this->io->writeError("Analyzed ".$solver->getRuleSetSize()." rules to resolve dependencies", true, IOInterface::VERBOSE);
  12326. $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-updates', $operations);
  12327. if (!$operations) {
  12328. $this->io->writeError('Nothing to install or update');
  12329. }
  12330. $operations = $this->movePluginsToFront($operations);
  12331. $operations = $this->moveUninstallsToFront($operations);
  12332. if ($this->update) {
  12333. $devPackages = $this->extractDevPackages($operations, $localRepo, $platformRepo, $aliases);
  12334. if (!$this->devMode) {
  12335. $operations = $this->filterDevPackageOperations($devPackages, $operations, $localRepo);
  12336. }
  12337. } else {
  12338. $devPackages = null;
  12339. }
  12340. foreach ($operations as $operation) {
  12341. if ('install' === $operation->getJobType()) {
  12342. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  12343. }
  12344. if ($this->update) {
  12345. $package = null;
  12346. if ('update' === $operation->getJobType()) {
  12347. $package = $operation->getTargetPackage();
  12348. } elseif ('install' === $operation->getJobType()) {
  12349. $package = $operation->getPackage();
  12350. }
  12351. if ($package && $package->isDev()) {
  12352. $references = $this->package->getReferences();
  12353. if (isset($references[$package->getName()])) {
  12354. $this->updateInstallReferences($package, $references[$package->getName()]);
  12355. }
  12356. }
  12357. if ('update' === $operation->getJobType()
  12358. && $operation->getTargetPackage()->isDev()
  12359. && $operation->getTargetPackage()->getVersion() === $operation->getInitialPackage()->getVersion()
  12360. && (!$operation->getTargetPackage()->getSourceReference() || $operation->getTargetPackage()->getSourceReference() === $operation->getInitialPackage()->getSourceReference())
  12361. && (!$operation->getTargetPackage()->getDistReference() || $operation->getTargetPackage()->getDistReference() === $operation->getInitialPackage()->getDistReference())
  12362. ) {
  12363. $this->io->writeError(' - Skipping update of '. $operation->getTargetPackage()->getPrettyName().' to the same reference-locked version', true, IOInterface::DEBUG);
  12364. $this->io->writeError('', true, IOInterface::DEBUG);
  12365. continue;
  12366. }
  12367. }
  12368. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($operation->getJobType());
  12369. if (defined($event) && $this->runScripts) {
  12370. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  12371. }
  12372. if ($this->dryRun && false === strpos($operation->getJobType(), 'Alias')) {
  12373. $this->io->writeError(' - ' . $operation);
  12374. $this->io->writeError('');
  12375. } elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
  12376. $this->io->writeError(' - ' . $operation);
  12377. $this->io->writeError('');
  12378. }
  12379. $this->installationManager->execute($localRepo, $operation);
  12380. if ($this->verbose && $this->io->isVeryVerbose() && in_array($operation->getJobType(), array('install', 'update'))) {
  12381. $reason = $operation->getReason();
  12382. if ($reason instanceof Rule) {
  12383. switch ($reason->getReason()) {
  12384. case Rule::RULE_JOB_INSTALL:
  12385. $this->io->writeError(' REASON: Required by the root package: '.$reason->getPrettyString($pool));
  12386. $this->io->writeError('');
  12387. break;
  12388. case Rule::RULE_PACKAGE_REQUIRES:
  12389. $this->io->writeError(' REASON: '.$reason->getPrettyString($pool));
  12390. $this->io->writeError('');
  12391. break;
  12392. }
  12393. }
  12394. }
  12395. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($operation->getJobType());
  12396. if (defined($event) && $this->runScripts) {
  12397. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  12398. }
  12399. if (!$this->dryRun) {
  12400. $localRepo->write();
  12401. }
  12402. }
  12403. if (!$this->dryRun) {
  12404. $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
  12405. $localRepo->write();
  12406. }
  12407. return array(0, $devPackages);
  12408. }
  12409. private function extractDevPackages(array $operations, RepositoryInterface $localRepo, PlatformRepository $platformRepo, array $aliases)
  12410. {
  12411. if (!$this->package->getDevRequires()) {
  12412. return array();
  12413. }
  12414. $tempLocalRepo = clone $localRepo;
  12415. foreach ($operations as $operation) {
  12416. switch ($operation->getJobType()) {
  12417. case 'install':
  12418. case 'markAliasInstalled':
  12419. if (!$tempLocalRepo->hasPackage($operation->getPackage())) {
  12420. $tempLocalRepo->addPackage(clone $operation->getPackage());
  12421. }
  12422. break;
  12423. case 'uninstall':
  12424. case 'markAliasUninstalled':
  12425. $tempLocalRepo->removePackage($operation->getPackage());
  12426. break;
  12427. case 'update':
  12428. $tempLocalRepo->removePackage($operation->getInitialPackage());
  12429. if (!$tempLocalRepo->hasPackage($operation->getTargetPackage())) {
  12430. $tempLocalRepo->addPackage(clone $operation->getTargetPackage());
  12431. }
  12432. break;
  12433. default:
  12434. throw new \LogicException('Unknown type: '.$operation->getJobType());
  12435. }
  12436. }
  12437. $localRepo = new InstalledArrayRepository(array());
  12438. $loader = new ArrayLoader(null, true);
  12439. $dumper = new ArrayDumper();
  12440. foreach ($tempLocalRepo->getCanonicalPackages() as $pkg) {
  12441. $localRepo->addPackage($loader->load($dumper->dump($pkg)));
  12442. }
  12443. unset($tempLocalRepo, $loader, $dumper);
  12444. $policy = $this->createPolicy();
  12445. $pool = $this->createPool();
  12446. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  12447. $pool->addRepository($installedRepo, $aliases);
  12448. $request = $this->createRequest($this->package, $platformRepo);
  12449. $request->updateAll();
  12450. foreach ($this->package->getRequires() as $link) {
  12451. $request->install($link->getTarget(), $link->getConstraint());
  12452. }
  12453. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
  12454. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  12455. $ops = $solver->solve($request, $this->ignorePlatformReqs);
  12456. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
  12457. $devPackages = array();
  12458. foreach ($ops as $op) {
  12459. if ($op->getJobType() === 'uninstall') {
  12460. $devPackages[] = $op->getPackage();
  12461. }
  12462. }
  12463. return $devPackages;
  12464. }
  12465. private function filterDevPackageOperations(array $devPackages, array $operations, RepositoryInterface $localRepo)
  12466. {
  12467. $finalOps = array();
  12468. $packagesToSkip = array();
  12469. foreach ($devPackages as $pkg) {
  12470. $packagesToSkip[$pkg->getName()] = true;
  12471. if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
  12472. $finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
  12473. }
  12474. }
  12475. foreach ($operations as $op) {
  12476. $package = $op->getJobType() === 'update' ? $op->getTargetPackage() : $op->getPackage();
  12477. if (isset($packagesToSkip[$package->getName()])) {
  12478. continue;
  12479. }
  12480. $finalOps[] = $op;
  12481. }
  12482. return $finalOps;
  12483. }
  12484. private function movePluginsToFront(array $operations)
  12485. {
  12486. $installerOps = array();
  12487. foreach ($operations as $idx => $op) {
  12488. if ($op instanceof InstallOperation) {
  12489. $package = $op->getPackage();
  12490. } elseif ($op instanceof UpdateOperation) {
  12491. $package = $op->getTargetPackage();
  12492. } else {
  12493. continue;
  12494. }
  12495. if ($package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer') {
  12496. $requires = array_keys($package->getRequires());
  12497. foreach ($requires as $index => $req) {
  12498. if ($req === 'composer-plugin-api' || preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  12499. unset($requires[$index]);
  12500. }
  12501. }
  12502. if (!count($requires)) {
  12503. $installerOps[] = $op;
  12504. unset($operations[$idx]);
  12505. }
  12506. }
  12507. }
  12508. return array_merge($installerOps, $operations);
  12509. }
  12510. private function moveUninstallsToFront(array $operations)
  12511. {
  12512. $uninstOps = array();
  12513. foreach ($operations as $idx => $op) {
  12514. if ($op instanceof UninstallOperation) {
  12515. $uninstOps[] = $op;
  12516. unset($operations[$idx]);
  12517. }
  12518. }
  12519. return array_merge($uninstOps, $operations);
  12520. }
  12521. private function createInstalledRepo(RepositoryInterface $localRepo, PlatformRepository $platformRepo)
  12522. {
  12523. $installedRootPackage = clone $this->package;
  12524. $installedRootPackage->setRequires(array());
  12525. $installedRootPackage->setDevRequires(array());
  12526. $repos = array(
  12527. $localRepo,
  12528. new InstalledArrayRepository(array($installedRootPackage)),
  12529. $platformRepo,
  12530. );
  12531. $installedRepo = new CompositeRepository($repos);
  12532. if ($this->additionalInstalledRepository) {
  12533. $installedRepo->addRepository($this->additionalInstalledRepository);
  12534. }
  12535. return $installedRepo;
  12536. }
  12537. private function createPool(RepositoryInterface $lockedRepository = null)
  12538. {
  12539. if ($this->update) {
  12540. $minimumStability = $this->package->getMinimumStability();
  12541. $stabilityFlags = $this->package->getStabilityFlags();
  12542. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  12543. } else {
  12544. $minimumStability = $this->locker->getMinimumStability();
  12545. $stabilityFlags = $this->locker->getStabilityFlags();
  12546. $requires = array();
  12547. foreach ($lockedRepository->getPackages() as $package) {
  12548. $constraint = new Constraint('=', $package->getVersion());
  12549. $constraint->setPrettyString($package->getPrettyVersion());
  12550. $requires[$package->getName()] = $constraint;
  12551. }
  12552. }
  12553. $rootConstraints = array();
  12554. foreach ($requires as $req => $constraint) {
  12555. if ($this->ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  12556. continue;
  12557. }
  12558. if ($constraint instanceof Link) {
  12559. $rootConstraints[$req] = $constraint->getConstraint();
  12560. } else {
  12561. $rootConstraints[$req] = $constraint;
  12562. }
  12563. }
  12564. return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
  12565. }
  12566. private function createPolicy()
  12567. {
  12568. $preferStable = null;
  12569. $preferLowest = null;
  12570. if (!$this->update) {
  12571. $preferStable = $this->locker->getPreferStable();
  12572. $preferLowest = $this->locker->getPreferLowest();
  12573. }
  12574. if (null === $preferStable) {
  12575. $preferStable = $this->preferStable || $this->package->getPreferStable();
  12576. }
  12577. if (null === $preferLowest) {
  12578. $preferLowest = $this->preferLowest;
  12579. }
  12580. return new DefaultPolicy($preferStable, $preferLowest);
  12581. }
  12582. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
  12583. {
  12584. $request = new Request();
  12585. $constraint = new Constraint('=', $rootPackage->getVersion());
  12586. $constraint->setPrettyString($rootPackage->getPrettyVersion());
  12587. $request->install($rootPackage->getName(), $constraint);
  12588. $fixedPackages = $platformRepo->getPackages();
  12589. if ($this->additionalInstalledRepository) {
  12590. $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
  12591. $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
  12592. }
  12593. $provided = $rootPackage->getProvides();
  12594. foreach ($fixedPackages as $package) {
  12595. $constraint = new Constraint('=', $package->getVersion());
  12596. $constraint->setPrettyString($package->getPrettyVersion());
  12597. if ($package->getRepository() !== $platformRepo
  12598. || !isset($provided[$package->getName()])
  12599. || !$provided[$package->getName()]->getConstraint()->matches($constraint)
  12600. ) {
  12601. $request->fix($package->getName(), $constraint);
  12602. }
  12603. }
  12604. return $request;
  12605. }
  12606. private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $task, array $operations = null)
  12607. {
  12608. if ($task === 'force-updates' && null === $operations) {
  12609. throw new \InvalidArgumentException('Missing operations argument');
  12610. }
  12611. if ($task === 'force-links') {
  12612. $operations = array();
  12613. }
  12614. if ($this->update && $this->updateWhitelist) {
  12615. $currentPackages = $this->getCurrentPackages($installedRepo);
  12616. }
  12617. foreach ($localRepo->getCanonicalPackages() as $package) {
  12618. if (!$package->isDev()) {
  12619. continue;
  12620. }
  12621. foreach ($operations as $operation) {
  12622. if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
  12623. || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
  12624. ) {
  12625. continue 2;
  12626. }
  12627. }
  12628. if ($this->update) {
  12629. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  12630. foreach ($currentPackages as $curPackage) {
  12631. if ($curPackage->isDev() && $curPackage->getName() === $package->getName() && $curPackage->getVersion() === $package->getVersion()) {
  12632. if ($task === 'force-links') {
  12633. $package->setRequires($curPackage->getRequires());
  12634. $package->setConflicts($curPackage->getConflicts());
  12635. $package->setProvides($curPackage->getProvides());
  12636. $package->setReplaces($curPackage->getReplaces());
  12637. } elseif ($task === 'force-updates') {
  12638. if (($curPackage->getSourceReference() && $curPackage->getSourceReference() !== $package->getSourceReference())
  12639. || ($curPackage->getDistReference() && $curPackage->getDistReference() !== $package->getDistReference())
  12640. ) {
  12641. $operations[] = new UpdateOperation($package, $curPackage);
  12642. }
  12643. }
  12644. break;
  12645. }
  12646. }
  12647. continue;
  12648. }
  12649. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  12650. foreach ($matches as $index => $match) {
  12651. if (!in_array($match->getRepository(), $repositories, true)) {
  12652. unset($matches[$index]);
  12653. continue;
  12654. }
  12655. if ($match->getName() !== $package->getName()) {
  12656. unset($matches[$index]);
  12657. continue;
  12658. }
  12659. $matches[$index] = $match->getId();
  12660. }
  12661. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  12662. $newPackage = $pool->literalToPackage($matches[0]);
  12663. if ($task === 'force-links' && $newPackage) {
  12664. $package->setRequires($newPackage->getRequires());
  12665. $package->setConflicts($newPackage->getConflicts());
  12666. $package->setProvides($newPackage->getProvides());
  12667. $package->setReplaces($newPackage->getReplaces());
  12668. }
  12669. if ($task === 'force-updates' && $newPackage && (
  12670. (($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
  12671. || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
  12672. )
  12673. )) {
  12674. $operations[] = new UpdateOperation($package, $newPackage);
  12675. continue;
  12676. }
  12677. }
  12678. if ($task === 'force-updates') {
  12679. $references = $this->package->getReferences();
  12680. if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
  12681. $operations[] = new UpdateOperation($package, clone $package);
  12682. }
  12683. }
  12684. } else {
  12685. foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
  12686. if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
  12687. if ($task === 'force-links') {
  12688. $package->setRequires($lockedPackage->getRequires());
  12689. $package->setConflicts($lockedPackage->getConflicts());
  12690. $package->setProvides($lockedPackage->getProvides());
  12691. $package->setReplaces($lockedPackage->getReplaces());
  12692. } elseif ($task === 'force-updates') {
  12693. if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
  12694. || ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
  12695. ) {
  12696. $operations[] = new UpdateOperation($package, $lockedPackage);
  12697. }
  12698. }
  12699. break;
  12700. }
  12701. }
  12702. }
  12703. }
  12704. return $operations;
  12705. }
  12706. private function getCurrentPackages($installedRepo)
  12707. {
  12708. if ($this->locker->isLocked()) {
  12709. try {
  12710. return $this->locker->getLockedRepository(true)->getPackages();
  12711. } catch (\RuntimeException $e) {
  12712. return $this->locker->getLockedRepository()->getPackages();
  12713. }
  12714. }
  12715. return $installedRepo->getPackages();
  12716. }
  12717. private function getRootAliases()
  12718. {
  12719. if ($this->update) {
  12720. $aliases = $this->package->getAliases();
  12721. } else {
  12722. $aliases = $this->locker->getAliases();
  12723. }
  12724. $normalizedAliases = array();
  12725. foreach ($aliases as $alias) {
  12726. $normalizedAliases[$alias['package']][$alias['version']] = array(
  12727. 'alias' => $alias['alias'],
  12728. 'alias_normalized' => $alias['alias_normalized'],
  12729. );
  12730. }
  12731. return $normalizedAliases;
  12732. }
  12733. private function processPackageUrls($pool, $policy, $localRepo, $repositories)
  12734. {
  12735. if (!$this->update) {
  12736. return;
  12737. }
  12738. $rootRefs = $this->package->getReferences();
  12739. foreach ($localRepo->getCanonicalPackages() as $package) {
  12740. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  12741. foreach ($matches as $index => $match) {
  12742. if (!in_array($match->getRepository(), $repositories, true)) {
  12743. unset($matches[$index]);
  12744. continue;
  12745. }
  12746. if ($match->getName() !== $package->getName()) {
  12747. unset($matches[$index]);
  12748. continue;
  12749. }
  12750. $matches[$index] = $match->getId();
  12751. }
  12752. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  12753. $newPackage = $pool->literalToPackage($matches[0]);
  12754. $sourceUrl = $package->getSourceUrl();
  12755. $newSourceUrl = $newPackage->getSourceUrl();
  12756. $newReference = $newPackage->getSourceReference();
  12757. if ($package->isDev() && isset($rootRefs[$package->getName()]) && $package->getSourceReference() === $rootRefs[$package->getName()]) {
  12758. $newReference = $rootRefs[$package->getName()];
  12759. }
  12760. $this->updatePackageUrl($package, $newSourceUrl, $newPackage->getSourceType(), $newReference, $newPackage->getDistUrl());
  12761. if ($package instanceof CompletePackage && $newPackage instanceof CompletePackage) {
  12762. $package->setAbandoned($newPackage->getReplacementPackage() ?: $newPackage->isAbandoned());
  12763. }
  12764. }
  12765. }
  12766. }
  12767. private function updatePackageUrl(PackageInterface $package, $sourceUrl, $sourceType, $sourceReference, $distUrl)
  12768. {
  12769. $oldSourceRef = $package->getSourceReference();
  12770. if ($package->getSourceUrl() !== $sourceUrl) {
  12771. $package->setSourceType($sourceType);
  12772. $package->setSourceUrl($sourceUrl);
  12773. $package->setSourceReference($sourceReference);
  12774. }
  12775. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com)/}i', $distUrl)) {
  12776. $package->setDistUrl($distUrl);
  12777. $this->updateInstallReferences($package, $sourceReference);
  12778. }
  12779. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  12780. $this->updateInstallReferences($package, $oldSourceRef);
  12781. }
  12782. }
  12783. private function updateInstallReferences(PackageInterface $package, $reference)
  12784. {
  12785. if (!$reference) {
  12786. return;
  12787. }
  12788. $package->setSourceReference($reference);
  12789. $package->setDistReference($reference);
  12790. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com)/}i', $package->getDistUrl())) {
  12791. $package->setDistUrl(preg_replace('{(?<=/)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
  12792. }
  12793. }
  12794. private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
  12795. {
  12796. foreach ($aliases as $package => $versions) {
  12797. foreach ($versions as $version => $alias) {
  12798. $packages = $platformRepo->findPackages($package, $version);
  12799. foreach ($packages as $package) {
  12800. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  12801. $aliasPackage->setRootPackageAlias(true);
  12802. $platformRepo->addPackage($aliasPackage);
  12803. }
  12804. }
  12805. }
  12806. }
  12807. private function isUpdateable(PackageInterface $package)
  12808. {
  12809. if (!$this->updateWhitelist) {
  12810. throw new \LogicException('isUpdateable should only be called when a whitelist is present');
  12811. }
  12812. foreach ($this->updateWhitelist as $whiteListedPattern => $void) {
  12813. $patternRegexp = $this->packageNameToRegexp($whiteListedPattern);
  12814. if (preg_match($patternRegexp, $package->getName())) {
  12815. return true;
  12816. }
  12817. }
  12818. return false;
  12819. }
  12820. private function packageNameToRegexp($whiteListedPattern)
  12821. {
  12822. $cleanedWhiteListedPattern = str_replace('\\*', '.*', preg_quote($whiteListedPattern));
  12823. return "{^" . $cleanedWhiteListedPattern . "$}i";
  12824. }
  12825. private function extractPlatformRequirements($links)
  12826. {
  12827. $platformReqs = array();
  12828. foreach ($links as $link) {
  12829. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  12830. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  12831. }
  12832. }
  12833. return $platformReqs;
  12834. }
  12835. private function whitelistUpdateDependencies($localRepo, array $rootRequires, array $rootDevRequires)
  12836. {
  12837. if (!$this->updateWhitelist) {
  12838. return;
  12839. }
  12840. $rootRequires = array_merge($rootRequires, $rootDevRequires);
  12841. $requiredPackageNames = array();
  12842. foreach ($rootRequires as $require) {
  12843. $requiredPackageNames[] = $require->getTarget();
  12844. }
  12845. $skipPackages = array();
  12846. foreach ($rootRequires as $require) {
  12847. $skipPackages[$require->getTarget()] = true;
  12848. }
  12849. $pool = new Pool;
  12850. $pool->addRepository($localRepo);
  12851. $seen = array();
  12852. $rootRequiredPackageNames = array_keys($rootRequires);
  12853. foreach ($this->updateWhitelist as $packageName => $void) {
  12854. $packageQueue = new \SplQueue;
  12855. $depPackages = $pool->whatProvides($packageName);
  12856. $nameMatchesRequiredPackage = in_array($packageName, $requiredPackageNames, true);
  12857. if (!$nameMatchesRequiredPackage) {
  12858. $whitelistPatternRegexp = $this->packageNameToRegexp($packageName);
  12859. foreach ($rootRequiredPackageNames as $rootRequiredPackageName) {
  12860. if (preg_match($whitelistPatternRegexp, $rootRequiredPackageName)) {
  12861. $nameMatchesRequiredPackage = true;
  12862. break;
  12863. }
  12864. }
  12865. }
  12866. if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock'))) {
  12867. $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
  12868. }
  12869. foreach ($depPackages as $depPackage) {
  12870. $packageQueue->enqueue($depPackage);
  12871. }
  12872. while (!$packageQueue->isEmpty()) {
  12873. $package = $packageQueue->dequeue();
  12874. if (isset($seen[$package->getId()])) {
  12875. continue;
  12876. }
  12877. $seen[$package->getId()] = true;
  12878. $this->updateWhitelist[$package->getName()] = true;
  12879. if (!$this->whitelistDependencies) {
  12880. continue;
  12881. }
  12882. $requires = $package->getRequires();
  12883. foreach ($requires as $require) {
  12884. $requirePackages = $pool->whatProvides($require->getTarget());
  12885. foreach ($requirePackages as $requirePackage) {
  12886. if (isset($this->updateWhitelist[$requirePackage->getName()])) {
  12887. continue;
  12888. }
  12889. if (isset($skipPackages[$requirePackage->getName()])) {
  12890. $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly whitelisted. Ignoring.</warning>');
  12891. continue;
  12892. }
  12893. $packageQueue->enqueue($requirePackage);
  12894. }
  12895. }
  12896. }
  12897. }
  12898. }
  12899. private function mockLocalRepositories(RepositoryManager $rm)
  12900. {
  12901. $packages = array();
  12902. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  12903. $packages[(string) $package] = clone $package;
  12904. }
  12905. foreach ($packages as $key => $package) {
  12906. if ($package instanceof AliasPackage) {
  12907. $alias = (string) $package->getAliasOf();
  12908. $packages[$key] = new AliasPackage($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  12909. }
  12910. }
  12911. $rm->setLocalRepository(
  12912. new InstalledArrayRepository($packages)
  12913. );
  12914. }
  12915. public static function create(IOInterface $io, Composer $composer)
  12916. {
  12917. return new static(
  12918. $io,
  12919. $composer->getConfig(),
  12920. $composer->getPackage(),
  12921. $composer->getDownloadManager(),
  12922. $composer->getRepositoryManager(),
  12923. $composer->getLocker(),
  12924. $composer->getInstallationManager(),
  12925. $composer->getEventDispatcher(),
  12926. $composer->getAutoloadGenerator()
  12927. );
  12928. }
  12929. public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
  12930. {
  12931. $this->additionalInstalledRepository = $additionalInstalledRepository;
  12932. return $this;
  12933. }
  12934. public function setDryRun($dryRun = true)
  12935. {
  12936. $this->dryRun = (boolean) $dryRun;
  12937. return $this;
  12938. }
  12939. public function isDryRun()
  12940. {
  12941. return $this->dryRun;
  12942. }
  12943. public function setPreferSource($preferSource = true)
  12944. {
  12945. $this->preferSource = (boolean) $preferSource;
  12946. return $this;
  12947. }
  12948. public function setPreferDist($preferDist = true)
  12949. {
  12950. $this->preferDist = (boolean) $preferDist;
  12951. return $this;
  12952. }
  12953. public function setOptimizeAutoloader($optimizeAutoloader = false)
  12954. {
  12955. $this->optimizeAutoloader = (boolean) $optimizeAutoloader;
  12956. if (!$this->optimizeAutoloader) {
  12957. $this->setClassMapAuthoritative(false);
  12958. }
  12959. return $this;
  12960. }
  12961. public function setClassMapAuthoritative($classMapAuthoritative = false)
  12962. {
  12963. $this->classMapAuthoritative = (boolean) $classMapAuthoritative;
  12964. if ($this->classMapAuthoritative) {
  12965. $this->setOptimizeAutoloader(true);
  12966. }
  12967. return $this;
  12968. }
  12969. public function setUpdate($update = true)
  12970. {
  12971. $this->update = (boolean) $update;
  12972. return $this;
  12973. }
  12974. public function setDevMode($devMode = true)
  12975. {
  12976. $this->devMode = (boolean) $devMode;
  12977. return $this;
  12978. }
  12979. public function setDumpAutoloader($dumpAutoloader = true)
  12980. {
  12981. $this->dumpAutoloader = (boolean) $dumpAutoloader;
  12982. return $this;
  12983. }
  12984. public function setRunScripts($runScripts = true)
  12985. {
  12986. $this->runScripts = (boolean) $runScripts;
  12987. return $this;
  12988. }
  12989. public function setConfig(Config $config)
  12990. {
  12991. $this->config = $config;
  12992. return $this;
  12993. }
  12994. public function setVerbose($verbose = true)
  12995. {
  12996. $this->verbose = (boolean) $verbose;
  12997. return $this;
  12998. }
  12999. public function isVerbose()
  13000. {
  13001. return $this->verbose;
  13002. }
  13003. public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
  13004. {
  13005. $this->ignorePlatformReqs = (boolean) $ignorePlatformReqs;
  13006. return $this;
  13007. }
  13008. public function setUpdateWhitelist(array $packages)
  13009. {
  13010. $this->updateWhitelist = array_flip(array_map('strtolower', $packages));
  13011. return $this;
  13012. }
  13013. public function setWhitelistDependencies($updateDependencies = true)
  13014. {
  13015. $this->whitelistDependencies = (boolean) $updateDependencies;
  13016. return $this;
  13017. }
  13018. public function setPreferStable($preferStable = true)
  13019. {
  13020. $this->preferStable = (boolean) $preferStable;
  13021. return $this;
  13022. }
  13023. public function setPreferLowest($preferLowest = true)
  13024. {
  13025. $this->preferLowest = (boolean) $preferLowest;
  13026. return $this;
  13027. }
  13028. public function setSkipSuggest($skipSuggest = true)
  13029. {
  13030. $this->skipSuggest = (boolean) $skipSuggest;
  13031. return $this;
  13032. }
  13033. public function disablePlugins()
  13034. {
  13035. $this->installationManager->disablePlugins();
  13036. return $this;
  13037. }
  13038. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)
  13039. {
  13040. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  13041. return $this;
  13042. }
  13043. }
  13044. <?php
  13045. namespace Composer\Installer;
  13046. use Composer\IO\IOInterface;
  13047. use Composer\Package\PackageInterface;
  13048. use Composer\Util\Filesystem;
  13049. use Composer\Util\Platform;
  13050. use Composer\Util\ProcessExecutor;
  13051. use Composer\Util\Silencer;
  13052. class BinaryInstaller
  13053. {
  13054. protected $binDir;
  13055. protected $binCompat;
  13056. protected $io;
  13057. protected $filesystem;
  13058. public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null)
  13059. {
  13060. $this->binDir = $binDir;
  13061. $this->binCompat = $binCompat;
  13062. $this->io = $io;
  13063. $this->filesystem = $filesystem ?: new Filesystem();
  13064. }
  13065. public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true)
  13066. {
  13067. $binaries = $this->getBinaries($package);
  13068. if (!$binaries) {
  13069. return;
  13070. }
  13071. foreach ($binaries as $bin) {
  13072. $binPath = $installPath.'/'.$bin;
  13073. if (!file_exists($binPath)) {
  13074. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  13075. continue;
  13076. }
  13077. $binPath = realpath($binPath);
  13078. $this->initializeBinDir();
  13079. $link = $this->binDir.'/'.basename($bin);
  13080. if (file_exists($link)) {
  13081. if (is_link($link)) {
  13082. Silencer::call('chmod', $link, 0777 & ~umask());
  13083. }
  13084. if ($warnOnOverwrite) {
  13085. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  13086. }
  13087. continue;
  13088. }
  13089. if ($this->binCompat === "auto") {
  13090. if (Platform::isWindows()) {
  13091. $this->installFullBinaries($binPath, $link, $bin, $package);
  13092. } else {
  13093. $this->installSymlinkBinaries($binPath, $link);
  13094. }
  13095. } elseif ($this->binCompat === "full") {
  13096. $this->installFullBinaries($binPath, $link, $bin, $package);
  13097. }
  13098. Silencer::call('chmod', $link, 0777 & ~umask());
  13099. }
  13100. }
  13101. public function removeBinaries(PackageInterface $package)
  13102. {
  13103. $this->initializeBinDir();
  13104. $binaries = $this->getBinaries($package);
  13105. if (!$binaries) {
  13106. return;
  13107. }
  13108. foreach ($binaries as $bin) {
  13109. $link = $this->binDir.'/'.basename($bin);
  13110. if (is_link($link) || file_exists($link)) {
  13111. $this->filesystem->unlink($link);
  13112. }
  13113. if (file_exists($link.'.bat')) {
  13114. $this->filesystem->unlink($link.'.bat');
  13115. }
  13116. }
  13117. if ((is_dir($this->binDir)) && ($this->filesystem->isDirEmpty($this->binDir))) {
  13118. Silencer::call('rmdir', $this->binDir);
  13119. }
  13120. }
  13121. protected function getBinaries(PackageInterface $package)
  13122. {
  13123. return $package->getBinaries();
  13124. }
  13125. protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package)
  13126. {
  13127. if ('.bat' !== substr($binPath, -4)) {
  13128. $this->installUnixyProxyBinaries($binPath, $link);
  13129. @chmod($link, 0777 & ~umask());
  13130. $link .= '.bat';
  13131. if (file_exists($link)) {
  13132. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  13133. }
  13134. }
  13135. if (!file_exists($link)) {
  13136. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  13137. }
  13138. }
  13139. protected function installSymlinkBinaries($binPath, $link)
  13140. {
  13141. if (!$this->filesystem->relativeSymlink($binPath, $link)) {
  13142. $this->installUnixyProxyBinaries($binPath, $link);
  13143. }
  13144. }
  13145. protected function installUnixyProxyBinaries($binPath, $link)
  13146. {
  13147. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  13148. }
  13149. protected function initializeBinDir()
  13150. {
  13151. $this->filesystem->ensureDirectoryExists($this->binDir);
  13152. $this->binDir = realpath($this->binDir);
  13153. }
  13154. protected function generateWindowsProxyCode($bin, $link)
  13155. {
  13156. $binPath = $this->filesystem->findShortestPath($link, $bin);
  13157. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  13158. $caller = 'call';
  13159. } else {
  13160. $handle = fopen($bin, 'r');
  13161. $line = fgets($handle);
  13162. fclose($handle);
  13163. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  13164. $caller = trim($match[1]);
  13165. } else {
  13166. $caller = 'php';
  13167. }
  13168. }
  13169. return "@ECHO OFF\r\n".
  13170. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  13171. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  13172. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  13173. }
  13174. protected function generateUnixyProxyCode($bin, $link)
  13175. {
  13176. $binPath = $this->filesystem->findShortestPath($link, $bin);
  13177. $binDir = ProcessExecutor::escape(dirname($binPath));
  13178. $binFile = basename($binPath);
  13179. $proxyCode = <<<PROXY
  13180. #!/usr/bin/env sh
  13181. dir=$(d=\${0%[/\\\\]*}; cd "\$d"; cd $binDir && pwd)
  13182. # See if we are running in Cygwin by checking for cygpath program
  13183. if command -v 'cygpath' >/dev/null 2>&1; then
  13184. # Cygwin paths start with /cygdrive/ which will break windows PHP,
  13185. # so we need to translate the dir path to windows format. However
  13186. # we could be using cygwin PHP which does not require this, so we
  13187. # test if the path to PHP starts with /cygdrive/ rather than /usr/bin
  13188. if [[ $(which php) == /cygdrive/* ]]; then
  13189. dir=$(cygpath -m "\$dir");
  13190. fi
  13191. fi
  13192. dir=$(echo \$dir | sed 's/ /\ /g')
  13193. "\${dir}/$binFile" "$@"
  13194. PROXY;
  13195. return $proxyCode;
  13196. }
  13197. }
  13198. <?php
  13199. namespace Composer\Installer;
  13200. use Composer\Package\PackageInterface;
  13201. interface BinaryPresenceInterface
  13202. {
  13203. public function ensureBinariesPresence(PackageInterface $package);
  13204. }
  13205. <?php
  13206. namespace Composer\Installer;
  13207. use Composer\IO\IOInterface;
  13208. use Composer\Package\PackageInterface;
  13209. use Composer\Package\AliasPackage;
  13210. use Composer\Repository\RepositoryInterface;
  13211. use Composer\Repository\InstalledRepositoryInterface;
  13212. use Composer\DependencyResolver\Operation\OperationInterface;
  13213. use Composer\DependencyResolver\Operation\InstallOperation;
  13214. use Composer\DependencyResolver\Operation\UpdateOperation;
  13215. use Composer\DependencyResolver\Operation\UninstallOperation;
  13216. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  13217. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  13218. use Composer\Util\StreamContextFactory;
  13219. class InstallationManager
  13220. {
  13221. private $installers = array();
  13222. private $cache = array();
  13223. private $notifiablePackages = array();
  13224. public function reset()
  13225. {
  13226. $this->notifiablePackages = array();
  13227. }
  13228. public function addInstaller(InstallerInterface $installer)
  13229. {
  13230. array_unshift($this->installers, $installer);
  13231. $this->cache = array();
  13232. }
  13233. public function removeInstaller(InstallerInterface $installer)
  13234. {
  13235. if (false !== ($key = array_search($installer, $this->installers, true))) {
  13236. array_splice($this->installers, $key, 1);
  13237. $this->cache = array();
  13238. }
  13239. }
  13240. public function disablePlugins()
  13241. {
  13242. foreach ($this->installers as $i => $installer) {
  13243. if (!$installer instanceof PluginInstaller) {
  13244. continue;
  13245. }
  13246. unset($this->installers[$i]);
  13247. }
  13248. }
  13249. public function getInstaller($type)
  13250. {
  13251. $type = strtolower($type);
  13252. if (isset($this->cache[$type])) {
  13253. return $this->cache[$type];
  13254. }
  13255. foreach ($this->installers as $installer) {
  13256. if ($installer->supports($type)) {
  13257. return $this->cache[$type] = $installer;
  13258. }
  13259. }
  13260. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  13261. }
  13262. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  13263. {
  13264. if ($package instanceof AliasPackage) {
  13265. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  13266. }
  13267. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  13268. }
  13269. public function ensureBinariesPresence(PackageInterface $package)
  13270. {
  13271. try {
  13272. $installer = $this->getInstaller($package->getType());
  13273. } catch (\InvalidArgumentException $e) {
  13274. return;
  13275. }
  13276. if ($installer instanceof BinaryPresenceInterface) {
  13277. $installer->ensureBinariesPresence($package);
  13278. }
  13279. }
  13280. public function execute(RepositoryInterface $repo, OperationInterface $operation)
  13281. {
  13282. $method = $operation->getJobType();
  13283. $this->$method($repo, $operation);
  13284. }
  13285. public function install(RepositoryInterface $repo, InstallOperation $operation)
  13286. {
  13287. $package = $operation->getPackage();
  13288. $installer = $this->getInstaller($package->getType());
  13289. $installer->install($repo, $package);
  13290. $this->markForNotification($package);
  13291. }
  13292. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  13293. {
  13294. $initial = $operation->getInitialPackage();
  13295. $target = $operation->getTargetPackage();
  13296. $initialType = $initial->getType();
  13297. $targetType = $target->getType();
  13298. if ($initialType === $targetType) {
  13299. $installer = $this->getInstaller($initialType);
  13300. $installer->update($repo, $initial, $target);
  13301. $this->markForNotification($target);
  13302. } else {
  13303. $this->getInstaller($initialType)->uninstall($repo, $initial);
  13304. $this->getInstaller($targetType)->install($repo, $target);
  13305. }
  13306. }
  13307. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  13308. {
  13309. $package = $operation->getPackage();
  13310. $installer = $this->getInstaller($package->getType());
  13311. $installer->uninstall($repo, $package);
  13312. }
  13313. public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
  13314. {
  13315. $package = $operation->getPackage();
  13316. if (!$repo->hasPackage($package)) {
  13317. $repo->addPackage(clone $package);
  13318. }
  13319. }
  13320. public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
  13321. {
  13322. $package = $operation->getPackage();
  13323. $repo->removePackage($package);
  13324. }
  13325. public function getInstallPath(PackageInterface $package)
  13326. {
  13327. $installer = $this->getInstaller($package->getType());
  13328. return $installer->getInstallPath($package);
  13329. }
  13330. public function notifyInstalls(IOInterface $io)
  13331. {
  13332. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  13333. $repositoryName = parse_url($repoUrl, PHP_URL_HOST);
  13334. if ($io->hasAuthentication($repositoryName)) {
  13335. $auth = $io->getAuthentication($repositoryName);
  13336. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  13337. $authHeader = 'Authorization: Basic '.$authStr;
  13338. }
  13339. if (strpos($repoUrl, '%package%')) {
  13340. foreach ($packages as $package) {
  13341. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  13342. $params = array(
  13343. 'version' => $package->getPrettyVersion(),
  13344. 'version_normalized' => $package->getVersion(),
  13345. );
  13346. $opts = array('http' =>
  13347. array(
  13348. 'method' => 'POST',
  13349. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  13350. 'content' => http_build_query($params, '', '&'),
  13351. 'timeout' => 3,
  13352. ),
  13353. );
  13354. if (isset($authHeader)) {
  13355. $opts['http']['header'][] = $authHeader;
  13356. }
  13357. $context = StreamContextFactory::getContext($url, $opts);
  13358. @file_get_contents($url, false, $context);
  13359. }
  13360. continue;
  13361. }
  13362. $postData = array('downloads' => array());
  13363. foreach ($packages as $package) {
  13364. $postData['downloads'][] = array(
  13365. 'name' => $package->getPrettyName(),
  13366. 'version' => $package->getVersion(),
  13367. );
  13368. }
  13369. $opts = array('http' =>
  13370. array(
  13371. 'method' => 'POST',
  13372. 'header' => array('Content-Type: application/json'),
  13373. 'content' => json_encode($postData),
  13374. 'timeout' => 6,
  13375. ),
  13376. );
  13377. if (isset($authHeader)) {
  13378. $opts['http']['header'][] = $authHeader;
  13379. }
  13380. $context = StreamContextFactory::getContext($repoUrl, $opts);
  13381. @file_get_contents($repoUrl, false, $context);
  13382. }
  13383. $this->reset();
  13384. }
  13385. private function markForNotification(PackageInterface $package)
  13386. {
  13387. if ($package->getNotificationUrl()) {
  13388. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  13389. }
  13390. }
  13391. }
  13392. <?php
  13393. namespace Composer\Installer;
  13394. use Composer\Composer;
  13395. use Composer\DependencyResolver\PolicyInterface;
  13396. use Composer\DependencyResolver\Operation\OperationInterface;
  13397. use Composer\DependencyResolver\Pool;
  13398. use Composer\DependencyResolver\Request;
  13399. use Composer\EventDispatcher\Event;
  13400. use Composer\IO\IOInterface;
  13401. use Composer\Repository\CompositeRepository;
  13402. class InstallerEvent extends Event
  13403. {
  13404. private $composer;
  13405. private $io;
  13406. private $devMode;
  13407. private $policy;
  13408. private $pool;
  13409. private $installedRepo;
  13410. private $request;
  13411. private $operations;
  13412. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  13413. {
  13414. parent::__construct($eventName);
  13415. $this->composer = $composer;
  13416. $this->io = $io;
  13417. $this->devMode = $devMode;
  13418. $this->policy = $policy;
  13419. $this->pool = $pool;
  13420. $this->installedRepo = $installedRepo;
  13421. $this->request = $request;
  13422. $this->operations = $operations;
  13423. }
  13424. public function getComposer()
  13425. {
  13426. return $this->composer;
  13427. }
  13428. public function getIO()
  13429. {
  13430. return $this->io;
  13431. }
  13432. public function isDevMode()
  13433. {
  13434. return $this->devMode;
  13435. }
  13436. public function getPolicy()
  13437. {
  13438. return $this->policy;
  13439. }
  13440. public function getPool()
  13441. {
  13442. return $this->pool;
  13443. }
  13444. public function getInstalledRepo()
  13445. {
  13446. return $this->installedRepo;
  13447. }
  13448. public function getRequest()
  13449. {
  13450. return $this->request;
  13451. }
  13452. public function getOperations()
  13453. {
  13454. return $this->operations;
  13455. }
  13456. }
  13457. <?php
  13458. namespace Composer\Installer;
  13459. class InstallerEvents
  13460. {
  13461. const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
  13462. const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
  13463. }
  13464. <?php
  13465. namespace Composer\Installer;
  13466. use Composer\Package\PackageInterface;
  13467. use Composer\Repository\InstalledRepositoryInterface;
  13468. use InvalidArgumentException;
  13469. interface InstallerInterface
  13470. {
  13471. public function supports($packageType);
  13472. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  13473. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  13474. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  13475. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  13476. public function getInstallPath(PackageInterface $package);
  13477. }
  13478. <?php
  13479. namespace Composer\Installer;
  13480. use Composer\Composer;
  13481. use Composer\IO\IOInterface;
  13482. use Composer\Repository\InstalledRepositoryInterface;
  13483. use Composer\Package\PackageInterface;
  13484. use Composer\Util\Filesystem;
  13485. use Composer\Util\Silencer;
  13486. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  13487. {
  13488. protected $composer;
  13489. protected $vendorDir;
  13490. protected $binDir;
  13491. protected $downloadManager;
  13492. protected $io;
  13493. protected $type;
  13494. protected $filesystem;
  13495. protected $binCompat;
  13496. protected $binaryInstaller;
  13497. public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
  13498. {
  13499. $this->composer = $composer;
  13500. $this->downloadManager = $composer->getDownloadManager();
  13501. $this->io = $io;
  13502. $this->type = $type;
  13503. $this->filesystem = $filesystem ?: new Filesystem();
  13504. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  13505. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem);
  13506. }
  13507. public function supports($packageType)
  13508. {
  13509. return $packageType === $this->type || null === $this->type;
  13510. }
  13511. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  13512. {
  13513. return $repo->hasPackage($package) && is_readable($this->getInstallPath($package));
  13514. }
  13515. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  13516. {
  13517. $this->initializeVendorDir();
  13518. $downloadPath = $this->getInstallPath($package);
  13519. if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
  13520. $this->binaryInstaller->removeBinaries($package);
  13521. }
  13522. $this->installCode($package);
  13523. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
  13524. if (!$repo->hasPackage($package)) {
  13525. $repo->addPackage(clone $package);
  13526. }
  13527. }
  13528. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  13529. {
  13530. if (!$repo->hasPackage($initial)) {
  13531. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  13532. }
  13533. $this->initializeVendorDir();
  13534. $this->binaryInstaller->removeBinaries($initial);
  13535. $this->updateCode($initial, $target);
  13536. $this->binaryInstaller->installBinaries($target, $this->getInstallPath($target));
  13537. $repo->removePackage($initial);
  13538. if (!$repo->hasPackage($target)) {
  13539. $repo->addPackage(clone $target);
  13540. }
  13541. }
  13542. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  13543. {
  13544. if (!$repo->hasPackage($package)) {
  13545. throw new \InvalidArgumentException('Package is not installed: '.$package);
  13546. }
  13547. $this->removeCode($package);
  13548. $this->binaryInstaller->removeBinaries($package);
  13549. $repo->removePackage($package);
  13550. $downloadPath = $this->getPackageBasePath($package);
  13551. if (strpos($package->getName(), '/')) {
  13552. $packageVendorDir = dirname($downloadPath);
  13553. if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
  13554. Silencer::call('rmdir', $packageVendorDir);
  13555. }
  13556. }
  13557. }
  13558. public function getInstallPath(PackageInterface $package)
  13559. {
  13560. $this->initializeVendorDir();
  13561. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  13562. $targetDir = $package->getTargetDir();
  13563. return $basePath . ($targetDir ? '/'.$targetDir : '');
  13564. }
  13565. public function ensureBinariesPresence(PackageInterface $package)
  13566. {
  13567. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  13568. }
  13569. protected function getPackageBasePath(PackageInterface $package)
  13570. {
  13571. $installPath = $this->getInstallPath($package);
  13572. $targetDir = $package->getTargetDir();
  13573. if ($targetDir) {
  13574. return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  13575. }
  13576. return $installPath;
  13577. }
  13578. protected function installCode(PackageInterface $package)
  13579. {
  13580. $downloadPath = $this->getInstallPath($package);
  13581. $this->downloadManager->download($package, $downloadPath);
  13582. }
  13583. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  13584. {
  13585. $initialDownloadPath = $this->getInstallPath($initial);
  13586. $targetDownloadPath = $this->getInstallPath($target);
  13587. if ($targetDownloadPath !== $initialDownloadPath) {
  13588. if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
  13589. || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
  13590. ) {
  13591. $this->removeCode($initial);
  13592. $this->installCode($target);
  13593. return;
  13594. }
  13595. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  13596. }
  13597. $this->downloadManager->update($initial, $target, $targetDownloadPath);
  13598. }
  13599. protected function removeCode(PackageInterface $package)
  13600. {
  13601. $downloadPath = $this->getPackageBasePath($package);
  13602. $this->downloadManager->remove($package, $downloadPath);
  13603. }
  13604. protected function initializeVendorDir()
  13605. {
  13606. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  13607. $this->vendorDir = realpath($this->vendorDir);
  13608. }
  13609. }
  13610. <?php
  13611. namespace Composer\Installer;
  13612. use Composer\Repository\InstalledRepositoryInterface;
  13613. use Composer\Package\PackageInterface;
  13614. class MetapackageInstaller implements InstallerInterface
  13615. {
  13616. public function supports($packageType)
  13617. {
  13618. return $packageType === 'metapackage';
  13619. }
  13620. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  13621. {
  13622. return $repo->hasPackage($package);
  13623. }
  13624. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  13625. {
  13626. $repo->addPackage(clone $package);
  13627. }
  13628. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  13629. {
  13630. if (!$repo->hasPackage($initial)) {
  13631. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  13632. }
  13633. $repo->removePackage($initial);
  13634. $repo->addPackage(clone $target);
  13635. }
  13636. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  13637. {
  13638. if (!$repo->hasPackage($package)) {
  13639. throw new \InvalidArgumentException('Package is not installed: '.$package);
  13640. }
  13641. $repo->removePackage($package);
  13642. }
  13643. public function getInstallPath(PackageInterface $package)
  13644. {
  13645. return '';
  13646. }
  13647. }
  13648. <?php
  13649. namespace Composer\Installer;
  13650. use Composer\Repository\InstalledRepositoryInterface;
  13651. use Composer\Package\PackageInterface;
  13652. class NoopInstaller implements InstallerInterface
  13653. {
  13654. public function supports($packageType)
  13655. {
  13656. return true;
  13657. }
  13658. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  13659. {
  13660. return $repo->hasPackage($package);
  13661. }
  13662. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  13663. {
  13664. if (!$repo->hasPackage($package)) {
  13665. $repo->addPackage(clone $package);
  13666. }
  13667. }
  13668. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  13669. {
  13670. if (!$repo->hasPackage($initial)) {
  13671. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  13672. }
  13673. $repo->removePackage($initial);
  13674. if (!$repo->hasPackage($target)) {
  13675. $repo->addPackage(clone $target);
  13676. }
  13677. }
  13678. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  13679. {
  13680. if (!$repo->hasPackage($package)) {
  13681. throw new \InvalidArgumentException('Package is not installed: '.$package);
  13682. }
  13683. $repo->removePackage($package);
  13684. }
  13685. public function getInstallPath(PackageInterface $package)
  13686. {
  13687. $targetDir = $package->getTargetDir();
  13688. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  13689. }
  13690. }
  13691. <?php
  13692. namespace Composer\Installer;
  13693. use Composer\Composer;
  13694. use Composer\IO\IOInterface;
  13695. use Composer\DependencyResolver\Operation\OperationInterface;
  13696. use Composer\DependencyResolver\PolicyInterface;
  13697. use Composer\DependencyResolver\Pool;
  13698. use Composer\DependencyResolver\Request;
  13699. use Composer\Repository\CompositeRepository;
  13700. class PackageEvent extends InstallerEvent
  13701. {
  13702. private $operation;
  13703. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  13704. {
  13705. parent::__construct($eventName, $composer, $io, $devMode, $policy, $pool, $installedRepo, $request, $operations);
  13706. $this->operation = $operation;
  13707. }
  13708. public function getOperation()
  13709. {
  13710. return $this->operation;
  13711. }
  13712. }
  13713. <?php
  13714. namespace Composer\Installer;
  13715. class PackageEvents
  13716. {
  13717. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  13718. const POST_PACKAGE_INSTALL = 'post-package-install';
  13719. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  13720. const POST_PACKAGE_UPDATE = 'post-package-update';
  13721. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  13722. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  13723. }
  13724. <?php
  13725. namespace Composer\Installer;
  13726. use Composer\IO\IOInterface;
  13727. use Composer\Package\PackageInterface;
  13728. use Composer\Util\Filesystem;
  13729. use Composer\Util\ProcessExecutor;
  13730. class PearBinaryInstaller extends BinaryInstaller
  13731. {
  13732. private $installer;
  13733. private $vendorDir;
  13734. public function __construct(IOInterface $io, $binDir, $vendorDir, $binCompat, Filesystem $filesystem, PearInstaller $installer)
  13735. {
  13736. parent::__construct($io, $binDir, $binCompat, $filesystem);
  13737. $this->installer = $installer;
  13738. $this->vendorDir = $vendorDir;
  13739. }
  13740. protected function getBinaries(PackageInterface $package)
  13741. {
  13742. $binariesPath = $this->installer->getInstallPath($package) . '/bin/';
  13743. $binaries = array();
  13744. if (file_exists($binariesPath)) {
  13745. foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
  13746. if (!$value->isDir()) {
  13747. $binaries[] = 'bin/'.$fileName;
  13748. }
  13749. }
  13750. }
  13751. return $binaries;
  13752. }
  13753. protected function initializeBinDir()
  13754. {
  13755. parent::initializeBinDir();
  13756. file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
  13757. @chmod($this->binDir.'/composer-php', 0777);
  13758. file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
  13759. @chmod($this->binDir.'/composer-php.bat', 0777);
  13760. }
  13761. protected function generateWindowsProxyCode($bin, $link)
  13762. {
  13763. $binPath = $this->filesystem->findShortestPath($link, $bin);
  13764. if ('.bat' === substr($bin, -4)) {
  13765. $caller = 'call';
  13766. } else {
  13767. $handle = fopen($bin, 'r');
  13768. $line = fgets($handle);
  13769. fclose($handle);
  13770. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  13771. $caller = trim($match[1]);
  13772. } else {
  13773. $caller = 'php';
  13774. }
  13775. if ($caller === 'php') {
  13776. return "@echo off\r\n".
  13777. "pushd .\r\n".
  13778. "cd %~dp0\r\n".
  13779. "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
  13780. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  13781. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  13782. "popd\r\n".
  13783. "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
  13784. }
  13785. }
  13786. return "@echo off\r\n".
  13787. "pushd .\r\n".
  13788. "cd %~dp0\r\n".
  13789. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  13790. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  13791. "popd\r\n".
  13792. $caller." \"%BIN_TARGET%\" %*\r\n";
  13793. }
  13794. private function generateWindowsPhpProxyCode()
  13795. {
  13796. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  13797. return
  13798. "@echo off\r\n" .
  13799. "setlocal enabledelayedexpansion\r\n" .
  13800. "set BIN_DIR=%~dp0\r\n" .
  13801. "set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
  13802. "set DIRS=.\r\n" .
  13803. "FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
  13804. " FOR /D %%P IN (%%V\\*) DO (\r\n" .
  13805. " set DIRS=!DIRS!;%%~fP\r\n" .
  13806. " )\r\n" .
  13807. ")\r\n" .
  13808. "php.exe -d include_path=!DIRS! %*\r\n";
  13809. }
  13810. private function generateUnixyPhpProxyCode()
  13811. {
  13812. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  13813. return
  13814. "#!/usr/bin/env sh\n".
  13815. "SRC_DIR=`pwd`\n".
  13816. "BIN_DIR=`dirname $0`\n".
  13817. "VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
  13818. "DIRS=\"\"\n".
  13819. "for vendor in \$VENDOR_DIR/*; do\n".
  13820. " if [ -d \"\$vendor\" ]; then\n".
  13821. " for package in \$vendor/*; do\n".
  13822. " if [ -d \"\$package\" ]; then\n".
  13823. " DIRS=\"\${DIRS}:\${package}\"\n".
  13824. " fi\n".
  13825. " done\n".
  13826. " fi\n".
  13827. "done\n".
  13828. "php -d include_path=\".\$DIRS\" $@\n";
  13829. }
  13830. }
  13831. <?php
  13832. namespace Composer\Installer;
  13833. use Composer\IO\IOInterface;
  13834. use Composer\Composer;
  13835. use Composer\Downloader\PearPackageExtractor;
  13836. use Composer\Repository\InstalledRepositoryInterface;
  13837. use Composer\Package\PackageInterface;
  13838. use Composer\Util\Platform;
  13839. use Composer\Util\Filesystem;
  13840. class PearInstaller extends LibraryInstaller
  13841. {
  13842. public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
  13843. {
  13844. $filesystem = new Filesystem();
  13845. $binaryInstaller = new PearBinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), rtrim($composer->getConfig()->get('vendor-dir'), '/'), $composer->getConfig()->get('bin-compat'), $filesystem, $this);
  13846. parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
  13847. }
  13848. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  13849. {
  13850. $this->uninstall($repo, $initial);
  13851. $this->install($repo, $target);
  13852. }
  13853. protected function installCode(PackageInterface $package)
  13854. {
  13855. parent::installCode($package);
  13856. $isWindows = Platform::isWindows();
  13857. $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
  13858. if (!$isWindows) {
  13859. $php_bin = '/usr/bin/env ' . $php_bin;
  13860. }
  13861. $installPath = $this->getInstallPath($package);
  13862. $vars = array(
  13863. 'os' => $isWindows ? 'windows' : 'linux',
  13864. 'php_bin' => $php_bin,
  13865. 'pear_php' => $installPath,
  13866. 'php_dir' => $installPath,
  13867. 'bin_dir' => $installPath . '/bin',
  13868. 'data_dir' => $installPath . '/data',
  13869. 'version' => $package->getPrettyVersion(),
  13870. );
  13871. $packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
  13872. $pearExtractor = new PearPackageExtractor($packageArchive);
  13873. $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
  13874. $this->io->writeError(' Cleaning up', true, IOInterface::VERBOSE);
  13875. $this->filesystem->unlink($packageArchive);
  13876. }
  13877. }
  13878. <?php
  13879. namespace Composer\Installer;
  13880. use Composer\Composer;
  13881. use Composer\IO\IOInterface;
  13882. use Composer\Repository\InstalledRepositoryInterface;
  13883. use Composer\Package\PackageInterface;
  13884. class PluginInstaller extends LibraryInstaller
  13885. {
  13886. private $installationManager;
  13887. public function __construct(IOInterface $io, Composer $composer, $type = 'library')
  13888. {
  13889. parent::__construct($io, $composer, 'composer-plugin');
  13890. $this->installationManager = $composer->getInstallationManager();
  13891. }
  13892. public function supports($packageType)
  13893. {
  13894. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  13895. }
  13896. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  13897. {
  13898. $extra = $package->getExtra();
  13899. if (empty($extra['class'])) {
  13900. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  13901. }
  13902. parent::install($repo, $package);
  13903. try {
  13904. $this->composer->getPluginManager()->registerPackage($package, true);
  13905. } catch (\Exception $e) {
  13906. $this->io->writeError('Plugin installation failed, rolling back');
  13907. parent::uninstall($repo, $package);
  13908. throw $e;
  13909. }
  13910. }
  13911. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  13912. {
  13913. $extra = $target->getExtra();
  13914. if (empty($extra['class'])) {
  13915. throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  13916. }
  13917. parent::update($repo, $initial, $target);
  13918. $this->composer->getPluginManager()->registerPackage($target, true);
  13919. }
  13920. }
  13921. <?php
  13922. namespace Composer\Installer;
  13923. use Composer\Package\PackageInterface;
  13924. use Composer\Downloader\DownloadManager;
  13925. use Composer\Repository\InstalledRepositoryInterface;
  13926. use Composer\Util\Filesystem;
  13927. class ProjectInstaller implements InstallerInterface
  13928. {
  13929. private $installPath;
  13930. private $downloadManager;
  13931. private $filesystem;
  13932. public function __construct($installPath, DownloadManager $dm)
  13933. {
  13934. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  13935. $this->downloadManager = $dm;
  13936. $this->filesystem = new Filesystem;
  13937. }
  13938. public function supports($packageType)
  13939. {
  13940. return true;
  13941. }
  13942. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  13943. {
  13944. return false;
  13945. }
  13946. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  13947. {
  13948. $installPath = $this->installPath;
  13949. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  13950. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  13951. }
  13952. if (!is_dir($installPath)) {
  13953. mkdir($installPath, 0777, true);
  13954. }
  13955. $this->downloadManager->download($package, $installPath);
  13956. }
  13957. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  13958. {
  13959. throw new \InvalidArgumentException("not supported");
  13960. }
  13961. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  13962. {
  13963. throw new \InvalidArgumentException("not supported");
  13964. }
  13965. public function getInstallPath(PackageInterface $package)
  13966. {
  13967. return $this->installPath;
  13968. }
  13969. }
  13970. <?php
  13971. namespace Composer\Installer;
  13972. use Composer\IO\IOInterface;
  13973. use Composer\Package\PackageInterface;
  13974. use Composer\Repository\RepositoryInterface;
  13975. class SuggestedPackagesReporter
  13976. {
  13977. protected $suggestedPackages = array();
  13978. private $io;
  13979. public function __construct(IOInterface $io)
  13980. {
  13981. $this->io = $io;
  13982. }
  13983. public function getPackages()
  13984. {
  13985. return $this->suggestedPackages;
  13986. }
  13987. public function addPackage($source, $target, $reason)
  13988. {
  13989. $this->suggestedPackages[] = array(
  13990. 'source' => $source,
  13991. 'target' => $target,
  13992. 'reason' => $reason,
  13993. );
  13994. return $this;
  13995. }
  13996. public function addSuggestionsFromPackage(PackageInterface $package)
  13997. {
  13998. $source = $package->getPrettyName();
  13999. foreach ($package->getSuggests() as $target => $reason) {
  14000. $this->addPackage(
  14001. $source,
  14002. $target,
  14003. $reason
  14004. );
  14005. }
  14006. return $this;
  14007. }
  14008. public function output(RepositoryInterface $installedRepo = null)
  14009. {
  14010. $suggestedPackages = $this->getPackages();
  14011. $installedPackages = array();
  14012. if (null !== $installedRepo && ! empty($suggestedPackages)) {
  14013. foreach ($installedRepo->getPackages() as $package) {
  14014. $installedPackages = array_merge(
  14015. $installedPackages,
  14016. $package->getNames()
  14017. );
  14018. }
  14019. }
  14020. foreach ($suggestedPackages as $suggestion) {
  14021. if (in_array($suggestion['target'], $installedPackages)) {
  14022. continue;
  14023. }
  14024. $this->io->writeError(sprintf(
  14025. '%s suggests installing %s (%s)',
  14026. $suggestion['source'],
  14027. $suggestion['target'],
  14028. $suggestion['reason']
  14029. ));
  14030. }
  14031. return $this;
  14032. }
  14033. }
  14034. <?php
  14035. namespace Composer\Json;
  14036. use JsonSchema\Validator;
  14037. use Seld\JsonLint\JsonParser;
  14038. use Seld\JsonLint\ParsingException;
  14039. use Composer\Util\RemoteFilesystem;
  14040. use Composer\IO\IOInterface;
  14041. use Composer\Downloader\TransportException;
  14042. class JsonFile
  14043. {
  14044. const LAX_SCHEMA = 1;
  14045. const STRICT_SCHEMA = 2;
  14046. const JSON_UNESCAPED_SLASHES = 64;
  14047. const JSON_PRETTY_PRINT = 128;
  14048. const JSON_UNESCAPED_UNICODE = 256;
  14049. private $path;
  14050. private $rfs;
  14051. private $io;
  14052. public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
  14053. {
  14054. $this->path = $path;
  14055. if (null === $rfs && preg_match('{^https?://}i', $path)) {
  14056. throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
  14057. }
  14058. $this->rfs = $rfs;
  14059. $this->io = $io;
  14060. }
  14061. public function getPath()
  14062. {
  14063. return $this->path;
  14064. }
  14065. public function exists()
  14066. {
  14067. return is_file($this->path);
  14068. }
  14069. public function read()
  14070. {
  14071. try {
  14072. if ($this->rfs) {
  14073. $json = $this->rfs->getContents($this->path, $this->path, false);
  14074. } else {
  14075. if ($this->io && $this->io->isDebug()) {
  14076. $this->io->writeError('Reading ' . $this->path);
  14077. }
  14078. $json = file_get_contents($this->path);
  14079. }
  14080. } catch (TransportException $e) {
  14081. throw new \RuntimeException($e->getMessage(), 0, $e);
  14082. } catch (\Exception $e) {
  14083. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  14084. }
  14085. return static::parseJson($json, $this->path);
  14086. }
  14087. public function write(array $hash, $options = 448)
  14088. {
  14089. $dir = dirname($this->path);
  14090. if (!is_dir($dir)) {
  14091. if (file_exists($dir)) {
  14092. throw new \UnexpectedValueException(
  14093. $dir.' exists and is not a directory.'
  14094. );
  14095. }
  14096. if (!@mkdir($dir, 0777, true)) {
  14097. throw new \UnexpectedValueException(
  14098. $dir.' does not exist and could not be created.'
  14099. );
  14100. }
  14101. }
  14102. $retries = 3;
  14103. while ($retries--) {
  14104. try {
  14105. file_put_contents($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
  14106. break;
  14107. } catch (\Exception $e) {
  14108. if ($retries) {
  14109. usleep(500000);
  14110. continue;
  14111. }
  14112. throw $e;
  14113. }
  14114. }
  14115. }
  14116. public function validateSchema($schema = self::STRICT_SCHEMA)
  14117. {
  14118. $content = file_get_contents($this->path);
  14119. $data = json_decode($content);
  14120. if (null === $data && 'null' !== $content) {
  14121. self::validateSyntax($content, $this->path);
  14122. }
  14123. $schemaFile = __DIR__ . '/../../../res/composer-schema.json';
  14124. $schemaData = json_decode(file_get_contents($schemaFile));
  14125. if ($schema === self::LAX_SCHEMA) {
  14126. $schemaData->additionalProperties = true;
  14127. $schemaData->required = array();
  14128. }
  14129. $validator = new Validator();
  14130. $validator->check($data, $schemaData);
  14131. if (!$validator->isValid()) {
  14132. $errors = array();
  14133. foreach ((array) $validator->getErrors() as $error) {
  14134. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  14135. }
  14136. throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
  14137. }
  14138. return true;
  14139. }
  14140. public static function encode($data, $options = 448)
  14141. {
  14142. if (PHP_VERSION_ID >= 50400) {
  14143. $json = json_encode($data, $options);
  14144. if (false === $json) {
  14145. self::throwEncodeError(json_last_error());
  14146. }
  14147. if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(phpversion('json'), '1.3.6', '<'))) {
  14148. $json = preg_replace('/\[\s+\]/', '[]', $json);
  14149. $json = preg_replace('/\{\s+\}/', '{}', $json);
  14150. }
  14151. return $json;
  14152. }
  14153. $json = json_encode($data);
  14154. if (false === $json) {
  14155. self::throwEncodeError(json_last_error());
  14156. }
  14157. $prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
  14158. $unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
  14159. $unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
  14160. if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
  14161. return $json;
  14162. }
  14163. $result = JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
  14164. return $result;
  14165. }
  14166. private static function throwEncodeError($code)
  14167. {
  14168. switch ($code) {
  14169. case JSON_ERROR_DEPTH:
  14170. $msg = 'Maximum stack depth exceeded';
  14171. break;
  14172. case JSON_ERROR_STATE_MISMATCH:
  14173. $msg = 'Underflow or the modes mismatch';
  14174. break;
  14175. case JSON_ERROR_CTRL_CHAR:
  14176. $msg = 'Unexpected control character found';
  14177. break;
  14178. case JSON_ERROR_UTF8:
  14179. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  14180. break;
  14181. default:
  14182. $msg = 'Unknown error';
  14183. }
  14184. throw new \RuntimeException('JSON encoding failed: '.$msg);
  14185. }
  14186. public static function parseJson($json, $file = null)
  14187. {
  14188. if (null === $json) {
  14189. return;
  14190. }
  14191. $data = json_decode($json, true);
  14192. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  14193. self::validateSyntax($json, $file);
  14194. }
  14195. return $data;
  14196. }
  14197. protected static function validateSyntax($json, $file = null)
  14198. {
  14199. $parser = new JsonParser();
  14200. $result = $parser->lint($json);
  14201. if (null === $result) {
  14202. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  14203. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  14204. }
  14205. return true;
  14206. }
  14207. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  14208. }
  14209. }
  14210. <?php
  14211. namespace Composer\Json;
  14212. class JsonFormatter
  14213. {
  14214. public static function format($json, $unescapeUnicode, $unescapeSlashes)
  14215. {
  14216. $result = '';
  14217. $pos = 0;
  14218. $strLen = strlen($json);
  14219. $indentStr = ' ';
  14220. $newLine = "\n";
  14221. $outOfQuotes = true;
  14222. $buffer = '';
  14223. $noescape = true;
  14224. for ($i = 0; $i < $strLen; $i++) {
  14225. $char = substr($json, $i, 1);
  14226. if ('"' === $char && $noescape) {
  14227. $outOfQuotes = !$outOfQuotes;
  14228. }
  14229. if (!$outOfQuotes) {
  14230. $buffer .= $char;
  14231. $noescape = '\\' === $char ? !$noescape : true;
  14232. continue;
  14233. } elseif ('' !== $buffer) {
  14234. if ($unescapeSlashes) {
  14235. $buffer = str_replace('\\/', '/', $buffer);
  14236. }
  14237. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  14238. $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  14239. $l = strlen($match[1]);
  14240. if ($l % 2) {
  14241. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  14242. pack('H*', $match[2]),
  14243. 'UTF-8',
  14244. 'UCS-2BE'
  14245. );
  14246. }
  14247. return $match[0];
  14248. }, $buffer);
  14249. }
  14250. $result .= $buffer.$char;
  14251. $buffer = '';
  14252. continue;
  14253. }
  14254. if (':' === $char) {
  14255. $char .= ' ';
  14256. } elseif (('}' === $char || ']' === $char)) {
  14257. $pos--;
  14258. $prevChar = substr($json, $i - 1, 1);
  14259. if ('{' !== $prevChar && '[' !== $prevChar) {
  14260. $result .= $newLine;
  14261. for ($j = 0; $j < $pos; $j++) {
  14262. $result .= $indentStr;
  14263. }
  14264. } else {
  14265. $result = rtrim($result);
  14266. }
  14267. }
  14268. $result .= $char;
  14269. if (',' === $char || '{' === $char || '[' === $char) {
  14270. $result .= $newLine;
  14271. if ('{' === $char || '[' === $char) {
  14272. $pos++;
  14273. }
  14274. for ($j = 0; $j < $pos; $j++) {
  14275. $result .= $indentStr;
  14276. }
  14277. }
  14278. }
  14279. return $result;
  14280. }
  14281. }
  14282. <?php
  14283. namespace Composer\Json;
  14284. use Composer\Repository\PlatformRepository;
  14285. class JsonManipulator
  14286. {
  14287. private static $RECURSE_BLOCKS;
  14288. private static $RECURSE_ARRAYS;
  14289. private static $JSON_VALUE;
  14290. private static $JSON_STRING;
  14291. private $contents;
  14292. private $newline;
  14293. private $indent;
  14294. public function __construct($contents)
  14295. {
  14296. if (!self::$RECURSE_BLOCKS) {
  14297. self::$RECURSE_BLOCKS = '(?:[^{}]*+|\{(?:[^{}]*+|\{(?:[^{}]*+|\{(?:[^{}]*+|\{[^{}]*+\})*\})*\})*\})*';
  14298. self::$RECURSE_ARRAYS = '(?:[^\]]*+|\[(?:[^\]]*+|\[(?:[^\]]*+|\[(?:[^\]]*+|\[[^\]]*+\])*\])*\])*\]|'.self::$RECURSE_BLOCKS.')*';
  14299. self::$JSON_STRING = '"(?:[^\0-\x09\x0a-\x1f\\\\"]+|\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})*+"';
  14300. self::$JSON_VALUE = '(?:[0-9.]+|null|true|false|'.self::$JSON_STRING.'|\['.self::$RECURSE_ARRAYS.'\]|\{'.self::$RECURSE_BLOCKS.'\})';
  14301. }
  14302. $contents = trim($contents);
  14303. if ($contents === '') {
  14304. $contents = '{}';
  14305. }
  14306. if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
  14307. throw new \InvalidArgumentException('The json file must be an object ({})');
  14308. }
  14309. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  14310. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  14311. $this->detectIndenting();
  14312. }
  14313. public function getContents()
  14314. {
  14315. return $this->contents . $this->newline;
  14316. }
  14317. public function addLink($type, $package, $constraint, $sortPackages = false)
  14318. {
  14319. $decoded = JsonFile::parseJson($this->contents);
  14320. if (!isset($decoded[$type])) {
  14321. return $this->addMainKey($type, array($package => $constraint));
  14322. }
  14323. $regex = '{^(\s*\{\s*(?:'.self::$JSON_STRING.'\s*:\s*'.self::$JSON_VALUE.'\s*,\s*)*?)'.
  14324. '('.preg_quote(JsonFile::encode($type)).'\s*:\s*)('.self::$JSON_VALUE.')(.*)}s';
  14325. if (!$this->pregMatch($regex, $this->contents, $matches)) {
  14326. return false;
  14327. }
  14328. $links = $matches[3];
  14329. if (isset($decoded[$type][$package])) {
  14330. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  14331. $links = preg_replace_callback('{"'.$packageRegex.'"(\s*:\s*)'.self::$JSON_STRING.'}i', function ($m) use ($package, $constraint) {
  14332. return JsonFile::encode($package) . $m[1] . '"' . $constraint . '"';
  14333. }, $links);
  14334. } else {
  14335. if ($this->pregMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  14336. $links = preg_replace(
  14337. '{'.preg_quote($match[1]).'$}',
  14338. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  14339. $links
  14340. );
  14341. } else {
  14342. $links = '{' . $this->newline .
  14343. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  14344. $this->indent . '}';
  14345. }
  14346. }
  14347. if (true === $sortPackages) {
  14348. $requirements = json_decode($links, true);
  14349. $this->sortPackages($requirements);
  14350. $links = $this->format($requirements);
  14351. }
  14352. $this->contents = $matches[1] . $matches[2] . $links . $matches[4];
  14353. return true;
  14354. }
  14355. private function sortPackages(array &$packages = array())
  14356. {
  14357. $prefix = function ($requirement) {
  14358. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
  14359. return preg_replace(
  14360. array(
  14361. '/^php/',
  14362. '/^hhvm/',
  14363. '/^ext/',
  14364. '/^lib/',
  14365. '/^\D/',
  14366. ),
  14367. array(
  14368. '0-$0',
  14369. '1-$0',
  14370. '2-$0',
  14371. '3-$0',
  14372. '4-$0',
  14373. ),
  14374. $requirement
  14375. );
  14376. }
  14377. return '5-'.$requirement;
  14378. };
  14379. uksort($packages, function ($a, $b) use ($prefix) {
  14380. return strnatcmp($prefix($a), $prefix($b));
  14381. });
  14382. }
  14383. public function addRepository($name, $config)
  14384. {
  14385. return $this->addSubNode('repositories', $name, $config);
  14386. }
  14387. public function removeRepository($name)
  14388. {
  14389. return $this->removeSubNode('repositories', $name);
  14390. }
  14391. public function addConfigSetting($name, $value)
  14392. {
  14393. return $this->addSubNode('config', $name, $value);
  14394. }
  14395. public function removeConfigSetting($name)
  14396. {
  14397. return $this->removeSubNode('config', $name);
  14398. }
  14399. public function addProperty($name, $value)
  14400. {
  14401. if (substr($name, 0, 6) === 'extra.') {
  14402. return $this->addSubNode('extra', substr($name, 6), $value);
  14403. }
  14404. return $this->addMainKey($name, $value);
  14405. }
  14406. public function removeProperty($name)
  14407. {
  14408. if (substr($name, 0, 6) === 'extra.') {
  14409. return $this->removeSubNode('extra', substr($name, 6));
  14410. }
  14411. return $this->removeMainKey($name);
  14412. }
  14413. public function addSubNode($mainNode, $name, $value)
  14414. {
  14415. $decoded = JsonFile::parseJson($this->contents);
  14416. $subName = null;
  14417. if (in_array($mainNode, array('config', 'repositories', 'extra')) && false !== strpos($name, '.')) {
  14418. list($name, $subName) = explode('.', $name, 2);
  14419. }
  14420. if (!isset($decoded[$mainNode])) {
  14421. if ($subName !== null) {
  14422. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  14423. } else {
  14424. $this->addMainKey($mainNode, array($name => $value));
  14425. }
  14426. return true;
  14427. }
  14428. $nodeRegex = '{^(\s*\{\s*(?:'.self::$JSON_STRING.'\s*:\s*'.self::$JSON_VALUE.'\s*,\s*)*?)'.
  14429. '('.preg_quote(JsonFile::encode($mainNode)).'\s*:\s*\{)('.self::$RECURSE_BLOCKS.')(\})(.*)}s';
  14430. try {
  14431. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  14432. return false;
  14433. }
  14434. } catch (\RuntimeException $e) {
  14435. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  14436. return false;
  14437. }
  14438. throw $e;
  14439. }
  14440. $children = $match[3];
  14441. if (!@json_decode('{'.$children.'}')) {
  14442. return false;
  14443. }
  14444. $that = $this;
  14445. if ($this->pregMatch('{("'.preg_quote($name).'"\s*:\s*)('.self::$JSON_VALUE.')(,?)}', $children, $matches)) {
  14446. $children = preg_replace_callback('{("'.preg_quote($name).'"\s*:\s*)('.self::$JSON_VALUE.')(,?)}', function ($matches) use ($name, $subName, $value, $that) {
  14447. if ($subName !== null) {
  14448. $curVal = json_decode($matches[2], true);
  14449. if (!is_array($curVal)) {
  14450. $curVal = array();
  14451. }
  14452. $curVal[$subName] = $value;
  14453. $value = $curVal;
  14454. }
  14455. return $matches[1] . $that->format($value, 1) . $matches[3];
  14456. }, $children);
  14457. } elseif ($this->pregMatch('#[^\s](\s*)$#', $children, $match)) {
  14458. if ($subName !== null) {
  14459. $value = array($subName => $value);
  14460. }
  14461. $children = preg_replace(
  14462. '#'.$match[1].'$#',
  14463. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $match[1], '\\$'),
  14464. $children
  14465. );
  14466. } else {
  14467. if ($subName !== null) {
  14468. $value = array($subName => $value);
  14469. }
  14470. $children = $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $children;
  14471. }
  14472. $this->contents = preg_replace_callback($nodeRegex, function ($m) use ($children) {
  14473. return $m[1] . $m[2] . $children . $m[4] . $m[5];
  14474. }, $this->contents);
  14475. return true;
  14476. }
  14477. public function removeSubNode($mainNode, $name)
  14478. {
  14479. $decoded = JsonFile::parseJson($this->contents);
  14480. if (empty($decoded[$mainNode])) {
  14481. return true;
  14482. }
  14483. $nodeRegex = '{^(\s*\{\s*(?:'.self::$JSON_STRING.'\s*:\s*'.self::$JSON_VALUE.'\s*,\s*)*?)'.
  14484. '('.preg_quote(JsonFile::encode($mainNode)).'\s*:\s*\{)('.self::$RECURSE_BLOCKS.')(\})(.*)}s';
  14485. try {
  14486. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  14487. return false;
  14488. }
  14489. } catch (\RuntimeException $e) {
  14490. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  14491. return false;
  14492. }
  14493. throw $e;
  14494. }
  14495. $children = $match[3];
  14496. if (!@json_decode('{'.$children.'}', true)) {
  14497. return false;
  14498. }
  14499. $subName = null;
  14500. if (in_array($mainNode, array('config', 'repositories', 'extra')) && false !== strpos($name, '.')) {
  14501. list($name, $subName) = explode('.', $name, 2);
  14502. }
  14503. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  14504. return true;
  14505. }
  14506. if ($this->pregMatch('{"'.preg_quote($name).'"\s*:}i', $children)) {
  14507. if (preg_match_all('{"'.preg_quote($name).'"\s*:\s*(?:'.self::$JSON_VALUE.')}', $children, $matches)) {
  14508. $bestMatch = '';
  14509. foreach ($matches[0] as $match) {
  14510. if (strlen($bestMatch) < strlen($match)) {
  14511. $bestMatch = $match;
  14512. }
  14513. }
  14514. $childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  14515. if (1 !== $count) {
  14516. $childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  14517. if (1 !== $count) {
  14518. return false;
  14519. }
  14520. }
  14521. }
  14522. } else {
  14523. $childrenClean = $children;
  14524. }
  14525. if (!trim($childrenClean)) {
  14526. $this->contents = preg_replace($nodeRegex, '$1$2'.$this->newline.$this->indent.'$4$5', $this->contents);
  14527. if ($subName !== null) {
  14528. $curVal = json_decode('{'.$children.'}', true);
  14529. unset($curVal[$name][$subName]);
  14530. $this->addSubNode($mainNode, $name, $curVal[$name]);
  14531. }
  14532. return true;
  14533. }
  14534. $that = $this;
  14535. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
  14536. if ($subName !== null) {
  14537. $curVal = json_decode('{'.$matches[3].'}', true);
  14538. unset($curVal[$name][$subName]);
  14539. $childrenClean = substr($that->format($curVal, 0), 1, -1);
  14540. }
  14541. return $matches[1] . $matches[2] . $childrenClean . $matches[4] . $matches[5];
  14542. }, $this->contents);
  14543. return true;
  14544. }
  14545. public function addMainKey($key, $content)
  14546. {
  14547. $decoded = JsonFile::parseJson($this->contents);
  14548. $content = $this->format($content);
  14549. $regex = '{^(\s*\{\s*(?:'.self::$JSON_STRING.'\s*:\s*'.self::$JSON_VALUE.'\s*,\s*)*?)'.
  14550. '('.preg_quote(JsonFile::encode($key)).'\s*:\s*'.self::$JSON_VALUE.')(.*)}s';
  14551. if (isset($decoded[$key]) && $this->pregMatch($regex, $this->contents, $matches)) {
  14552. if (!@json_decode('{'.$matches[2].'}')) {
  14553. return false;
  14554. }
  14555. $this->contents = $matches[1] . JsonFile::encode($key).': '.$content . $matches[3];
  14556. return true;
  14557. }
  14558. if ($this->pregMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  14559. $this->contents = preg_replace(
  14560. '#'.$match[1].'\}$#',
  14561. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  14562. $this->contents
  14563. );
  14564. return true;
  14565. }
  14566. $this->contents = preg_replace(
  14567. '#\}$#',
  14568. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  14569. $this->contents
  14570. );
  14571. return true;
  14572. }
  14573. public function removeMainKey($key)
  14574. {
  14575. $decoded = JsonFile::parseJson($this->contents);
  14576. if (!isset($decoded[$key])) {
  14577. return true;
  14578. }
  14579. $regex = '{^(\s*\{\s*(?:'.self::$JSON_STRING.'\s*:\s*'.self::$JSON_VALUE.'\s*,\s*)*?)'.
  14580. '('.preg_quote(JsonFile::encode($key)).'\s*:\s*'.self::$JSON_VALUE.')\s*,?\s*(.*)}s';
  14581. if ($this->pregMatch($regex, $this->contents, $matches)) {
  14582. if (!@json_decode('{'.$matches[2].'}')) {
  14583. return false;
  14584. }
  14585. $this->contents = $matches[1] . $matches[3];
  14586. if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
  14587. $this->contents = "{\n}";
  14588. }
  14589. return true;
  14590. }
  14591. return false;
  14592. }
  14593. public function format($data, $depth = 0)
  14594. {
  14595. if (is_array($data)) {
  14596. reset($data);
  14597. if (is_numeric(key($data))) {
  14598. foreach ($data as $key => $val) {
  14599. $data[$key] = $this->format($val, $depth + 1);
  14600. }
  14601. return '['.implode(', ', $data).']';
  14602. }
  14603. $out = '{' . $this->newline;
  14604. $elems = array();
  14605. foreach ($data as $key => $val) {
  14606. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  14607. }
  14608. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  14609. }
  14610. return JsonFile::encode($data);
  14611. }
  14612. protected function detectIndenting()
  14613. {
  14614. if ($this->pregMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  14615. $this->indent = $match[1];
  14616. } else {
  14617. $this->indent = ' ';
  14618. }
  14619. }
  14620. protected function pregMatch($re, $str, &$matches = array())
  14621. {
  14622. $count = preg_match($re, $str, $matches);
  14623. if ($count === false) {
  14624. switch (preg_last_error()) {
  14625. case PREG_NO_ERROR:
  14626. throw new \RuntimeException('Failed to execute regex: PREG_NO_ERROR', PREG_NO_ERROR);
  14627. case PREG_INTERNAL_ERROR:
  14628. throw new \RuntimeException('Failed to execute regex: PREG_INTERNAL_ERROR', PREG_INTERNAL_ERROR);
  14629. case PREG_BACKTRACK_LIMIT_ERROR:
  14630. throw new \RuntimeException('Failed to execute regex: PREG_BACKTRACK_LIMIT_ERROR', PREG_BACKTRACK_LIMIT_ERROR);
  14631. case PREG_RECURSION_LIMIT_ERROR:
  14632. throw new \RuntimeException('Failed to execute regex: PREG_RECURSION_LIMIT_ERROR', PREG_RECURSION_LIMIT_ERROR);
  14633. case PREG_BAD_UTF8_ERROR:
  14634. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_ERROR', PREG_BAD_UTF8_ERROR);
  14635. case PREG_BAD_UTF8_OFFSET_ERROR:
  14636. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_OFFSET_ERROR', PREG_BAD_UTF8_OFFSET_ERROR);
  14637. case 6:
  14638. if (PHP_VERSION_ID > 70000) {
  14639. throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6);
  14640. }
  14641. default:
  14642. throw new \RuntimeException('Failed to execute regex: Unknown error');
  14643. }
  14644. }
  14645. return $count;
  14646. }
  14647. }
  14648. <?php
  14649. namespace Composer\Json;
  14650. use Exception;
  14651. class JsonValidationException extends Exception
  14652. {
  14653. protected $errors;
  14654. public function __construct($message, $errors = array(), Exception $previous = null)
  14655. {
  14656. $this->errors = $errors;
  14657. parent::__construct($message, 0, $previous);
  14658. }
  14659. public function getErrors()
  14660. {
  14661. return $this->errors;
  14662. }
  14663. }
  14664. <?php
  14665. namespace Composer\Package;
  14666. use Composer\Semver\Constraint\Constraint;
  14667. use Composer\Package\Version\VersionParser;
  14668. class AliasPackage extends BasePackage implements CompletePackageInterface
  14669. {
  14670. protected $version;
  14671. protected $prettyVersion;
  14672. protected $dev;
  14673. protected $rootPackageAlias = false;
  14674. protected $stability;
  14675. protected $aliasOf;
  14676. protected $requires;
  14677. protected $devRequires;
  14678. protected $conflicts;
  14679. protected $provides;
  14680. protected $replaces;
  14681. public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
  14682. {
  14683. parent::__construct($aliasOf->getName());
  14684. $this->version = $version;
  14685. $this->prettyVersion = $prettyVersion;
  14686. $this->aliasOf = $aliasOf;
  14687. $this->stability = VersionParser::parseStability($version);
  14688. $this->dev = $this->stability === 'dev';
  14689. foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
  14690. $links = $aliasOf->{'get' . ucfirst($type)}();
  14691. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  14692. }
  14693. }
  14694. public function getAliasOf()
  14695. {
  14696. return $this->aliasOf;
  14697. }
  14698. public function getVersion()
  14699. {
  14700. return $this->version;
  14701. }
  14702. public function getStability()
  14703. {
  14704. return $this->stability;
  14705. }
  14706. public function getPrettyVersion()
  14707. {
  14708. return $this->prettyVersion;
  14709. }
  14710. public function isDev()
  14711. {
  14712. return $this->dev;
  14713. }
  14714. public function getRequires()
  14715. {
  14716. return $this->requires;
  14717. }
  14718. public function getConflicts()
  14719. {
  14720. return $this->conflicts;
  14721. }
  14722. public function getProvides()
  14723. {
  14724. return $this->provides;
  14725. }
  14726. public function getReplaces()
  14727. {
  14728. return $this->replaces;
  14729. }
  14730. public function getDevRequires()
  14731. {
  14732. return $this->devRequires;
  14733. }
  14734. public function setRootPackageAlias($value)
  14735. {
  14736. return $this->rootPackageAlias = $value;
  14737. }
  14738. public function isRootPackageAlias()
  14739. {
  14740. return $this->rootPackageAlias;
  14741. }
  14742. protected function replaceSelfVersionDependencies(array $links, $linkType)
  14743. {
  14744. if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
  14745. $newLinks = array();
  14746. foreach ($links as $link) {
  14747. if ('self.version' === $link->getPrettyConstraint()) {
  14748. $newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  14749. }
  14750. }
  14751. $links = array_merge($links, $newLinks);
  14752. } else {
  14753. foreach ($links as $index => $link) {
  14754. if ('self.version' === $link->getPrettyConstraint()) {
  14755. $links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  14756. }
  14757. }
  14758. }
  14759. return $links;
  14760. }
  14761. public function getType()
  14762. {
  14763. return $this->aliasOf->getType();
  14764. }
  14765. public function getTargetDir()
  14766. {
  14767. return $this->aliasOf->getTargetDir();
  14768. }
  14769. public function getExtra()
  14770. {
  14771. return $this->aliasOf->getExtra();
  14772. }
  14773. public function setInstallationSource($type)
  14774. {
  14775. $this->aliasOf->setInstallationSource($type);
  14776. }
  14777. public function getInstallationSource()
  14778. {
  14779. return $this->aliasOf->getInstallationSource();
  14780. }
  14781. public function getSourceType()
  14782. {
  14783. return $this->aliasOf->getSourceType();
  14784. }
  14785. public function getSourceUrl()
  14786. {
  14787. return $this->aliasOf->getSourceUrl();
  14788. }
  14789. public function getSourceUrls()
  14790. {
  14791. return $this->aliasOf->getSourceUrls();
  14792. }
  14793. public function getSourceReference()
  14794. {
  14795. return $this->aliasOf->getSourceReference();
  14796. }
  14797. public function setSourceReference($reference)
  14798. {
  14799. return $this->aliasOf->setSourceReference($reference);
  14800. }
  14801. public function setSourceMirrors($mirrors)
  14802. {
  14803. return $this->aliasOf->setSourceMirrors($mirrors);
  14804. }
  14805. public function getSourceMirrors()
  14806. {
  14807. return $this->aliasOf->getSourceMirrors();
  14808. }
  14809. public function getDistType()
  14810. {
  14811. return $this->aliasOf->getDistType();
  14812. }
  14813. public function getDistUrl()
  14814. {
  14815. return $this->aliasOf->getDistUrl();
  14816. }
  14817. public function getDistUrls()
  14818. {
  14819. return $this->aliasOf->getDistUrls();
  14820. }
  14821. public function getDistReference()
  14822. {
  14823. return $this->aliasOf->getDistReference();
  14824. }
  14825. public function setDistReference($reference)
  14826. {
  14827. return $this->aliasOf->setDistReference($reference);
  14828. }
  14829. public function getDistSha1Checksum()
  14830. {
  14831. return $this->aliasOf->getDistSha1Checksum();
  14832. }
  14833. public function setTransportOptions(array $options)
  14834. {
  14835. return $this->aliasOf->setTransportOptions($options);
  14836. }
  14837. public function getTransportOptions()
  14838. {
  14839. return $this->aliasOf->getTransportOptions();
  14840. }
  14841. public function setDistMirrors($mirrors)
  14842. {
  14843. return $this->aliasOf->setDistMirrors($mirrors);
  14844. }
  14845. public function getDistMirrors()
  14846. {
  14847. return $this->aliasOf->getDistMirrors();
  14848. }
  14849. public function getScripts()
  14850. {
  14851. return $this->aliasOf->getScripts();
  14852. }
  14853. public function getLicense()
  14854. {
  14855. return $this->aliasOf->getLicense();
  14856. }
  14857. public function getAutoload()
  14858. {
  14859. return $this->aliasOf->getAutoload();
  14860. }
  14861. public function getDevAutoload()
  14862. {
  14863. return $this->aliasOf->getDevAutoload();
  14864. }
  14865. public function getIncludePaths()
  14866. {
  14867. return $this->aliasOf->getIncludePaths();
  14868. }
  14869. public function getRepositories()
  14870. {
  14871. return $this->aliasOf->getRepositories();
  14872. }
  14873. public function getReleaseDate()
  14874. {
  14875. return $this->aliasOf->getReleaseDate();
  14876. }
  14877. public function getBinaries()
  14878. {
  14879. return $this->aliasOf->getBinaries();
  14880. }
  14881. public function getKeywords()
  14882. {
  14883. return $this->aliasOf->getKeywords();
  14884. }
  14885. public function getDescription()
  14886. {
  14887. return $this->aliasOf->getDescription();
  14888. }
  14889. public function getHomepage()
  14890. {
  14891. return $this->aliasOf->getHomepage();
  14892. }
  14893. public function getSuggests()
  14894. {
  14895. return $this->aliasOf->getSuggests();
  14896. }
  14897. public function getAuthors()
  14898. {
  14899. return $this->aliasOf->getAuthors();
  14900. }
  14901. public function getSupport()
  14902. {
  14903. return $this->aliasOf->getSupport();
  14904. }
  14905. public function getNotificationUrl()
  14906. {
  14907. return $this->aliasOf->getNotificationUrl();
  14908. }
  14909. public function getArchiveExcludes()
  14910. {
  14911. return $this->aliasOf->getArchiveExcludes();
  14912. }
  14913. public function isAbandoned()
  14914. {
  14915. return $this->aliasOf->isAbandoned();
  14916. }
  14917. public function getReplacementPackage()
  14918. {
  14919. return $this->aliasOf->getReplacementPackage();
  14920. }
  14921. public function __toString()
  14922. {
  14923. return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
  14924. }
  14925. }
  14926. <?php
  14927. namespace Composer\Package\Archiver;
  14928. use FilterIterator;
  14929. use PharData;
  14930. class ArchivableFilesFilter extends FilterIterator
  14931. {
  14932. private $dirs = array();
  14933. public function accept()
  14934. {
  14935. $file = $this->getInnerIterator()->current();
  14936. if ($file->isDir()) {
  14937. $this->dirs[] = (string)$file;
  14938. return false;
  14939. }
  14940. return true;
  14941. }
  14942. public function addEmptyDir(PharData $phar, $sources)
  14943. {
  14944. foreach ($this->dirs as $filepath) {
  14945. $localname = str_replace($sources . "/", '', $filepath);
  14946. $phar->addEmptyDir($localname);
  14947. }
  14948. }
  14949. }
  14950. <?php
  14951. namespace Composer\Package\Archiver;
  14952. use Composer\Util\Filesystem;
  14953. use FilesystemIterator;
  14954. use Symfony\Component\Finder\Finder;
  14955. use Symfony\Component\Finder\SplFileInfo;
  14956. class ArchivableFilesFinder extends \FilterIterator
  14957. {
  14958. protected $finder;
  14959. public function __construct($sources, array $excludes)
  14960. {
  14961. $fs = new Filesystem();
  14962. $sources = $fs->normalizePath($sources);
  14963. $filters = array(
  14964. new HgExcludeFilter($sources),
  14965. new GitExcludeFilter($sources),
  14966. new ComposerExcludeFilter($sources, $excludes),
  14967. );
  14968. $this->finder = new Finder();
  14969. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs) {
  14970. if ($file->isLink() && strpos($file->getLinkTarget(), $sources) !== 0) {
  14971. return false;
  14972. }
  14973. $relativePath = preg_replace(
  14974. '#^'.preg_quote($sources, '#').'#',
  14975. '',
  14976. $fs->normalizePath($file->getRealPath())
  14977. );
  14978. $exclude = false;
  14979. foreach ($filters as $filter) {
  14980. $exclude = $filter->filter($relativePath, $exclude);
  14981. }
  14982. return !$exclude;
  14983. };
  14984. if (method_exists($filter, 'bindTo')) {
  14985. $filter = $filter->bindTo(null);
  14986. }
  14987. $this->finder
  14988. ->in($sources)
  14989. ->filter($filter)
  14990. ->ignoreVCS(true)
  14991. ->ignoreDotFiles(false);
  14992. parent::__construct($this->finder->getIterator());
  14993. }
  14994. public function accept()
  14995. {
  14996. $current = $this->getInnerIterator()->current();
  14997. if (!$current->isDir()) {
  14998. return true;
  14999. }
  15000. $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS);
  15001. return !$iterator->valid();
  15002. }
  15003. }
  15004. <?php
  15005. namespace Composer\Package\Archiver;
  15006. use Composer\Downloader\DownloadManager;
  15007. use Composer\Package\PackageInterface;
  15008. use Composer\Package\RootPackageInterface;
  15009. use Composer\Util\Filesystem;
  15010. use Composer\Json\JsonFile;
  15011. class ArchiveManager
  15012. {
  15013. protected $downloadManager;
  15014. protected $archivers = array();
  15015. protected $overwriteFiles = true;
  15016. public function __construct(DownloadManager $downloadManager)
  15017. {
  15018. $this->downloadManager = $downloadManager;
  15019. }
  15020. public function addArchiver(ArchiverInterface $archiver)
  15021. {
  15022. $this->archivers[] = $archiver;
  15023. }
  15024. public function setOverwriteFiles($overwriteFiles)
  15025. {
  15026. $this->overwriteFiles = $overwriteFiles;
  15027. return $this;
  15028. }
  15029. public function getPackageFilename(PackageInterface $package)
  15030. {
  15031. $nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
  15032. if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  15033. $nameParts = array_merge($nameParts, array($package->getDistReference(), $package->getDistType()));
  15034. } else {
  15035. $nameParts = array_merge($nameParts, array($package->getPrettyVersion(), $package->getDistReference()));
  15036. }
  15037. if ($package->getSourceReference()) {
  15038. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  15039. }
  15040. $name = implode('-', array_filter($nameParts, function ($p) {
  15041. return !empty($p);
  15042. }));
  15043. return str_replace('/', '-', $name);
  15044. }
  15045. public function archive(PackageInterface $package, $format, $targetDir, $fileName = null)
  15046. {
  15047. if (empty($format)) {
  15048. throw new \InvalidArgumentException('Format must be specified');
  15049. }
  15050. $usableArchiver = null;
  15051. foreach ($this->archivers as $archiver) {
  15052. if ($archiver->supports($format, $package->getSourceType())) {
  15053. $usableArchiver = $archiver;
  15054. break;
  15055. }
  15056. }
  15057. if (null === $usableArchiver) {
  15058. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  15059. }
  15060. $filesystem = new Filesystem();
  15061. if (null === $fileName) {
  15062. $packageName = $this->getPackageFilename($package);
  15063. } else {
  15064. $packageName = $fileName;
  15065. }
  15066. $filesystem->ensureDirectoryExists($targetDir);
  15067. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  15068. $filesystem->ensureDirectoryExists(dirname($target));
  15069. if (!$this->overwriteFiles && file_exists($target)) {
  15070. return $target;
  15071. }
  15072. if ($package instanceof RootPackageInterface) {
  15073. $sourcePath = realpath('.');
  15074. } else {
  15075. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  15076. $filesystem->ensureDirectoryExists($sourcePath);
  15077. $this->downloadManager->download($package, $sourcePath);
  15078. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  15079. $jsonFile = new JsonFile($composerJsonPath);
  15080. $jsonData = $jsonFile->read();
  15081. if (!empty($jsonData['archive']['exclude'])) {
  15082. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  15083. }
  15084. }
  15085. }
  15086. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  15087. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  15088. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes());
  15089. rename($archivePath, $target);
  15090. if (!$package instanceof RootPackageInterface) {
  15091. $filesystem->removeDirectory($sourcePath);
  15092. }
  15093. $filesystem->remove($tempTarget);
  15094. return $target;
  15095. }
  15096. }
  15097. <?php
  15098. namespace Composer\Package\Archiver;
  15099. interface ArchiverInterface
  15100. {
  15101. public function archive($sources, $target, $format, array $excludes = array());
  15102. public function supports($format, $sourceType);
  15103. }
  15104. <?php
  15105. namespace Composer\Package\Archiver;
  15106. use Symfony\Component\Finder;
  15107. abstract class BaseExcludeFilter
  15108. {
  15109. protected $sourcePath;
  15110. protected $excludePatterns;
  15111. public function __construct($sourcePath)
  15112. {
  15113. $this->sourcePath = $sourcePath;
  15114. $this->excludePatterns = array();
  15115. }
  15116. public function filter($relativePath, $exclude)
  15117. {
  15118. foreach ($this->excludePatterns as $patternData) {
  15119. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  15120. if ($stripLeadingSlash) {
  15121. $path = substr($relativePath, 1);
  15122. } else {
  15123. $path = $relativePath;
  15124. }
  15125. if (preg_match($pattern, $path)) {
  15126. $exclude = !$negate;
  15127. }
  15128. }
  15129. return $exclude;
  15130. }
  15131. protected function parseLines(array $lines, $lineParser)
  15132. {
  15133. return array_filter(
  15134. array_map(
  15135. function ($line) use ($lineParser) {
  15136. $line = trim($line);
  15137. if (!$line || 0 === strpos($line, '#')) {
  15138. return null;
  15139. }
  15140. return call_user_func($lineParser, $line);
  15141. },
  15142. $lines
  15143. ),
  15144. function ($pattern) {
  15145. return $pattern !== null;
  15146. }
  15147. );
  15148. }
  15149. protected function generatePatterns($rules)
  15150. {
  15151. $patterns = array();
  15152. foreach ($rules as $rule) {
  15153. $patterns[] = $this->generatePattern($rule);
  15154. }
  15155. return $patterns;
  15156. }
  15157. protected function generatePattern($rule)
  15158. {
  15159. $negate = false;
  15160. $pattern = '{';
  15161. if (strlen($rule) && $rule[0] === '!') {
  15162. $negate = true;
  15163. $rule = substr($rule, 1);
  15164. }
  15165. if (strlen($rule) && $rule[0] === '/') {
  15166. $pattern .= '^/';
  15167. $rule = substr($rule, 1);
  15168. } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
  15169. $pattern .= '/';
  15170. $rule = substr($rule, 0, -1);
  15171. } elseif (false === strpos($rule, '/')) {
  15172. $pattern .= '/';
  15173. }
  15174. $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2) . '(?=$|/)';
  15175. return array($pattern . '}', $negate, false);
  15176. }
  15177. }
  15178. <?php
  15179. namespace Composer\Package\Archiver;
  15180. class ComposerExcludeFilter extends BaseExcludeFilter
  15181. {
  15182. public function __construct($sourcePath, array $excludeRules)
  15183. {
  15184. parent::__construct($sourcePath);
  15185. $this->excludePatterns = $this->generatePatterns($excludeRules);
  15186. }
  15187. }
  15188. <?php
  15189. namespace Composer\Package\Archiver;
  15190. class GitExcludeFilter extends BaseExcludeFilter
  15191. {
  15192. public function __construct($sourcePath)
  15193. {
  15194. parent::__construct($sourcePath);
  15195. if (file_exists($sourcePath.'/.gitignore')) {
  15196. $this->excludePatterns = $this->parseLines(
  15197. file($sourcePath.'/.gitignore'),
  15198. array($this, 'parseGitIgnoreLine')
  15199. );
  15200. }
  15201. if (file_exists($sourcePath.'/.gitattributes')) {
  15202. $this->excludePatterns = array_merge(
  15203. $this->excludePatterns,
  15204. $this->parseLines(
  15205. file($sourcePath.'/.gitattributes'),
  15206. array($this, 'parseGitAttributesLine')
  15207. ));
  15208. }
  15209. }
  15210. public function parseGitIgnoreLine($line)
  15211. {
  15212. return $this->generatePattern($line);
  15213. }
  15214. public function parseGitAttributesLine($line)
  15215. {
  15216. $parts = preg_split('#\s+#', $line);
  15217. if (count($parts) == 2 && $parts[1] === 'export-ignore') {
  15218. return $this->generatePattern($parts[0]);
  15219. }
  15220. return null;
  15221. }
  15222. }
  15223. <?php
  15224. namespace Composer\Package\Archiver;
  15225. use Symfony\Component\Finder;
  15226. class HgExcludeFilter extends BaseExcludeFilter
  15227. {
  15228. const HG_IGNORE_REGEX = 1;
  15229. const HG_IGNORE_GLOB = 2;
  15230. protected $patternMode;
  15231. public function __construct($sourcePath)
  15232. {
  15233. parent::__construct($sourcePath);
  15234. $this->patternMode = self::HG_IGNORE_REGEX;
  15235. if (file_exists($sourcePath.'/.hgignore')) {
  15236. $this->excludePatterns = $this->parseLines(
  15237. file($sourcePath.'/.hgignore'),
  15238. array($this, 'parseHgIgnoreLine')
  15239. );
  15240. }
  15241. }
  15242. public function parseHgIgnoreLine($line)
  15243. {
  15244. if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
  15245. if ($matches[1] === 'glob') {
  15246. $this->patternMode = self::HG_IGNORE_GLOB;
  15247. } else {
  15248. $this->patternMode = self::HG_IGNORE_REGEX;
  15249. }
  15250. return null;
  15251. }
  15252. if ($this->patternMode == self::HG_IGNORE_GLOB) {
  15253. return $this->patternFromGlob($line);
  15254. } else {
  15255. return $this->patternFromRegex($line);
  15256. }
  15257. }
  15258. protected function patternFromGlob($line)
  15259. {
  15260. $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
  15261. $pattern = str_replace('[^/]*', '.*', $pattern);
  15262. return array($pattern, false, true);
  15263. }
  15264. public function patternFromRegex($line)
  15265. {
  15266. $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
  15267. return array($pattern, false, true);
  15268. }
  15269. }
  15270. <?php
  15271. namespace Composer\Package\Archiver;
  15272. class PharArchiver implements ArchiverInterface
  15273. {
  15274. protected static $formats = array(
  15275. 'zip' => \Phar::ZIP,
  15276. 'tar' => \Phar::TAR,
  15277. 'tar.gz' => \Phar::TAR,
  15278. 'tar.bz2' => \Phar::TAR,
  15279. );
  15280. protected static $compressFormats = array(
  15281. 'tar.gz' => \Phar::GZ,
  15282. 'tar.bz2' => \Phar::BZ2,
  15283. );
  15284. public function archive($sources, $target, $format, array $excludes = array())
  15285. {
  15286. $sources = realpath($sources);
  15287. if (file_exists($target)) {
  15288. unlink($target);
  15289. }
  15290. try {
  15291. $filename = substr($target, 0, strrpos($target, $format) - 1);
  15292. if (isset(static::$compressFormats[$format])) {
  15293. $target = $filename . '.tar';
  15294. }
  15295. $phar = new \PharData($target, null, null, static::$formats[$format]);
  15296. $files = new ArchivableFilesFinder($sources, $excludes);
  15297. $filesOnly = new ArchivableFilesFilter($files);
  15298. $phar->buildFromIterator($filesOnly, $sources);
  15299. $filesOnly->addEmptyDir($phar, $sources);
  15300. if (isset(static::$compressFormats[$format])) {
  15301. if (!$phar->canCompress(static::$compressFormats[$format])) {
  15302. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  15303. }
  15304. unlink($target);
  15305. $phar->compress(static::$compressFormats[$format]);
  15306. $target = $filename . '.' . $format;
  15307. }
  15308. return $target;
  15309. } catch (\UnexpectedValueException $e) {
  15310. $message = sprintf("Could not create archive '%s' from '%s': %s",
  15311. $target,
  15312. $sources,
  15313. $e->getMessage()
  15314. );
  15315. throw new \RuntimeException($message, $e->getCode(), $e);
  15316. }
  15317. }
  15318. public function supports($format, $sourceType)
  15319. {
  15320. return isset(static::$formats[$format]);
  15321. }
  15322. }
  15323. <?php
  15324. namespace Composer\Package\Archiver;
  15325. use ZipArchive;
  15326. use Composer\Util\Filesystem;
  15327. class ZipArchiver implements ArchiverInterface
  15328. {
  15329. protected static $formats = array(
  15330. 'zip' => 1,
  15331. );
  15332. public function archive($sources, $target, $format, array $excludes = array())
  15333. {
  15334. $fs = new Filesystem();
  15335. $sources = $fs->normalizePath($sources);
  15336. $zip = new ZipArchive();
  15337. $res = $zip->open($target, ZipArchive::CREATE);
  15338. if ($res === true) {
  15339. $files = new ArchivableFilesFinder($sources, $excludes);
  15340. foreach ($files as $file) {
  15341. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  15342. $localname = str_replace($sources.'/', '', $filepath);
  15343. if ($file->isDir()) {
  15344. $zip->addEmptyDir($localname);
  15345. } else {
  15346. $zip->addFile($filepath, $localname);
  15347. }
  15348. }
  15349. if ($zip->close()) {
  15350. return $target;
  15351. }
  15352. }
  15353. $message = sprintf("Could not create archive '%s' from '%s': %s",
  15354. $target,
  15355. $sources,
  15356. $zip->getStatusString()
  15357. );
  15358. throw new \RuntimeException($message);
  15359. }
  15360. public function supports($format, $sourceType)
  15361. {
  15362. return isset(static::$formats[$format]) && $this->compressionAvailable();
  15363. }
  15364. private function compressionAvailable()
  15365. {
  15366. return class_exists('ZipArchive');
  15367. }
  15368. }
  15369. <?php
  15370. namespace Composer\Package;
  15371. use Composer\Repository\RepositoryInterface;
  15372. use Composer\Repository\PlatformRepository;
  15373. abstract class BasePackage implements PackageInterface
  15374. {
  15375. public static $supportedLinkTypes = array(
  15376. 'require' => array('description' => 'requires', 'method' => 'requires'),
  15377. 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
  15378. 'provide' => array('description' => 'provides', 'method' => 'provides'),
  15379. 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
  15380. 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
  15381. );
  15382. const STABILITY_STABLE = 0;
  15383. const STABILITY_RC = 5;
  15384. const STABILITY_BETA = 10;
  15385. const STABILITY_ALPHA = 15;
  15386. const STABILITY_DEV = 20;
  15387. public static $stabilities = array(
  15388. 'stable' => self::STABILITY_STABLE,
  15389. 'RC' => self::STABILITY_RC,
  15390. 'beta' => self::STABILITY_BETA,
  15391. 'alpha' => self::STABILITY_ALPHA,
  15392. 'dev' => self::STABILITY_DEV,
  15393. );
  15394. public $id;
  15395. protected $name;
  15396. protected $prettyName;
  15397. protected $repository;
  15398. protected $transportOptions;
  15399. public function __construct($name)
  15400. {
  15401. $this->prettyName = $name;
  15402. $this->name = strtolower($name);
  15403. $this->id = -1;
  15404. $this->transportOptions = array();
  15405. }
  15406. public function getName()
  15407. {
  15408. return $this->name;
  15409. }
  15410. public function getPrettyName()
  15411. {
  15412. return $this->prettyName;
  15413. }
  15414. public function getNames()
  15415. {
  15416. $names = array(
  15417. $this->getName() => true,
  15418. );
  15419. foreach ($this->getProvides() as $link) {
  15420. $names[$link->getTarget()] = true;
  15421. }
  15422. foreach ($this->getReplaces() as $link) {
  15423. $names[$link->getTarget()] = true;
  15424. }
  15425. return array_keys($names);
  15426. }
  15427. public function setId($id)
  15428. {
  15429. $this->id = $id;
  15430. }
  15431. public function getId()
  15432. {
  15433. return $this->id;
  15434. }
  15435. public function setRepository(RepositoryInterface $repository)
  15436. {
  15437. if ($this->repository && $repository !== $this->repository) {
  15438. throw new \LogicException('A package can only be added to one repository');
  15439. }
  15440. $this->repository = $repository;
  15441. }
  15442. public function getRepository()
  15443. {
  15444. return $this->repository;
  15445. }
  15446. public function getTransportOptions()
  15447. {
  15448. return $this->transportOptions;
  15449. }
  15450. public function setTransportOptions(array $options)
  15451. {
  15452. $this->transportOptions = $options;
  15453. }
  15454. public function isPlatform()
  15455. {
  15456. return $this->getRepository() instanceof PlatformRepository;
  15457. }
  15458. public function getUniqueName()
  15459. {
  15460. return $this->getName().'-'.$this->getVersion();
  15461. }
  15462. public function equals(PackageInterface $package)
  15463. {
  15464. $self = $this;
  15465. if ($this instanceof AliasPackage) {
  15466. $self = $this->getAliasOf();
  15467. }
  15468. if ($package instanceof AliasPackage) {
  15469. $package = $package->getAliasOf();
  15470. }
  15471. return $package === $self;
  15472. }
  15473. public function __toString()
  15474. {
  15475. return $this->getUniqueName();
  15476. }
  15477. public function getPrettyString()
  15478. {
  15479. return $this->getPrettyName().' '.$this->getPrettyVersion();
  15480. }
  15481. public function getFullPrettyVersion($truncate = true)
  15482. {
  15483. if (!$this->isDev() || !in_array($this->getSourceType(), array('hg', 'git'))) {
  15484. return $this->getPrettyVersion();
  15485. }
  15486. if ($truncate && strlen($this->getSourceReference()) === 40) {
  15487. return $this->getPrettyVersion() . ' ' . substr($this->getSourceReference(), 0, 7);
  15488. }
  15489. return $this->getPrettyVersion() . ' ' . $this->getSourceReference();
  15490. }
  15491. public function getStabilityPriority()
  15492. {
  15493. return self::$stabilities[$this->getStability()];
  15494. }
  15495. public function __clone()
  15496. {
  15497. $this->repository = null;
  15498. $this->id = -1;
  15499. }
  15500. }
  15501. <?php
  15502. namespace Composer\Package;
  15503. class CompletePackage extends Package implements CompletePackageInterface
  15504. {
  15505. protected $repositories;
  15506. protected $license = array();
  15507. protected $keywords;
  15508. protected $authors;
  15509. protected $description;
  15510. protected $homepage;
  15511. protected $scripts = array();
  15512. protected $support = array();
  15513. protected $abandoned = false;
  15514. public function setScripts(array $scripts)
  15515. {
  15516. $this->scripts = $scripts;
  15517. }
  15518. public function getScripts()
  15519. {
  15520. return $this->scripts;
  15521. }
  15522. public function setRepositories($repositories)
  15523. {
  15524. $this->repositories = $repositories;
  15525. }
  15526. public function getRepositories()
  15527. {
  15528. return $this->repositories;
  15529. }
  15530. public function setLicense(array $license)
  15531. {
  15532. $this->license = $license;
  15533. }
  15534. public function getLicense()
  15535. {
  15536. return $this->license;
  15537. }
  15538. public function setKeywords(array $keywords)
  15539. {
  15540. $this->keywords = $keywords;
  15541. }
  15542. public function getKeywords()
  15543. {
  15544. return $this->keywords;
  15545. }
  15546. public function setAuthors(array $authors)
  15547. {
  15548. $this->authors = $authors;
  15549. }
  15550. public function getAuthors()
  15551. {
  15552. return $this->authors;
  15553. }
  15554. public function setDescription($description)
  15555. {
  15556. $this->description = $description;
  15557. }
  15558. public function getDescription()
  15559. {
  15560. return $this->description;
  15561. }
  15562. public function setHomepage($homepage)
  15563. {
  15564. $this->homepage = $homepage;
  15565. }
  15566. public function getHomepage()
  15567. {
  15568. return $this->homepage;
  15569. }
  15570. public function setSupport(array $support)
  15571. {
  15572. $this->support = $support;
  15573. }
  15574. public function getSupport()
  15575. {
  15576. return $this->support;
  15577. }
  15578. public function isAbandoned()
  15579. {
  15580. return (boolean) $this->abandoned;
  15581. }
  15582. public function setAbandoned($abandoned)
  15583. {
  15584. $this->abandoned = $abandoned;
  15585. }
  15586. public function getReplacementPackage()
  15587. {
  15588. return is_string($this->abandoned) ? $this->abandoned : null;
  15589. }
  15590. }
  15591. <?php
  15592. namespace Composer\Package;
  15593. interface CompletePackageInterface extends PackageInterface
  15594. {
  15595. public function getScripts();
  15596. public function getRepositories();
  15597. public function getLicense();
  15598. public function getKeywords();
  15599. public function getDescription();
  15600. public function getHomepage();
  15601. public function getAuthors();
  15602. public function getSupport();
  15603. public function isAbandoned();
  15604. public function getReplacementPackage();
  15605. }
  15606. <?php
  15607. namespace Composer\Package\Dumper;
  15608. use Composer\Package\BasePackage;
  15609. use Composer\Package\PackageInterface;
  15610. use Composer\Package\CompletePackageInterface;
  15611. use Composer\Package\RootPackageInterface;
  15612. class ArrayDumper
  15613. {
  15614. public function dump(PackageInterface $package)
  15615. {
  15616. $keys = array(
  15617. 'binaries' => 'bin',
  15618. 'type',
  15619. 'extra',
  15620. 'installationSource' => 'installation-source',
  15621. 'autoload',
  15622. 'devAutoload' => 'autoload-dev',
  15623. 'notificationUrl' => 'notification-url',
  15624. 'includePaths' => 'include-path',
  15625. );
  15626. $data = array();
  15627. $data['name'] = $package->getPrettyName();
  15628. $data['version'] = $package->getPrettyVersion();
  15629. $data['version_normalized'] = $package->getVersion();
  15630. if ($package->getTargetDir()) {
  15631. $data['target-dir'] = $package->getTargetDir();
  15632. }
  15633. if ($package->getSourceType()) {
  15634. $data['source']['type'] = $package->getSourceType();
  15635. $data['source']['url'] = $package->getSourceUrl();
  15636. $data['source']['reference'] = $package->getSourceReference();
  15637. if ($mirrors = $package->getSourceMirrors()) {
  15638. $data['source']['mirrors'] = $mirrors;
  15639. }
  15640. }
  15641. if ($package->getDistType()) {
  15642. $data['dist']['type'] = $package->getDistType();
  15643. $data['dist']['url'] = $package->getDistUrl();
  15644. $data['dist']['reference'] = $package->getDistReference();
  15645. $data['dist']['shasum'] = $package->getDistSha1Checksum();
  15646. if ($mirrors = $package->getDistMirrors()) {
  15647. $data['dist']['mirrors'] = $mirrors;
  15648. }
  15649. }
  15650. if ($package->getArchiveExcludes()) {
  15651. $data['archive']['exclude'] = $package->getArchiveExcludes();
  15652. }
  15653. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  15654. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  15655. foreach ($links as $link) {
  15656. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  15657. }
  15658. ksort($data[$type]);
  15659. }
  15660. }
  15661. if ($packages = $package->getSuggests()) {
  15662. ksort($packages);
  15663. $data['suggest'] = $packages;
  15664. }
  15665. if ($package->getReleaseDate()) {
  15666. $data['time'] = $package->getReleaseDate()->format('Y-m-d H:i:s');
  15667. }
  15668. $data = $this->dumpValues($package, $keys, $data);
  15669. if ($package instanceof CompletePackageInterface) {
  15670. $keys = array(
  15671. 'scripts',
  15672. 'license',
  15673. 'authors',
  15674. 'description',
  15675. 'homepage',
  15676. 'keywords',
  15677. 'repositories',
  15678. 'support',
  15679. );
  15680. $data = $this->dumpValues($package, $keys, $data);
  15681. if (isset($data['keywords']) && is_array($data['keywords'])) {
  15682. sort($data['keywords']);
  15683. }
  15684. if ($package->isAbandoned()) {
  15685. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  15686. }
  15687. }
  15688. if ($package instanceof RootPackageInterface) {
  15689. $minimumStability = $package->getMinimumStability();
  15690. if ($minimumStability) {
  15691. $data['minimum-stability'] = $minimumStability;
  15692. }
  15693. }
  15694. if (count($package->getTransportOptions()) > 0) {
  15695. $data['transport-options'] = $package->getTransportOptions();
  15696. }
  15697. return $data;
  15698. }
  15699. private function dumpValues(PackageInterface $package, array $keys, array $data)
  15700. {
  15701. foreach ($keys as $method => $key) {
  15702. if (is_numeric($method)) {
  15703. $method = $key;
  15704. }
  15705. $getter = 'get'.ucfirst($method);
  15706. $value = $package->$getter();
  15707. if (null !== $value && !(is_array($value) && 0 === count($value))) {
  15708. $data[$key] = $value;
  15709. }
  15710. }
  15711. return $data;
  15712. }
  15713. }
  15714. <?php
  15715. namespace Composer\Package;
  15716. use Composer\Semver\Constraint\ConstraintInterface;
  15717. class Link
  15718. {
  15719. protected $source;
  15720. protected $target;
  15721. protected $constraint;
  15722. protected $description;
  15723. protected $prettyConstraint;
  15724. public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
  15725. {
  15726. $this->source = strtolower($source);
  15727. $this->target = strtolower($target);
  15728. $this->constraint = $constraint;
  15729. $this->description = $description;
  15730. $this->prettyConstraint = $prettyConstraint;
  15731. }
  15732. public function getDescription()
  15733. {
  15734. return $this->description;
  15735. }
  15736. public function getSource()
  15737. {
  15738. return $this->source;
  15739. }
  15740. public function getTarget()
  15741. {
  15742. return $this->target;
  15743. }
  15744. public function getConstraint()
  15745. {
  15746. return $this->constraint;
  15747. }
  15748. public function getPrettyConstraint()
  15749. {
  15750. if (null === $this->prettyConstraint) {
  15751. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  15752. }
  15753. return $this->prettyConstraint;
  15754. }
  15755. public function __toString()
  15756. {
  15757. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  15758. }
  15759. public function getPrettyString(PackageInterface $sourcePackage)
  15760. {
  15761. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
  15762. }
  15763. }
  15764. <?php
  15765. namespace Composer\Package\LinkConstraint;
  15766. use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
  15767. trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
  15768. class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
  15769. {
  15770. }
  15771. <?php
  15772. namespace Composer\Package\LinkConstraint;
  15773. use Composer\Semver\Constraint\ConstraintInterface;
  15774. trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
  15775. interface LinkConstraintInterface extends ConstraintInterface
  15776. {
  15777. }
  15778. <?php
  15779. namespace Composer\Package\LinkConstraint;
  15780. use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
  15781. trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
  15782. class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
  15783. {
  15784. }
  15785. <?php
  15786. namespace Composer\Package\LinkConstraint;
  15787. use Composer\Semver\Constraint\AbstractConstraint;
  15788. trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
  15789. abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
  15790. {
  15791. }
  15792. <?php
  15793. namespace Composer\Package\LinkConstraint;
  15794. use Composer\Semver\Constraint\Constraint;
  15795. trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
  15796. class VersionConstraint extends Constraint implements LinkConstraintInterface
  15797. {
  15798. }
  15799. <?php
  15800. namespace Composer\Package\Loader;
  15801. use Composer\Package;
  15802. use Composer\Package\AliasPackage;
  15803. use Composer\Package\Link;
  15804. use Composer\Package\RootAliasPackage;
  15805. use Composer\Package\RootPackageInterface;
  15806. use Composer\Package\Version\VersionParser;
  15807. use Composer\Semver\VersionParser as SemverVersionParser;
  15808. class ArrayLoader implements LoaderInterface
  15809. {
  15810. protected $versionParser;
  15811. protected $loadOptions;
  15812. public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
  15813. {
  15814. if (!$parser) {
  15815. $parser = new VersionParser;
  15816. }
  15817. $this->versionParser = $parser;
  15818. $this->loadOptions = $loadOptions;
  15819. }
  15820. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  15821. {
  15822. if (!isset($config['name'])) {
  15823. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  15824. }
  15825. if (!isset($config['version'])) {
  15826. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  15827. }
  15828. if (isset($config['version_normalized'])) {
  15829. $version = $config['version_normalized'];
  15830. } else {
  15831. $version = $this->versionParser->normalize($config['version']);
  15832. }
  15833. $package = new $class($config['name'], $version, $config['version']);
  15834. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  15835. if (isset($config['target-dir'])) {
  15836. $package->setTargetDir($config['target-dir']);
  15837. }
  15838. if (isset($config['extra']) && is_array($config['extra'])) {
  15839. $package->setExtra($config['extra']);
  15840. }
  15841. if (isset($config['bin'])) {
  15842. if (!is_array($config['bin'])) {
  15843. throw new \UnexpectedValueException('Package '.$config['name'].'\'s bin key should be an array, '.gettype($config['bin']).' given.');
  15844. }
  15845. foreach ($config['bin'] as $key => $bin) {
  15846. $config['bin'][$key] = ltrim($bin, '/');
  15847. }
  15848. $package->setBinaries($config['bin']);
  15849. }
  15850. if (isset($config['installation-source'])) {
  15851. $package->setInstallationSource($config['installation-source']);
  15852. }
  15853. if (isset($config['source'])) {
  15854. if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
  15855. throw new \UnexpectedValueException(sprintf(
  15856. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  15857. $config['name'],
  15858. json_encode($config['source'])
  15859. ));
  15860. }
  15861. $package->setSourceType($config['source']['type']);
  15862. $package->setSourceUrl($config['source']['url']);
  15863. $package->setSourceReference($config['source']['reference']);
  15864. if (isset($config['source']['mirrors'])) {
  15865. $package->setSourceMirrors($config['source']['mirrors']);
  15866. }
  15867. }
  15868. if (isset($config['dist'])) {
  15869. if (!isset($config['dist']['type'])
  15870. || !isset($config['dist']['url'])) {
  15871. throw new \UnexpectedValueException(sprintf(
  15872. "Package %s's dist key should be specified as ".
  15873. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  15874. $config['name'],
  15875. json_encode($config['dist'])
  15876. ));
  15877. }
  15878. $package->setDistType($config['dist']['type']);
  15879. $package->setDistUrl($config['dist']['url']);
  15880. $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
  15881. $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
  15882. if (isset($config['dist']['mirrors'])) {
  15883. $package->setDistMirrors($config['dist']['mirrors']);
  15884. }
  15885. }
  15886. foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
  15887. if (isset($config[$type])) {
  15888. $method = 'set'.ucfirst($opts['method']);
  15889. $package->{$method}(
  15890. $this->parseLinks(
  15891. $package->getName(),
  15892. $package->getPrettyVersion(),
  15893. $opts['description'],
  15894. $config[$type]
  15895. )
  15896. );
  15897. }
  15898. }
  15899. if (isset($config['suggest']) && is_array($config['suggest'])) {
  15900. foreach ($config['suggest'] as $target => $reason) {
  15901. if ('self.version' === trim($reason)) {
  15902. $config['suggest'][$target] = $package->getPrettyVersion();
  15903. }
  15904. }
  15905. $package->setSuggests($config['suggest']);
  15906. }
  15907. if (isset($config['autoload'])) {
  15908. $package->setAutoload($config['autoload']);
  15909. }
  15910. if (isset($config['autoload-dev'])) {
  15911. $package->setDevAutoload($config['autoload-dev']);
  15912. }
  15913. if (isset($config['include-path'])) {
  15914. $package->setIncludePaths($config['include-path']);
  15915. }
  15916. if (!empty($config['time'])) {
  15917. $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  15918. try {
  15919. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  15920. $package->setReleaseDate($date);
  15921. } catch (\Exception $e) {
  15922. }
  15923. }
  15924. if (!empty($config['notification-url'])) {
  15925. $package->setNotificationUrl($config['notification-url']);
  15926. }
  15927. if (!empty($config['archive']['exclude'])) {
  15928. $package->setArchiveExcludes($config['archive']['exclude']);
  15929. }
  15930. if ($package instanceof Package\CompletePackageInterface) {
  15931. if (isset($config['scripts']) && is_array($config['scripts'])) {
  15932. foreach ($config['scripts'] as $event => $listeners) {
  15933. $config['scripts'][$event] = (array) $listeners;
  15934. }
  15935. if (isset($config['scripts']['composer'])) {
  15936. trigger_error('The `composer` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  15937. }
  15938. $package->setScripts($config['scripts']);
  15939. }
  15940. if (!empty($config['description']) && is_string($config['description'])) {
  15941. $package->setDescription($config['description']);
  15942. }
  15943. if (!empty($config['homepage']) && is_string($config['homepage'])) {
  15944. $package->setHomepage($config['homepage']);
  15945. }
  15946. if (!empty($config['keywords']) && is_array($config['keywords'])) {
  15947. $package->setKeywords($config['keywords']);
  15948. }
  15949. if (!empty($config['license'])) {
  15950. $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
  15951. }
  15952. if (!empty($config['authors']) && is_array($config['authors'])) {
  15953. $package->setAuthors($config['authors']);
  15954. }
  15955. if (isset($config['support'])) {
  15956. $package->setSupport($config['support']);
  15957. }
  15958. if (isset($config['abandoned'])) {
  15959. $package->setAbandoned($config['abandoned']);
  15960. }
  15961. }
  15962. if ($aliasNormalized = $this->getBranchAlias($config)) {
  15963. if ($package instanceof RootPackageInterface) {
  15964. $package = new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  15965. } else {
  15966. $package = new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  15967. }
  15968. }
  15969. if ($this->loadOptions && isset($config['transport-options'])) {
  15970. $package->setTransportOptions($config['transport-options']);
  15971. }
  15972. return $package;
  15973. }
  15974. public function parseLinks($source, $sourceVersion, $description, $links)
  15975. {
  15976. $res = array();
  15977. foreach ($links as $target => $constraint) {
  15978. if ('self.version' === $constraint) {
  15979. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  15980. } else {
  15981. $parsedConstraint = $this->versionParser->parseConstraints($constraint);
  15982. }
  15983. $res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
  15984. }
  15985. return $res;
  15986. }
  15987. public function getBranchAlias(array $config)
  15988. {
  15989. if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
  15990. || !isset($config['extra']['branch-alias'])
  15991. || !is_array($config['extra']['branch-alias'])
  15992. ) {
  15993. return;
  15994. }
  15995. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  15996. if ('-dev' !== substr($targetBranch, -4)) {
  15997. continue;
  15998. }
  15999. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  16000. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  16001. continue;
  16002. }
  16003. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  16004. continue;
  16005. }
  16006. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  16007. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  16008. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  16009. ) {
  16010. continue;
  16011. }
  16012. return $validatedTargetBranch;
  16013. }
  16014. }
  16015. }
  16016. <?php
  16017. namespace Composer\Package\Loader;
  16018. class InvalidPackageException extends \Exception
  16019. {
  16020. private $errors;
  16021. private $warnings;
  16022. private $data;
  16023. public function __construct(array $errors, array $warnings, array $data)
  16024. {
  16025. $this->errors = $errors;
  16026. $this->warnings = $warnings;
  16027. $this->data = $data;
  16028. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  16029. }
  16030. public function getData()
  16031. {
  16032. return $this->data;
  16033. }
  16034. public function getErrors()
  16035. {
  16036. return $this->errors;
  16037. }
  16038. public function getWarnings()
  16039. {
  16040. return $this->warnings;
  16041. }
  16042. }
  16043. <?php
  16044. namespace Composer\Package\Loader;
  16045. use Composer\Json\JsonFile;
  16046. class JsonLoader
  16047. {
  16048. private $loader;
  16049. public function __construct(LoaderInterface $loader)
  16050. {
  16051. $this->loader = $loader;
  16052. }
  16053. public function load($json)
  16054. {
  16055. if ($json instanceof JsonFile) {
  16056. $config = $json->read();
  16057. } elseif (file_exists($json)) {
  16058. $config = JsonFile::parseJson(file_get_contents($json), $json);
  16059. } elseif (is_string($json)) {
  16060. $config = JsonFile::parseJson($json);
  16061. }
  16062. return $this->loader->load($config);
  16063. }
  16064. }
  16065. <?php
  16066. namespace Composer\Package\Loader;
  16067. interface LoaderInterface
  16068. {
  16069. public function load(array $package, $class = 'Composer\Package\CompletePackage');
  16070. }
  16071. <?php
  16072. namespace Composer\Package\Loader;
  16073. use Composer\Package\BasePackage;
  16074. use Composer\Package\AliasPackage;
  16075. use Composer\Config;
  16076. use Composer\Package\RootPackageInterface;
  16077. use Composer\Repository\RepositoryFactory;
  16078. use Composer\Package\Version\VersionGuesser;
  16079. use Composer\Package\Version\VersionParser;
  16080. use Composer\Repository\RepositoryManager;
  16081. use Composer\Util\ProcessExecutor;
  16082. class RootPackageLoader extends ArrayLoader
  16083. {
  16084. private $manager;
  16085. private $config;
  16086. private $versionGuesser;
  16087. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null)
  16088. {
  16089. parent::__construct($parser);
  16090. $this->manager = $manager;
  16091. $this->config = $config;
  16092. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser);
  16093. }
  16094. public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
  16095. {
  16096. if (!isset($config['name'])) {
  16097. $config['name'] = '__root__';
  16098. }
  16099. $autoVersioned = false;
  16100. if (!isset($config['version'])) {
  16101. if (getenv('COMPOSER_ROOT_VERSION')) {
  16102. $version = getenv('COMPOSER_ROOT_VERSION');
  16103. $commit = null;
  16104. } else {
  16105. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?: getcwd());
  16106. $version = $versionData['version'];
  16107. $commit = $versionData['commit'];
  16108. }
  16109. if (!$version) {
  16110. $version = '1.0.0';
  16111. $autoVersioned = true;
  16112. }
  16113. $config['version'] = $version;
  16114. if ($commit) {
  16115. $config['source'] = array(
  16116. 'type' => '',
  16117. 'url' => '',
  16118. 'reference' => $commit,
  16119. );
  16120. $config['dist'] = array(
  16121. 'type' => '',
  16122. 'url' => '',
  16123. 'reference' => $commit,
  16124. );
  16125. }
  16126. }
  16127. $realPackage = $package = parent::load($config, $class);
  16128. if ($realPackage instanceof AliasPackage) {
  16129. $realPackage = $package->getAliasOf();
  16130. }
  16131. if ($autoVersioned) {
  16132. $realPackage->replaceVersion($realPackage->getVersion(), 'No version set (parsed as 1.0.0)');
  16133. }
  16134. if (isset($config['minimum-stability'])) {
  16135. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  16136. }
  16137. $aliases = array();
  16138. $stabilityFlags = array();
  16139. $references = array();
  16140. foreach (array('require', 'require-dev') as $linkType) {
  16141. if (isset($config[$linkType])) {
  16142. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  16143. $method = 'get'.ucfirst($linkInfo['method']);
  16144. $links = array();
  16145. foreach ($realPackage->$method() as $link) {
  16146. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  16147. }
  16148. $aliases = $this->extractAliases($links, $aliases);
  16149. $stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags, $realPackage->getMinimumStability());
  16150. $references = $this->extractReferences($links, $references);
  16151. }
  16152. }
  16153. if (isset($links[$config['name']])) {
  16154. throw new \InvalidArgumentException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  16155. 'Did you accidentally name your root package after an external package?', $config['name']));
  16156. }
  16157. $realPackage->setAliases($aliases);
  16158. $realPackage->setStabilityFlags($stabilityFlags);
  16159. $realPackage->setReferences($references);
  16160. if (isset($config['prefer-stable'])) {
  16161. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  16162. }
  16163. if (isset($config['config'])) {
  16164. $realPackage->setConfig($config['config']);
  16165. }
  16166. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  16167. foreach ($repos as $repo) {
  16168. $this->manager->addRepository($repo);
  16169. }
  16170. $realPackage->setRepositories($this->config->getRepositories());
  16171. return $package;
  16172. }
  16173. private function extractAliases(array $requires, array $aliases)
  16174. {
  16175. foreach ($requires as $reqName => $reqVersion) {
  16176. if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  16177. $aliases[] = array(
  16178. 'package' => strtolower($reqName),
  16179. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  16180. 'alias' => $match[2],
  16181. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  16182. );
  16183. }
  16184. }
  16185. return $aliases;
  16186. }
  16187. private function extractStabilityFlags(array $requires, array $stabilityFlags, $minimumStability)
  16188. {
  16189. $stabilities = BasePackage::$stabilities;
  16190. $minimumStability = $stabilities[$minimumStability];
  16191. foreach ($requires as $reqName => $reqVersion) {
  16192. $constraints = array();
  16193. $orSplit = preg_split('{\s*\|\|?\s*}', trim($reqVersion));
  16194. foreach ($orSplit as $orConstraint) {
  16195. $andSplit = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  16196. foreach ($andSplit as $andConstraint) {
  16197. $constraints[] = $andConstraint;
  16198. }
  16199. }
  16200. $match = false;
  16201. foreach ($constraints as $constraint) {
  16202. if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  16203. $name = strtolower($reqName);
  16204. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  16205. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  16206. continue;
  16207. }
  16208. $stabilityFlags[$name] = $stability;
  16209. $match = true;
  16210. }
  16211. }
  16212. if ($match) {
  16213. continue;
  16214. }
  16215. foreach ($constraints as $constraint) {
  16216. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  16217. if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  16218. $name = strtolower($reqName);
  16219. $stability = $stabilities[$stabilityName];
  16220. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  16221. continue;
  16222. }
  16223. $stabilityFlags[$name] = $stability;
  16224. }
  16225. }
  16226. }
  16227. return $stabilityFlags;
  16228. }
  16229. private function extractReferences(array $requires, array $references)
  16230. {
  16231. foreach ($requires as $reqName => $reqVersion) {
  16232. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  16233. if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === ($stabilityName = VersionParser::parseStability($reqVersion))) {
  16234. $name = strtolower($reqName);
  16235. $references[$name] = $match[1];
  16236. }
  16237. }
  16238. return $references;
  16239. }
  16240. }
  16241. <?php
  16242. namespace Composer\Package\Loader;
  16243. use Composer\Package;
  16244. use Composer\Package\BasePackage;
  16245. use Composer\Semver\Constraint\Constraint;
  16246. use Composer\Package\Version\VersionParser;
  16247. use Composer\Repository\PlatformRepository;
  16248. class ValidatingArrayLoader implements LoaderInterface
  16249. {
  16250. const CHECK_ALL = 3;
  16251. const CHECK_UNBOUND_CONSTRAINTS = 1;
  16252. const CHECK_STRICT_CONSTRAINTS = 2;
  16253. private $loader;
  16254. private $versionParser;
  16255. private $errors;
  16256. private $warnings;
  16257. private $config;
  16258. private $strictName;
  16259. private $flags;
  16260. public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0)
  16261. {
  16262. $this->loader = $loader;
  16263. $this->versionParser = $parser ?: new VersionParser();
  16264. $this->strictName = $strictName;
  16265. $this->flags = $flags;
  16266. }
  16267. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  16268. {
  16269. $this->errors = array();
  16270. $this->warnings = array();
  16271. $this->config = $config;
  16272. if ($this->strictName) {
  16273. $this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
  16274. } else {
  16275. $this->validateString('name', true);
  16276. }
  16277. if (!empty($this->config['version'])) {
  16278. try {
  16279. $this->versionParser->normalize($this->config['version']);
  16280. } catch (\Exception $e) {
  16281. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  16282. unset($this->config['version']);
  16283. }
  16284. }
  16285. $this->validateRegex('type', '[A-Za-z0-9-]+');
  16286. $this->validateString('target-dir');
  16287. $this->validateArray('extra');
  16288. $this->validateFlatArray('bin');
  16289. $this->validateArray('scripts');
  16290. $this->validateString('description');
  16291. $this->validateUrl('homepage');
  16292. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  16293. if (isset($this->config['license'])) {
  16294. if (is_string($this->config['license'])) {
  16295. $this->validateRegex('license', '[A-Za-z0-9+. ()-]+');
  16296. } else {
  16297. $this->validateFlatArray('license', '[A-Za-z0-9+. ()-]+');
  16298. }
  16299. }
  16300. $this->validateString('time');
  16301. if (!empty($this->config['time'])) {
  16302. try {
  16303. $date = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  16304. } catch (\Exception $e) {
  16305. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  16306. unset($this->config['time']);
  16307. }
  16308. }
  16309. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  16310. foreach ($this->config['authors'] as $key => $author) {
  16311. if (!is_array($author)) {
  16312. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  16313. unset($this->config['authors'][$key]);
  16314. continue;
  16315. }
  16316. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  16317. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  16318. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  16319. unset($this->config['authors'][$key][$authorData]);
  16320. }
  16321. }
  16322. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  16323. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  16324. unset($this->config['authors'][$key]['homepage']);
  16325. }
  16326. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  16327. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  16328. unset($this->config['authors'][$key]['email']);
  16329. }
  16330. if (empty($this->config['authors'][$key])) {
  16331. unset($this->config['authors'][$key]);
  16332. }
  16333. }
  16334. if (empty($this->config['authors'])) {
  16335. unset($this->config['authors']);
  16336. }
  16337. }
  16338. if ($this->validateArray('support') && !empty($this->config['support'])) {
  16339. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss') as $key) {
  16340. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  16341. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  16342. unset($this->config['support'][$key]);
  16343. }
  16344. }
  16345. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  16346. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  16347. unset($this->config['support']['email']);
  16348. }
  16349. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
  16350. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
  16351. unset($this->config['support']['irc']);
  16352. }
  16353. foreach (array('issues', 'forum', 'wiki', 'source', 'docs') as $key) {
  16354. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  16355. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  16356. unset($this->config['support'][$key]);
  16357. }
  16358. }
  16359. if (empty($this->config['support'])) {
  16360. unset($this->config['support']);
  16361. }
  16362. }
  16363. $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
  16364. $stableConstraint = new Constraint('=', '1.0.0');
  16365. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  16366. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  16367. foreach ($this->config[$linkType] as $package => $constraint) {
  16368. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
  16369. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  16370. }
  16371. if (!is_string($constraint)) {
  16372. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  16373. unset($this->config[$linkType][$package]);
  16374. } elseif ('self.version' !== $constraint) {
  16375. try {
  16376. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  16377. } catch (\Exception $e) {
  16378. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  16379. unset($this->config[$linkType][$package]);
  16380. continue;
  16381. }
  16382. if (
  16383. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  16384. && 'require' === $linkType
  16385. && $linkConstraint->matches($unboundConstraint)
  16386. && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $package)
  16387. ) {
  16388. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  16389. } elseif (
  16390. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  16391. && 'require' === $linkType
  16392. && substr($linkConstraint, 0, 1) === '='
  16393. && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=')
  16394. ) {
  16395. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  16396. }
  16397. }
  16398. }
  16399. }
  16400. }
  16401. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  16402. foreach ($this->config['suggest'] as $package => $description) {
  16403. if (!is_string($description)) {
  16404. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  16405. unset($this->config['suggest'][$package]);
  16406. }
  16407. }
  16408. }
  16409. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  16410. if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
  16411. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  16412. unset($this->config['minimum-stability']);
  16413. }
  16414. }
  16415. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  16416. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  16417. foreach ($this->config['autoload'] as $type => $typeConfig) {
  16418. if (!in_array($type, $types)) {
  16419. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  16420. unset($this->config['autoload'][$type]);
  16421. }
  16422. if ($type === 'psr-4') {
  16423. foreach ($typeConfig as $namespace => $dirs) {
  16424. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  16425. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  16426. }
  16427. }
  16428. }
  16429. }
  16430. }
  16431. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  16432. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  16433. unset($this->config['autoload']['psr-4']);
  16434. }
  16435. $this->validateFlatArray('include-path');
  16436. $this->validateArray('transport-options');
  16437. if (isset($this->config['extra']['branch-alias'])) {
  16438. if (!is_array($this->config['extra']['branch-alias'])) {
  16439. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  16440. } else {
  16441. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  16442. if ('-dev' !== substr($targetBranch, -4)) {
  16443. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  16444. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  16445. continue;
  16446. }
  16447. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  16448. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  16449. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  16450. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  16451. continue;
  16452. }
  16453. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  16454. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  16455. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  16456. ) {
  16457. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  16458. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  16459. }
  16460. }
  16461. }
  16462. }
  16463. if ($this->errors) {
  16464. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  16465. }
  16466. $package = $this->loader->load($this->config, $class);
  16467. $this->config = null;
  16468. return $package;
  16469. }
  16470. public function getWarnings()
  16471. {
  16472. return $this->warnings;
  16473. }
  16474. public function getErrors()
  16475. {
  16476. return $this->errors;
  16477. }
  16478. private function validateRegex($property, $regex, $mandatory = false)
  16479. {
  16480. if (!$this->validateString($property, $mandatory)) {
  16481. return false;
  16482. }
  16483. if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
  16484. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  16485. if ($mandatory) {
  16486. $this->errors[] = $message;
  16487. } else {
  16488. $this->warnings[] = $message;
  16489. }
  16490. unset($this->config[$property]);
  16491. return false;
  16492. }
  16493. return true;
  16494. }
  16495. private function validateString($property, $mandatory = false)
  16496. {
  16497. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  16498. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  16499. unset($this->config[$property]);
  16500. return false;
  16501. }
  16502. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  16503. if ($mandatory) {
  16504. $this->errors[] = $property.' : must be present';
  16505. }
  16506. unset($this->config[$property]);
  16507. return false;
  16508. }
  16509. return true;
  16510. }
  16511. private function validateArray($property, $mandatory = false)
  16512. {
  16513. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  16514. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  16515. unset($this->config[$property]);
  16516. return false;
  16517. }
  16518. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  16519. if ($mandatory) {
  16520. $this->errors[] = $property.' : must be present and contain at least one element';
  16521. }
  16522. unset($this->config[$property]);
  16523. return false;
  16524. }
  16525. return true;
  16526. }
  16527. private function validateFlatArray($property, $regex = null, $mandatory = false)
  16528. {
  16529. if (!$this->validateArray($property, $mandatory)) {
  16530. return false;
  16531. }
  16532. $pass = true;
  16533. foreach ($this->config[$property] as $key => $value) {
  16534. if (!is_string($value) && !is_numeric($value)) {
  16535. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  16536. unset($this->config[$property][$key]);
  16537. $pass = false;
  16538. continue;
  16539. }
  16540. if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
  16541. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  16542. unset($this->config[$property][$key]);
  16543. $pass = false;
  16544. }
  16545. }
  16546. return $pass;
  16547. }
  16548. private function validateUrl($property, $mandatory = false)
  16549. {
  16550. if (!$this->validateString($property, $mandatory)) {
  16551. return false;
  16552. }
  16553. if (!$this->filterUrl($this->config[$property])) {
  16554. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  16555. unset($this->config[$property]);
  16556. return false;
  16557. }
  16558. return true;
  16559. }
  16560. private function filterUrl($value, array $schemes = array('http', 'https'))
  16561. {
  16562. if ($value === '') {
  16563. return true;
  16564. }
  16565. $bits = parse_url($value);
  16566. if (empty($bits['scheme']) || empty($bits['host'])) {
  16567. return false;
  16568. }
  16569. if (!in_array($bits['scheme'], $schemes, true)) {
  16570. return false;
  16571. }
  16572. return true;
  16573. }
  16574. }
  16575. <?php
  16576. namespace Composer\Package;
  16577. use Composer\Json\JsonFile;
  16578. use Composer\Installer\InstallationManager;
  16579. use Composer\Repository\RepositoryManager;
  16580. use Composer\Util\ProcessExecutor;
  16581. use Composer\Repository\ArrayRepository;
  16582. use Composer\Package\Dumper\ArrayDumper;
  16583. use Composer\Package\Loader\ArrayLoader;
  16584. use Composer\Util\Git as GitUtil;
  16585. use Composer\IO\IOInterface;
  16586. use Seld\JsonLint\ParsingException;
  16587. class Locker
  16588. {
  16589. private $lockFile;
  16590. private $repositoryManager;
  16591. private $installationManager;
  16592. private $hash;
  16593. private $contentHash;
  16594. private $loader;
  16595. private $dumper;
  16596. private $process;
  16597. private $lockDataCache;
  16598. public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
  16599. {
  16600. $this->lockFile = $lockFile;
  16601. $this->repositoryManager = $repositoryManager;
  16602. $this->installationManager = $installationManager;
  16603. $this->hash = md5($composerFileContents);
  16604. $this->contentHash = self::getContentHash($composerFileContents);
  16605. $this->loader = new ArrayLoader(null, true);
  16606. $this->dumper = new ArrayDumper();
  16607. $this->process = new ProcessExecutor($io);
  16608. }
  16609. public static function getContentHash($composerFileContents)
  16610. {
  16611. $content = json_decode($composerFileContents, true);
  16612. $relevantKeys = array(
  16613. 'name',
  16614. 'version',
  16615. 'require',
  16616. 'require-dev',
  16617. 'conflict',
  16618. 'replace',
  16619. 'provide',
  16620. 'minimum-stability',
  16621. 'prefer-stable',
  16622. 'repositories',
  16623. 'extra',
  16624. );
  16625. $relevantContent = array();
  16626. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  16627. $relevantContent[$key] = $content[$key];
  16628. }
  16629. if (isset($content['config']['platform'])) {
  16630. $relevantContent['config']['platform'] = $content['config']['platform'];
  16631. }
  16632. ksort($relevantContent);
  16633. return md5(json_encode($relevantContent));
  16634. }
  16635. public function isLocked()
  16636. {
  16637. if (!$this->lockFile->exists()) {
  16638. return false;
  16639. }
  16640. $data = $this->getLockData();
  16641. return isset($data['packages']);
  16642. }
  16643. public function isFresh()
  16644. {
  16645. $lock = $this->lockFile->read();
  16646. if (!empty($lock['content-hash'])) {
  16647. return $this->contentHash === $lock['content-hash'];
  16648. }
  16649. return $this->hash === $lock['hash'];
  16650. }
  16651. public function getLockedRepository($withDevReqs = false)
  16652. {
  16653. $lockData = $this->getLockData();
  16654. $packages = new ArrayRepository();
  16655. $lockedPackages = $lockData['packages'];
  16656. if ($withDevReqs) {
  16657. if (isset($lockData['packages-dev'])) {
  16658. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  16659. } else {
  16660. throw new \RuntimeException('The lock file does not contain require-dev information, run install with the --no-dev option or run update to install those packages.');
  16661. }
  16662. }
  16663. if (empty($lockedPackages)) {
  16664. return $packages;
  16665. }
  16666. if (isset($lockedPackages[0]['name'])) {
  16667. foreach ($lockedPackages as $info) {
  16668. $packages->addPackage($this->loader->load($info));
  16669. }
  16670. return $packages;
  16671. }
  16672. throw new \RuntimeException('Your composer.lock was created before 2012-09-15, and is not supported anymore. Run "composer update" to generate a new one.');
  16673. }
  16674. public function getPlatformRequirements($withDevReqs = false)
  16675. {
  16676. $lockData = $this->getLockData();
  16677. $requirements = array();
  16678. if (!empty($lockData['platform'])) {
  16679. $requirements = $this->loader->parseLinks(
  16680. '__ROOT__',
  16681. '1.0.0',
  16682. 'requires',
  16683. isset($lockData['platform']) ? $lockData['platform'] : array()
  16684. );
  16685. }
  16686. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  16687. $devRequirements = $this->loader->parseLinks(
  16688. '__ROOT__',
  16689. '1.0.0',
  16690. 'requires',
  16691. isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
  16692. );
  16693. $requirements = array_merge($requirements, $devRequirements);
  16694. }
  16695. return $requirements;
  16696. }
  16697. public function getMinimumStability()
  16698. {
  16699. $lockData = $this->getLockData();
  16700. return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
  16701. }
  16702. public function getStabilityFlags()
  16703. {
  16704. $lockData = $this->getLockData();
  16705. return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
  16706. }
  16707. public function getPreferStable()
  16708. {
  16709. $lockData = $this->getLockData();
  16710. return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : null;
  16711. }
  16712. public function getPreferLowest()
  16713. {
  16714. $lockData = $this->getLockData();
  16715. return isset($lockData['prefer-lowest']) ? $lockData['prefer-lowest'] : null;
  16716. }
  16717. public function getPlatformOverrides()
  16718. {
  16719. $lockData = $this->getLockData();
  16720. return isset($lockData['platform-overrides']) ? $lockData['platform-overrides'] : array();
  16721. }
  16722. public function getAliases()
  16723. {
  16724. $lockData = $this->getLockData();
  16725. return isset($lockData['aliases']) ? $lockData['aliases'] : array();
  16726. }
  16727. public function getLockData()
  16728. {
  16729. if (null !== $this->lockDataCache) {
  16730. return $this->lockDataCache;
  16731. }
  16732. if (!$this->lockFile->exists()) {
  16733. throw new \LogicException('No lockfile found. Unable to read locked packages');
  16734. }
  16735. return $this->lockDataCache = $this->lockFile->read();
  16736. }
  16737. public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
  16738. {
  16739. $lock = array(
  16740. '_readme' => array('This file locks the dependencies of your project to a known state',
  16741. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file',
  16742. 'This file is @gener'.'ated automatically', ),
  16743. 'hash' => $this->hash,
  16744. 'content-hash' => $this->contentHash,
  16745. 'packages' => null,
  16746. 'packages-dev' => null,
  16747. 'aliases' => array(),
  16748. 'minimum-stability' => $minimumStability,
  16749. 'stability-flags' => $stabilityFlags,
  16750. 'prefer-stable' => $preferStable,
  16751. 'prefer-lowest' => $preferLowest,
  16752. );
  16753. foreach ($aliases as $package => $versions) {
  16754. foreach ($versions as $version => $alias) {
  16755. $lock['aliases'][] = array(
  16756. 'alias' => $alias['alias'],
  16757. 'alias_normalized' => $alias['alias_normalized'],
  16758. 'version' => $version,
  16759. 'package' => $package,
  16760. );
  16761. }
  16762. }
  16763. $lock['packages'] = $this->lockPackages($packages);
  16764. if (null !== $devPackages) {
  16765. $lock['packages-dev'] = $this->lockPackages($devPackages);
  16766. }
  16767. $lock['platform'] = $platformReqs;
  16768. $lock['platform-dev'] = $platformDevReqs;
  16769. if ($platformOverrides) {
  16770. $lock['platform-overrides'] = $platformOverrides;
  16771. }
  16772. if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
  16773. if ($this->lockFile->exists()) {
  16774. unlink($this->lockFile->getPath());
  16775. }
  16776. return false;
  16777. }
  16778. try {
  16779. $isLocked = $this->isLocked();
  16780. } catch (ParsingException $e) {
  16781. $isLocked = false;
  16782. }
  16783. if (!$isLocked || $lock !== $this->getLockData()) {
  16784. $this->lockFile->write($lock);
  16785. $this->lockDataCache = null;
  16786. return true;
  16787. }
  16788. return false;
  16789. }
  16790. private function lockPackages(array $packages)
  16791. {
  16792. $locked = array();
  16793. foreach ($packages as $package) {
  16794. if ($package instanceof AliasPackage) {
  16795. continue;
  16796. }
  16797. $name = $package->getPrettyName();
  16798. $version = $package->getPrettyVersion();
  16799. if (!$name || !$version) {
  16800. throw new \LogicException(sprintf(
  16801. 'Package "%s" has no version or name and can not be locked', $package
  16802. ));
  16803. }
  16804. $spec = $this->dumper->dump($package);
  16805. unset($spec['version_normalized']);
  16806. $time = isset($spec['time']) ? $spec['time'] : null;
  16807. unset($spec['time']);
  16808. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  16809. $time = $this->getPackageTime($package) ?: $time;
  16810. }
  16811. if (null !== $time) {
  16812. $spec['time'] = $time;
  16813. }
  16814. unset($spec['installation-source']);
  16815. $locked[] = $spec;
  16816. }
  16817. usort($locked, function ($a, $b) {
  16818. $comparison = strcmp($a['name'], $b['name']);
  16819. if (0 !== $comparison) {
  16820. return $comparison;
  16821. }
  16822. return strcmp($a['version'], $b['version']);
  16823. });
  16824. return $locked;
  16825. }
  16826. private function getPackageTime(PackageInterface $package)
  16827. {
  16828. if (!function_exists('proc_open')) {
  16829. return null;
  16830. }
  16831. $path = realpath($this->installationManager->getInstallPath($package));
  16832. $sourceType = $package->getSourceType();
  16833. $datetime = null;
  16834. if ($path && in_array($sourceType, array('git', 'hg'))) {
  16835. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  16836. switch ($sourceType) {
  16837. case 'git':
  16838. GitUtil::cleanEnv();
  16839. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
  16840. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  16841. }
  16842. break;
  16843. case 'hg':
  16844. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
  16845. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  16846. }
  16847. break;
  16848. }
  16849. }
  16850. return $datetime ? $datetime->format('Y-m-d H:i:s') : null;
  16851. }
  16852. }
  16853. <?php
  16854. namespace Composer\Package;
  16855. use Composer\Package\Version\VersionParser;
  16856. use Composer\Util\ComposerMirror;
  16857. class Package extends BasePackage
  16858. {
  16859. protected $type;
  16860. protected $targetDir;
  16861. protected $installationSource;
  16862. protected $sourceType;
  16863. protected $sourceUrl;
  16864. protected $sourceReference;
  16865. protected $sourceMirrors;
  16866. protected $distType;
  16867. protected $distUrl;
  16868. protected $distReference;
  16869. protected $distSha1Checksum;
  16870. protected $distMirrors;
  16871. protected $version;
  16872. protected $prettyVersion;
  16873. protected $releaseDate;
  16874. protected $extra = array();
  16875. protected $binaries = array();
  16876. protected $dev;
  16877. protected $stability;
  16878. protected $notificationUrl;
  16879. protected $requires = array();
  16880. protected $conflicts = array();
  16881. protected $provides = array();
  16882. protected $replaces = array();
  16883. protected $devRequires = array();
  16884. protected $suggests = array();
  16885. protected $autoload = array();
  16886. protected $devAutoload = array();
  16887. protected $includePaths = array();
  16888. protected $archiveExcludes = array();
  16889. public function __construct($name, $version, $prettyVersion)
  16890. {
  16891. parent::__construct($name);
  16892. $this->version = $version;
  16893. $this->prettyVersion = $prettyVersion;
  16894. $this->stability = VersionParser::parseStability($version);
  16895. $this->dev = $this->stability === 'dev';
  16896. }
  16897. public function isDev()
  16898. {
  16899. return $this->dev;
  16900. }
  16901. public function setType($type)
  16902. {
  16903. $this->type = $type;
  16904. }
  16905. public function getType()
  16906. {
  16907. return $this->type ?: 'library';
  16908. }
  16909. public function getStability()
  16910. {
  16911. return $this->stability;
  16912. }
  16913. public function setTargetDir($targetDir)
  16914. {
  16915. $this->targetDir = $targetDir;
  16916. }
  16917. public function getTargetDir()
  16918. {
  16919. if (null === $this->targetDir) {
  16920. return;
  16921. }
  16922. return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  16923. }
  16924. public function setExtra(array $extra)
  16925. {
  16926. $this->extra = $extra;
  16927. }
  16928. public function getExtra()
  16929. {
  16930. return $this->extra;
  16931. }
  16932. public function setBinaries(array $binaries)
  16933. {
  16934. $this->binaries = $binaries;
  16935. }
  16936. public function getBinaries()
  16937. {
  16938. return $this->binaries;
  16939. }
  16940. public function setInstallationSource($type)
  16941. {
  16942. $this->installationSource = $type;
  16943. }
  16944. public function getInstallationSource()
  16945. {
  16946. return $this->installationSource;
  16947. }
  16948. public function setSourceType($type)
  16949. {
  16950. $this->sourceType = $type;
  16951. }
  16952. public function getSourceType()
  16953. {
  16954. return $this->sourceType;
  16955. }
  16956. public function setSourceUrl($url)
  16957. {
  16958. $this->sourceUrl = $url;
  16959. }
  16960. public function getSourceUrl()
  16961. {
  16962. return $this->sourceUrl;
  16963. }
  16964. public function setSourceReference($reference)
  16965. {
  16966. $this->sourceReference = $reference;
  16967. }
  16968. public function getSourceReference()
  16969. {
  16970. return $this->sourceReference;
  16971. }
  16972. public function setSourceMirrors($mirrors)
  16973. {
  16974. $this->sourceMirrors = $mirrors;
  16975. }
  16976. public function getSourceMirrors()
  16977. {
  16978. return $this->sourceMirrors;
  16979. }
  16980. public function getSourceUrls()
  16981. {
  16982. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  16983. }
  16984. public function setDistType($type)
  16985. {
  16986. $this->distType = $type;
  16987. }
  16988. public function getDistType()
  16989. {
  16990. return $this->distType;
  16991. }
  16992. public function setDistUrl($url)
  16993. {
  16994. $this->distUrl = $url;
  16995. }
  16996. public function getDistUrl()
  16997. {
  16998. return $this->distUrl;
  16999. }
  17000. public function setDistReference($reference)
  17001. {
  17002. $this->distReference = $reference;
  17003. }
  17004. public function getDistReference()
  17005. {
  17006. return $this->distReference;
  17007. }
  17008. public function setDistSha1Checksum($sha1checksum)
  17009. {
  17010. $this->distSha1Checksum = $sha1checksum;
  17011. }
  17012. public function getDistSha1Checksum()
  17013. {
  17014. return $this->distSha1Checksum;
  17015. }
  17016. public function setDistMirrors($mirrors)
  17017. {
  17018. $this->distMirrors = $mirrors;
  17019. }
  17020. public function getDistMirrors()
  17021. {
  17022. return $this->distMirrors;
  17023. }
  17024. public function getDistUrls()
  17025. {
  17026. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  17027. }
  17028. public function getVersion()
  17029. {
  17030. return $this->version;
  17031. }
  17032. public function getPrettyVersion()
  17033. {
  17034. return $this->prettyVersion;
  17035. }
  17036. public function setReleaseDate(\DateTime $releaseDate)
  17037. {
  17038. $this->releaseDate = $releaseDate;
  17039. }
  17040. public function getReleaseDate()
  17041. {
  17042. return $this->releaseDate;
  17043. }
  17044. public function setRequires(array $requires)
  17045. {
  17046. $this->requires = $requires;
  17047. }
  17048. public function getRequires()
  17049. {
  17050. return $this->requires;
  17051. }
  17052. public function setConflicts(array $conflicts)
  17053. {
  17054. $this->conflicts = $conflicts;
  17055. }
  17056. public function getConflicts()
  17057. {
  17058. return $this->conflicts;
  17059. }
  17060. public function setProvides(array $provides)
  17061. {
  17062. $this->provides = $provides;
  17063. }
  17064. public function getProvides()
  17065. {
  17066. return $this->provides;
  17067. }
  17068. public function setReplaces(array $replaces)
  17069. {
  17070. $this->replaces = $replaces;
  17071. }
  17072. public function getReplaces()
  17073. {
  17074. return $this->replaces;
  17075. }
  17076. public function setDevRequires(array $devRequires)
  17077. {
  17078. $this->devRequires = $devRequires;
  17079. }
  17080. public function getDevRequires()
  17081. {
  17082. return $this->devRequires;
  17083. }
  17084. public function setSuggests(array $suggests)
  17085. {
  17086. $this->suggests = $suggests;
  17087. }
  17088. public function getSuggests()
  17089. {
  17090. return $this->suggests;
  17091. }
  17092. public function setAutoload(array $autoload)
  17093. {
  17094. $this->autoload = $autoload;
  17095. }
  17096. public function getAutoload()
  17097. {
  17098. return $this->autoload;
  17099. }
  17100. public function setDevAutoload(array $devAutoload)
  17101. {
  17102. $this->devAutoload = $devAutoload;
  17103. }
  17104. public function getDevAutoload()
  17105. {
  17106. return $this->devAutoload;
  17107. }
  17108. public function setIncludePaths(array $includePaths)
  17109. {
  17110. $this->includePaths = $includePaths;
  17111. }
  17112. public function getIncludePaths()
  17113. {
  17114. return $this->includePaths;
  17115. }
  17116. public function setNotificationUrl($notificationUrl)
  17117. {
  17118. $this->notificationUrl = $notificationUrl;
  17119. }
  17120. public function getNotificationUrl()
  17121. {
  17122. return $this->notificationUrl;
  17123. }
  17124. public function setArchiveExcludes(array $excludes)
  17125. {
  17126. $this->archiveExcludes = $excludes;
  17127. }
  17128. public function getArchiveExcludes()
  17129. {
  17130. return $this->archiveExcludes;
  17131. }
  17132. public function replaceVersion($version, $prettyVersion)
  17133. {
  17134. $this->version = $version;
  17135. $this->prettyVersion = $prettyVersion;
  17136. $this->stability = VersionParser::parseStability($version);
  17137. $this->dev = $this->stability === 'dev';
  17138. }
  17139. protected function getUrls($url, $mirrors, $ref, $type, $urlType)
  17140. {
  17141. if (!$url) {
  17142. return array();
  17143. }
  17144. $urls = array($url);
  17145. if ($mirrors) {
  17146. foreach ($mirrors as $mirror) {
  17147. if ($urlType === 'dist') {
  17148. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type);
  17149. } elseif ($urlType === 'source' && $type === 'git') {
  17150. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  17151. } elseif ($urlType === 'source' && $type === 'hg') {
  17152. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  17153. }
  17154. if (!in_array($mirrorUrl, $urls)) {
  17155. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  17156. $func($urls, $mirrorUrl);
  17157. }
  17158. }
  17159. }
  17160. return $urls;
  17161. }
  17162. }
  17163. <?php
  17164. namespace Composer\Package;
  17165. use Composer\Repository\RepositoryInterface;
  17166. interface PackageInterface
  17167. {
  17168. public function getName();
  17169. public function getPrettyName();
  17170. public function getNames();
  17171. public function setId($id);
  17172. public function getId();
  17173. public function isDev();
  17174. public function getType();
  17175. public function getTargetDir();
  17176. public function getExtra();
  17177. public function setInstallationSource($type);
  17178. public function getInstallationSource();
  17179. public function getSourceType();
  17180. public function getSourceUrl();
  17181. public function getSourceUrls();
  17182. public function getSourceReference();
  17183. public function getSourceMirrors();
  17184. public function getDistType();
  17185. public function getDistUrl();
  17186. public function getDistUrls();
  17187. public function getDistReference();
  17188. public function getDistSha1Checksum();
  17189. public function getDistMirrors();
  17190. public function getVersion();
  17191. public function getPrettyVersion();
  17192. public function getFullPrettyVersion($truncate = true);
  17193. public function getReleaseDate();
  17194. public function getStability();
  17195. public function getRequires();
  17196. public function getConflicts();
  17197. public function getProvides();
  17198. public function getReplaces();
  17199. public function getDevRequires();
  17200. public function getSuggests();
  17201. public function getAutoload();
  17202. public function getDevAutoload();
  17203. public function getIncludePaths();
  17204. public function setRepository(RepositoryInterface $repository);
  17205. public function getRepository();
  17206. public function getBinaries();
  17207. public function getUniqueName();
  17208. public function getNotificationUrl();
  17209. public function __toString();
  17210. public function getPrettyString();
  17211. public function getArchiveExcludes();
  17212. public function getTransportOptions();
  17213. }
  17214. <?php
  17215. namespace Composer\Package;
  17216. class RootAliasPackage extends AliasPackage implements RootPackageInterface
  17217. {
  17218. public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
  17219. {
  17220. parent::__construct($aliasOf, $version, $prettyVersion);
  17221. }
  17222. public function getAliases()
  17223. {
  17224. return $this->aliasOf->getAliases();
  17225. }
  17226. public function getMinimumStability()
  17227. {
  17228. return $this->aliasOf->getMinimumStability();
  17229. }
  17230. public function getStabilityFlags()
  17231. {
  17232. return $this->aliasOf->getStabilityFlags();
  17233. }
  17234. public function getReferences()
  17235. {
  17236. return $this->aliasOf->getReferences();
  17237. }
  17238. public function getPreferStable()
  17239. {
  17240. return $this->aliasOf->getPreferStable();
  17241. }
  17242. public function getConfig()
  17243. {
  17244. return $this->aliasOf->getConfig();
  17245. }
  17246. public function setRequires(array $require)
  17247. {
  17248. $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
  17249. $this->aliasOf->setRequires($require);
  17250. }
  17251. public function setDevRequires(array $devRequire)
  17252. {
  17253. $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
  17254. $this->aliasOf->setDevRequires($devRequire);
  17255. }
  17256. public function setConflicts(array $conflicts)
  17257. {
  17258. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
  17259. $this->aliasOf->setConflicts($conflicts);
  17260. }
  17261. public function setProvides(array $provides)
  17262. {
  17263. $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
  17264. $this->aliasOf->setProvides($provides);
  17265. }
  17266. public function setReplaces(array $replaces)
  17267. {
  17268. $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
  17269. $this->aliasOf->setReplaces($replaces);
  17270. }
  17271. public function setRepositories($repositories)
  17272. {
  17273. $this->aliasOf->setRepositories($repositories);
  17274. }
  17275. public function setAutoload(array $autoload)
  17276. {
  17277. $this->aliasOf->setAutoload($autoload);
  17278. }
  17279. public function setDevAutoload(array $devAutoload)
  17280. {
  17281. $this->aliasOf->setDevAutoload($devAutoload);
  17282. }
  17283. public function setStabilityFlags(array $stabilityFlags)
  17284. {
  17285. $this->aliasOf->setStabilityFlags($stabilityFlags);
  17286. }
  17287. public function setSuggests(array $suggests)
  17288. {
  17289. $this->aliasOf->setSuggests($suggests);
  17290. }
  17291. public function setExtra(array $extra)
  17292. {
  17293. $this->aliasOf->setExtra($extra);
  17294. }
  17295. public function __clone()
  17296. {
  17297. parent::__clone();
  17298. $this->aliasOf = clone $this->aliasOf;
  17299. }
  17300. }
  17301. <?php
  17302. namespace Composer\Package;
  17303. class RootPackage extends CompletePackage implements RootPackageInterface
  17304. {
  17305. protected $minimumStability = 'stable';
  17306. protected $preferStable = false;
  17307. protected $stabilityFlags = array();
  17308. protected $config = array();
  17309. protected $references = array();
  17310. protected $aliases = array();
  17311. public function setMinimumStability($minimumStability)
  17312. {
  17313. $this->minimumStability = $minimumStability;
  17314. }
  17315. public function getMinimumStability()
  17316. {
  17317. return $this->minimumStability;
  17318. }
  17319. public function setStabilityFlags(array $stabilityFlags)
  17320. {
  17321. $this->stabilityFlags = $stabilityFlags;
  17322. }
  17323. public function getStabilityFlags()
  17324. {
  17325. return $this->stabilityFlags;
  17326. }
  17327. public function setPreferStable($preferStable)
  17328. {
  17329. $this->preferStable = $preferStable;
  17330. }
  17331. public function getPreferStable()
  17332. {
  17333. return $this->preferStable;
  17334. }
  17335. public function setConfig(array $config)
  17336. {
  17337. $this->config = $config;
  17338. }
  17339. public function getConfig()
  17340. {
  17341. return $this->config;
  17342. }
  17343. public function setReferences(array $references)
  17344. {
  17345. $this->references = $references;
  17346. }
  17347. public function getReferences()
  17348. {
  17349. return $this->references;
  17350. }
  17351. public function setAliases(array $aliases)
  17352. {
  17353. $this->aliases = $aliases;
  17354. }
  17355. public function getAliases()
  17356. {
  17357. return $this->aliases;
  17358. }
  17359. }
  17360. <?php
  17361. namespace Composer\Package;
  17362. interface RootPackageInterface extends CompletePackageInterface
  17363. {
  17364. public function getAliases();
  17365. public function getMinimumStability();
  17366. public function getStabilityFlags();
  17367. public function getReferences();
  17368. public function getPreferStable();
  17369. public function getConfig();
  17370. public function setRequires(array $requires);
  17371. public function setDevRequires(array $devRequires);
  17372. public function setConflicts(array $conflicts);
  17373. public function setProvides(array $provides);
  17374. public function setReplaces(array $replaces);
  17375. public function setRepositories($repositories);
  17376. public function setAutoload(array $autoload);
  17377. public function setDevAutoload(array $devAutoload);
  17378. public function setStabilityFlags(array $stabilityFlags);
  17379. public function setSuggests(array $suggests);
  17380. public function setExtra(array $extra);
  17381. }
  17382. <?php
  17383. namespace Composer\Package\Version;
  17384. use Composer\Config;
  17385. use Composer\Repository\Vcs\HgDriver;
  17386. use Composer\IO\NullIO;
  17387. use Composer\Semver\VersionParser as SemverVersionParser;
  17388. use Composer\Util\Git as GitUtil;
  17389. use Composer\Util\ProcessExecutor;
  17390. use Composer\Util\Svn as SvnUtil;
  17391. class VersionGuesser
  17392. {
  17393. private $config;
  17394. private $process;
  17395. private $versionParser;
  17396. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  17397. {
  17398. $this->config = $config;
  17399. $this->process = $process;
  17400. $this->versionParser = $versionParser;
  17401. }
  17402. public function guessVersion(array $packageConfig, $path)
  17403. {
  17404. if (function_exists('proc_open')) {
  17405. $versionData = $this->guessGitVersion($packageConfig, $path);
  17406. if (null !== $versionData) {
  17407. return $versionData;
  17408. }
  17409. $versionData = $this->guessHgVersion($packageConfig, $path);
  17410. if (null !== $versionData) {
  17411. return $versionData;
  17412. }
  17413. $versionData = $this->guessFossilVersion($packageConfig, $path);
  17414. if (null !== $versionData) {
  17415. return $versionData;
  17416. }
  17417. return $this->guessSvnVersion($packageConfig, $path);
  17418. }
  17419. }
  17420. private function guessGitVersion(array $packageConfig, $path)
  17421. {
  17422. GitUtil::cleanEnv();
  17423. $commit = null;
  17424. $version = null;
  17425. $prettyVersion = null;
  17426. if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) {
  17427. $branches = array();
  17428. $isFeatureBranch = false;
  17429. foreach ($this->process->splitLines($output) as $branch) {
  17430. if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  17431. if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ') {
  17432. $version = 'dev-' . $match[2];
  17433. $prettyVersion = $version;
  17434. $isFeatureBranch = true;
  17435. } else {
  17436. $version = $this->versionParser->normalizeBranch($match[1]);
  17437. $prettyVersion = 'dev-' . $match[1];
  17438. $isFeatureBranch = 0 === strpos($version, 'dev-');
  17439. if ('9999999-dev' === $version) {
  17440. $version = $prettyVersion;
  17441. }
  17442. }
  17443. if ($match[2]) {
  17444. $commit = $match[2];
  17445. }
  17446. }
  17447. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  17448. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  17449. $branches[] = $match[1];
  17450. }
  17451. }
  17452. }
  17453. if ($isFeatureBranch) {
  17454. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  17455. $version = $result['version'];
  17456. $prettyVersion = $result['pretty_version'];
  17457. }
  17458. }
  17459. if (!$version) {
  17460. $result = $this->versionFromGitTags($path);
  17461. if ($result) {
  17462. $version = $result['version'];
  17463. $prettyVersion = $result['pretty_version'];
  17464. }
  17465. }
  17466. if (!$commit) {
  17467. $command = 'git log --pretty="%H" -n1 HEAD';
  17468. if (0 === $this->process->execute($command, $output, $path)) {
  17469. $commit = trim($output) ?: null;
  17470. }
  17471. }
  17472. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);
  17473. }
  17474. private function versionFromGitTags($path)
  17475. {
  17476. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  17477. try {
  17478. $version = $this->versionParser->normalize(trim($output));
  17479. return array('version' => $version, 'pretty_version' => trim($output));
  17480. } catch (\Exception $e) {
  17481. }
  17482. }
  17483. return null;
  17484. }
  17485. private function guessHgVersion(array $packageConfig, $path)
  17486. {
  17487. if (0 === $this->process->execute('hg branch', $output, $path)) {
  17488. $branch = trim($output);
  17489. $version = $this->versionParser->normalizeBranch($branch);
  17490. $isFeatureBranch = 0 === strpos($version, 'dev-');
  17491. if ('9999999-dev' === $version) {
  17492. $version = 'dev-' . $branch;
  17493. }
  17494. if (!$isFeatureBranch) {
  17495. return $version;
  17496. }
  17497. $driver = new HgDriver(array('url' => $path), new NullIO(), $this->config, $this->process);
  17498. $branches = array_keys($driver->getBranches());
  17499. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  17500. $result['commit'] = '';
  17501. return $result;
  17502. }
  17503. }
  17504. private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)
  17505. {
  17506. $prettyVersion = $version;
  17507. if ((isset($packageConfig['extra']['branch-alias']) && !isset($packageConfig['extra']['branch-alias'][$version]))
  17508. || strpos(json_encode($packageConfig), '"self.version"')
  17509. ) {
  17510. $branch = preg_replace('{^dev-}', '', $version);
  17511. $length = PHP_INT_MAX;
  17512. $nonFeatureBranches = '';
  17513. if (!empty($packageConfig['non-feature-branches'])) {
  17514. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  17515. }
  17516. foreach ($branches as $candidate) {
  17517. if ($candidate === $branch && preg_match('{^(' . $nonFeatureBranches . ')$}', $candidate)) {
  17518. break;
  17519. }
  17520. if ($candidate === $branch || !preg_match('{^(master|trunk|default|develop|\d+\..+)$}', $candidate, $match)) {
  17521. continue;
  17522. }
  17523. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  17524. if (0 !== $this->process->execute($cmdLine, $output, $path)) {
  17525. continue;
  17526. }
  17527. if (strlen($output) < $length) {
  17528. $length = strlen($output);
  17529. $version = $this->versionParser->normalizeBranch($candidate);
  17530. $prettyVersion = 'dev-' . $match[1];
  17531. if ('9999999-dev' === $version) {
  17532. $version = $prettyVersion;
  17533. }
  17534. }
  17535. }
  17536. }
  17537. return array('version' => $version, 'pretty_version' => $prettyVersion);
  17538. }
  17539. private function guessFossilVersion(array $packageConfig, $path)
  17540. {
  17541. $version = null;
  17542. $prettyVersion = null;
  17543. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  17544. $branch = trim($output);
  17545. $version = $this->versionParser->normalizeBranch($branch);
  17546. $prettyVersion = 'dev-' . $branch;
  17547. if ('9999999-dev' === $version) {
  17548. $version = $prettyVersion;
  17549. }
  17550. }
  17551. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  17552. try {
  17553. $version = $this->versionParser->normalize(trim($output));
  17554. $prettyVersion = trim($output);
  17555. } catch (\Exception $e) {
  17556. }
  17557. }
  17558. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  17559. }
  17560. private function guessSvnVersion(array $packageConfig, $path)
  17561. {
  17562. SvnUtil::cleanEnv();
  17563. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  17564. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  17565. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  17566. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  17567. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  17568. if (preg_match($urlPattern, $output, $matches)) {
  17569. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  17570. $version = $this->versionParser->normalizeBranch($matches[3]);
  17571. $prettyVersion = 'dev-' . $matches[3];
  17572. if ('9999999-dev' === $version) {
  17573. $version = $prettyVersion;
  17574. }
  17575. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  17576. }
  17577. $prettyVersion = trim($matches[1]);
  17578. $version = $this->versionParser->normalize($prettyVersion);
  17579. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  17580. }
  17581. }
  17582. }
  17583. }
  17584. <?php
  17585. namespace Composer\Package\Version;
  17586. use Composer\Semver\VersionParser as SemverVersionParser;
  17587. class VersionParser extends SemverVersionParser
  17588. {
  17589. private static $constraints = array();
  17590. public function parseConstraints($constraints)
  17591. {
  17592. if (!isset(self::$constraints[$constraints])) {
  17593. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  17594. }
  17595. return self::$constraints[$constraints];
  17596. }
  17597. public function parseNameVersionPairs(array $pairs)
  17598. {
  17599. $pairs = array_values($pairs);
  17600. $result = array();
  17601. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  17602. $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  17603. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/')) {
  17604. $pair .= ' '.$pairs[$i + 1];
  17605. $i++;
  17606. }
  17607. if (strpos($pair, ' ')) {
  17608. list($name, $version) = explode(" ", $pair, 2);
  17609. $result[] = array('name' => $name, 'version' => $version);
  17610. } else {
  17611. $result[] = array('name' => $pair);
  17612. }
  17613. }
  17614. return $result;
  17615. }
  17616. }
  17617. <?php
  17618. namespace Composer\Package\Version;
  17619. use Composer\DependencyResolver\Pool;
  17620. use Composer\Package\BasePackage;
  17621. use Composer\Package\PackageInterface;
  17622. use Composer\Package\Loader\ArrayLoader;
  17623. use Composer\Package\Dumper\ArrayDumper;
  17624. use Composer\Semver\Constraint\Constraint;
  17625. class VersionSelector
  17626. {
  17627. private $pool;
  17628. private $parser;
  17629. public function __construct(Pool $pool)
  17630. {
  17631. $this->pool = $pool;
  17632. }
  17633. public function findBestCandidate($packageName, $targetPackageVersion = null, $targetPhpVersion = null, $preferredStability = 'stable')
  17634. {
  17635. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  17636. $candidates = $this->pool->whatProvides(strtolower($packageName), $constraint, true);
  17637. if ($targetPhpVersion) {
  17638. $phpConstraint = new Constraint('==', $this->getParser()->normalize($targetPhpVersion));
  17639. $candidates = array_filter($candidates, function ($pkg) use ($phpConstraint) {
  17640. $reqs = $pkg->getRequires();
  17641. return !isset($reqs['php']) || $reqs['php']->getConstraint()->matches($phpConstraint);
  17642. });
  17643. }
  17644. if (!$candidates) {
  17645. return false;
  17646. }
  17647. $package = reset($candidates);
  17648. $minPriority = BasePackage::$stabilities[$preferredStability];
  17649. foreach ($candidates as $candidate) {
  17650. $candidatePriority = $candidate->getStabilityPriority();
  17651. $currentPriority = $package->getStabilityPriority();
  17652. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  17653. continue;
  17654. }
  17655. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  17656. $package = $candidate;
  17657. continue;
  17658. }
  17659. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  17660. $package = $candidate;
  17661. }
  17662. }
  17663. return $package;
  17664. }
  17665. public function findRecommendedRequireVersion(PackageInterface $package)
  17666. {
  17667. $version = $package->getVersion();
  17668. if (!$package->isDev()) {
  17669. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  17670. }
  17671. $loader = new ArrayLoader($this->getParser());
  17672. $dumper = new ArrayDumper();
  17673. $extra = $loader->getBranchAlias($dumper->dump($package));
  17674. if ($extra) {
  17675. $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  17676. if ($count) {
  17677. $extra = str_replace('.9999999', '.0', $extra);
  17678. return $this->transformVersion($extra, $extra, 'dev');
  17679. }
  17680. }
  17681. return $package->getPrettyVersion();
  17682. }
  17683. private function transformVersion($version, $prettyVersion, $stability)
  17684. {
  17685. $semanticVersionParts = explode('.', $version);
  17686. if (count($semanticVersionParts) == 4 && preg_match('{^0\D?}', $semanticVersionParts[3])) {
  17687. if ($semanticVersionParts[0] === '0') {
  17688. unset($semanticVersionParts[3]);
  17689. } else {
  17690. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  17691. }
  17692. $version = implode('.', $semanticVersionParts);
  17693. } else {
  17694. return $prettyVersion;
  17695. }
  17696. if ($stability != 'stable') {
  17697. $version .= '@'.$stability;
  17698. }
  17699. return '^' . $version;
  17700. }
  17701. private function getParser()
  17702. {
  17703. if ($this->parser === null) {
  17704. $this->parser = new VersionParser();
  17705. }
  17706. return $this->parser;
  17707. }
  17708. }
  17709. <?php
  17710. namespace Composer\Plugin\Capability;
  17711. interface Capability
  17712. {
  17713. }
  17714. <?php
  17715. namespace Composer\Plugin\Capability;
  17716. interface CommandProvider extends Capability
  17717. {
  17718. public function getCommands();
  17719. }
  17720. <?php
  17721. namespace Composer\Plugin;
  17722. interface Capable
  17723. {
  17724. public function getCapabilities();
  17725. }
  17726. <?php
  17727. namespace Composer\Plugin;
  17728. use Composer\EventDispatcher\Event;
  17729. use Symfony\Component\Console\Input\InputInterface;
  17730. use Symfony\Component\Console\Output\OutputInterface;
  17731. class CommandEvent extends Event
  17732. {
  17733. private $commandName;
  17734. private $input;
  17735. private $output;
  17736. public function __construct($name, $commandName, $input, $output, array $args = array(), array $flags = array())
  17737. {
  17738. parent::__construct($name, $args, $flags);
  17739. $this->commandName = $commandName;
  17740. $this->input = $input;
  17741. $this->output = $output;
  17742. }
  17743. public function getInput()
  17744. {
  17745. return $this->input;
  17746. }
  17747. public function getOutput()
  17748. {
  17749. return $this->output;
  17750. }
  17751. public function getCommandName()
  17752. {
  17753. return $this->commandName;
  17754. }
  17755. }
  17756. <?php
  17757. namespace Composer\Plugin;
  17758. class PluginEvents
  17759. {
  17760. const INIT = 'init';
  17761. const COMMAND = 'command';
  17762. const PRE_FILE_DOWNLOAD = 'pre-file-download';
  17763. }
  17764. <?php
  17765. namespace Composer\Plugin;
  17766. use Composer\Composer;
  17767. use Composer\IO\IOInterface;
  17768. interface PluginInterface
  17769. {
  17770. const PLUGIN_API_VERSION = '1.1.0';
  17771. public function activate(Composer $composer, IOInterface $io);
  17772. }
  17773. <?php
  17774. namespace Composer\Plugin;
  17775. use Composer\Composer;
  17776. use Composer\EventDispatcher\EventSubscriberInterface;
  17777. use Composer\IO\IOInterface;
  17778. use Composer\Package\Package;
  17779. use Composer\Package\Version\VersionParser;
  17780. use Composer\Repository\RepositoryInterface;
  17781. use Composer\Package\AliasPackage;
  17782. use Composer\Package\PackageInterface;
  17783. use Composer\Package\Link;
  17784. use Composer\Semver\Constraint\Constraint;
  17785. use Composer\DependencyResolver\Pool;
  17786. use Composer\Plugin\Capability\Capability;
  17787. class PluginManager
  17788. {
  17789. protected $composer;
  17790. protected $io;
  17791. protected $globalComposer;
  17792. protected $versionParser;
  17793. protected $disablePlugins = false;
  17794. protected $plugins = array();
  17795. protected $registeredPlugins = array();
  17796. private static $classCounter = 0;
  17797. public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  17798. {
  17799. $this->io = $io;
  17800. $this->composer = $composer;
  17801. $this->globalComposer = $globalComposer;
  17802. $this->versionParser = new VersionParser();
  17803. $this->disablePlugins = $disablePlugins;
  17804. }
  17805. public function loadInstalledPlugins()
  17806. {
  17807. if ($this->disablePlugins) {
  17808. return;
  17809. }
  17810. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  17811. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  17812. if ($repo) {
  17813. $this->loadRepository($repo);
  17814. }
  17815. if ($globalRepo) {
  17816. $this->loadRepository($globalRepo);
  17817. }
  17818. }
  17819. public function getPlugins()
  17820. {
  17821. return $this->plugins;
  17822. }
  17823. public function getGlobalComposer()
  17824. {
  17825. return $this->globalComposer;
  17826. }
  17827. public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
  17828. {
  17829. if ($this->disablePlugins) {
  17830. return;
  17831. }
  17832. if ($package->getType() === 'composer-plugin') {
  17833. $requiresComposer = null;
  17834. foreach ($package->getRequires() as $link) {
  17835. if ('composer-plugin-api' === $link->getTarget()) {
  17836. $requiresComposer = $link->getConstraint();
  17837. break;
  17838. }
  17839. }
  17840. if (!$requiresComposer) {
  17841. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  17842. }
  17843. $currentPluginApiVersion = $this->getPluginApiVersion();
  17844. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  17845. if ($requiresComposer->getPrettyString() === '1.0.0' && $this->getPluginApiVersion() === '1.0.0') {
  17846. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin requires composer-plugin-api 1.0.0, this *WILL* break in the future and it should be fixed ASAP (require ^1.0 for example).</warning>');
  17847. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  17848. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin was skipped because it requires a Plugin API version ("' . $requiresComposer->getPrettyString() . '") that does not match your Composer installation ("' . $currentPluginApiVersion . '"). You may need to run composer update with the "--no-plugins" option.</warning>');
  17849. return;
  17850. }
  17851. }
  17852. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  17853. if (in_array($package->getName(), $this->registeredPlugins)) {
  17854. return;
  17855. }
  17856. $extra = $package->getExtra();
  17857. if (empty($extra['class'])) {
  17858. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  17859. }
  17860. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  17861. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  17862. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  17863. $pool = new Pool('dev');
  17864. $pool->addRepository($localRepo);
  17865. if ($globalRepo) {
  17866. $pool->addRepository($globalRepo);
  17867. }
  17868. $autoloadPackages = array($package->getName() => $package);
  17869. $autoloadPackages = $this->collectDependencies($pool, $autoloadPackages, $package);
  17870. $generator = $this->composer->getAutoloadGenerator();
  17871. $autoloads = array();
  17872. foreach ($autoloadPackages as $autoloadPackage) {
  17873. $downloadPath = $this->getInstallPath($autoloadPackage, ($globalRepo && $globalRepo->hasPackage($autoloadPackage)));
  17874. $autoloads[] = array($autoloadPackage, $downloadPath);
  17875. }
  17876. $map = $generator->parseAutoloads($autoloads, new Package('dummy', '1.0.0.0', '1.0.0'));
  17877. $classLoader = $generator->createLoader($map);
  17878. $classLoader->register();
  17879. foreach ($classes as $class) {
  17880. if (class_exists($class, false)) {
  17881. $class = trim($class, '\\');
  17882. $path = $classLoader->findFile($class);
  17883. $code = file_get_contents($path);
  17884. $separatorPos = strrpos($class, '\\');
  17885. if ($separatorPos) {
  17886. $className = substr($class, $separatorPos + 1);
  17887. }
  17888. $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  17889. $code = str_replace('__FILE__', var_export($path, true), $code);
  17890. $code = str_replace('__DIR__', var_export(dirname($path), true), $code);
  17891. $code = str_replace('__CLASS__', var_export($class, true), $code);
  17892. $code = preg_replace('/^\s*<\?(php)?/i', '', $code, 1);
  17893. eval($code);
  17894. $class .= '_composer_tmp'.self::$classCounter;
  17895. self::$classCounter++;
  17896. }
  17897. if ($oldInstallerPlugin) {
  17898. $installer = new $class($this->io, $this->composer);
  17899. $this->composer->getInstallationManager()->addInstaller($installer);
  17900. } elseif (class_exists($class)) {
  17901. $plugin = new $class();
  17902. $this->addPlugin($plugin);
  17903. $this->registeredPlugins[] = $package->getName();
  17904. } elseif ($failOnMissingClasses) {
  17905. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  17906. }
  17907. }
  17908. }
  17909. protected function getPluginApiVersion()
  17910. {
  17911. return PluginInterface::PLUGIN_API_VERSION;
  17912. }
  17913. private function addPlugin(PluginInterface $plugin)
  17914. {
  17915. $this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  17916. $this->plugins[] = $plugin;
  17917. $plugin->activate($this->composer, $this->io);
  17918. if ($plugin instanceof EventSubscriberInterface) {
  17919. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  17920. }
  17921. }
  17922. private function loadRepository(RepositoryInterface $repo)
  17923. {
  17924. foreach ($repo->getPackages() as $package) {
  17925. if ($package instanceof AliasPackage) {
  17926. continue;
  17927. }
  17928. if ('composer-plugin' === $package->getType()) {
  17929. $this->registerPackage($package);
  17930. } elseif ('composer-installer' === $package->getType()) {
  17931. $this->registerPackage($package);
  17932. }
  17933. }
  17934. }
  17935. private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
  17936. {
  17937. $requires = array_merge(
  17938. $package->getRequires(),
  17939. $package->getDevRequires()
  17940. );
  17941. foreach ($requires as $requireLink) {
  17942. $requiredPackage = $this->lookupInstalledPackage($pool, $requireLink);
  17943. if ($requiredPackage && !isset($collected[$requiredPackage->getName()])) {
  17944. $collected[$requiredPackage->getName()] = $requiredPackage;
  17945. $collected = $this->collectDependencies($pool, $collected, $requiredPackage);
  17946. }
  17947. }
  17948. return $collected;
  17949. }
  17950. private function lookupInstalledPackage(Pool $pool, Link $link)
  17951. {
  17952. $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
  17953. return (!empty($packages)) ? $packages[0] : null;
  17954. }
  17955. private function getInstallPath(PackageInterface $package, $global = false)
  17956. {
  17957. if (!$global) {
  17958. return $this->composer->getInstallationManager()->getInstallPath($package);
  17959. }
  17960. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  17961. }
  17962. protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
  17963. {
  17964. if (!($plugin instanceof Capable)) {
  17965. return null;
  17966. }
  17967. $capabilities = (array) $plugin->getCapabilities();
  17968. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  17969. return trim($capabilities[$capability]);
  17970. }
  17971. if (
  17972. array_key_exists($capability, $capabilities)
  17973. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  17974. ) {
  17975. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], 1));
  17976. }
  17977. }
  17978. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
  17979. {
  17980. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  17981. if (!class_exists($capabilityClass)) {
  17982. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  17983. }
  17984. $ctorArgs['plugin'] = $plugin;
  17985. $capabilityObj = new $capabilityClass($ctorArgs);
  17986. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  17987. throw new \RuntimeException(
  17988. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  17989. );
  17990. }
  17991. return $capabilityObj;
  17992. }
  17993. }
  17994. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array())
  17995. {
  17996. $capabilities = array();
  17997. foreach ($this->getPlugins() as $plugin) {
  17998. if ($capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs)) {
  17999. $capabilities[] = $capability;
  18000. }
  18001. }
  18002. return $capabilities;
  18003. }
  18004. }
  18005. <?php
  18006. namespace Composer\Plugin;
  18007. use Composer\EventDispatcher\Event;
  18008. use Composer\Util\RemoteFilesystem;
  18009. class PreFileDownloadEvent extends Event
  18010. {
  18011. private $rfs;
  18012. private $processedUrl;
  18013. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  18014. {
  18015. parent::__construct($name);
  18016. $this->rfs = $rfs;
  18017. $this->processedUrl = $processedUrl;
  18018. }
  18019. public function getRemoteFilesystem()
  18020. {
  18021. return $this->rfs;
  18022. }
  18023. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  18024. {
  18025. $this->rfs = $rfs;
  18026. }
  18027. public function getProcessedUrl()
  18028. {
  18029. return $this->processedUrl;
  18030. }
  18031. }
  18032. <?php
  18033. namespace Composer\Repository;
  18034. use Composer\Package\AliasPackage;
  18035. use Composer\Package\PackageInterface;
  18036. use Composer\Package\CompletePackageInterface;
  18037. use Composer\Package\Version\VersionParser;
  18038. use Composer\Semver\Constraint\ConstraintInterface;
  18039. use Composer\Semver\Constraint\Constraint;
  18040. class ArrayRepository extends BaseRepository
  18041. {
  18042. protected $packages;
  18043. public function __construct(array $packages = array())
  18044. {
  18045. foreach ($packages as $package) {
  18046. $this->addPackage($package);
  18047. }
  18048. }
  18049. public function findPackage($name, $constraint)
  18050. {
  18051. $name = strtolower($name);
  18052. if (!$constraint instanceof ConstraintInterface) {
  18053. $versionParser = new VersionParser();
  18054. $constraint = $versionParser->parseConstraints($constraint);
  18055. }
  18056. foreach ($this->getPackages() as $package) {
  18057. if ($name === $package->getName()) {
  18058. $pkgConstraint = new Constraint('==', $package->getVersion());
  18059. if ($constraint->matches($pkgConstraint)) {
  18060. return $package;
  18061. }
  18062. }
  18063. }
  18064. return null;
  18065. }
  18066. public function findPackages($name, $constraint = null)
  18067. {
  18068. $name = strtolower($name);
  18069. $packages = array();
  18070. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  18071. $versionParser = new VersionParser();
  18072. $constraint = $versionParser->parseConstraints($constraint);
  18073. }
  18074. foreach ($this->getPackages() as $package) {
  18075. if ($name === $package->getName()) {
  18076. $pkgConstraint = new Constraint('==', $package->getVersion());
  18077. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  18078. $packages[] = $package;
  18079. }
  18080. }
  18081. }
  18082. return $packages;
  18083. }
  18084. public function search($query, $mode = 0, $type = null)
  18085. {
  18086. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  18087. $matches = array();
  18088. foreach ($this->getPackages() as $package) {
  18089. $name = $package->getName();
  18090. if (isset($matches[$name])) {
  18091. continue;
  18092. }
  18093. if (preg_match($regex, $name)
  18094. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && preg_match($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  18095. ) {
  18096. if (null !== $type && $package->getType() !== $type) {
  18097. continue;
  18098. }
  18099. $matches[$name] = array(
  18100. 'name' => $package->getPrettyName(),
  18101. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  18102. );
  18103. }
  18104. }
  18105. return array_values($matches);
  18106. }
  18107. public function hasPackage(PackageInterface $package)
  18108. {
  18109. $packageId = $package->getUniqueName();
  18110. foreach ($this->getPackages() as $repoPackage) {
  18111. if ($packageId === $repoPackage->getUniqueName()) {
  18112. return true;
  18113. }
  18114. }
  18115. return false;
  18116. }
  18117. public function addPackage(PackageInterface $package)
  18118. {
  18119. if (null === $this->packages) {
  18120. $this->initialize();
  18121. }
  18122. $package->setRepository($this);
  18123. $this->packages[] = $package;
  18124. if ($package instanceof AliasPackage) {
  18125. $aliasedPackage = $package->getAliasOf();
  18126. if (null === $aliasedPackage->getRepository()) {
  18127. $this->addPackage($aliasedPackage);
  18128. }
  18129. }
  18130. }
  18131. protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
  18132. {
  18133. return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
  18134. }
  18135. public function removePackage(PackageInterface $package)
  18136. {
  18137. $packageId = $package->getUniqueName();
  18138. foreach ($this->getPackages() as $key => $repoPackage) {
  18139. if ($packageId === $repoPackage->getUniqueName()) {
  18140. array_splice($this->packages, $key, 1);
  18141. return;
  18142. }
  18143. }
  18144. }
  18145. public function getPackages()
  18146. {
  18147. if (null === $this->packages) {
  18148. $this->initialize();
  18149. }
  18150. return $this->packages;
  18151. }
  18152. public function count()
  18153. {
  18154. return count($this->packages);
  18155. }
  18156. protected function initialize()
  18157. {
  18158. $this->packages = array();
  18159. }
  18160. }
  18161. <?php
  18162. namespace Composer\Repository;
  18163. use Composer\IO\IOInterface;
  18164. use Composer\Json\JsonFile;
  18165. use Composer\Package\Loader\ArrayLoader;
  18166. use Composer\Package\Loader\LoaderInterface;
  18167. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  18168. {
  18169. protected $loader;
  18170. protected $lookup;
  18171. protected $repoConfig;
  18172. public function __construct(array $repoConfig, IOInterface $io)
  18173. {
  18174. parent::__construct();
  18175. if (!extension_loaded('zip')) {
  18176. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  18177. }
  18178. $this->loader = new ArrayLoader();
  18179. $this->lookup = $repoConfig['url'];
  18180. $this->io = $io;
  18181. $this->repoConfig = $repoConfig;
  18182. }
  18183. public function getRepoConfig()
  18184. {
  18185. return $this->repoConfig;
  18186. }
  18187. protected function initialize()
  18188. {
  18189. parent::initialize();
  18190. $this->scanDirectory($this->lookup);
  18191. }
  18192. private function scanDirectory($path)
  18193. {
  18194. $io = $this->io;
  18195. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  18196. $iterator = new \RecursiveIteratorIterator($directory);
  18197. $regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
  18198. foreach ($regex as $file) {
  18199. if (!$file->isFile()) {
  18200. continue;
  18201. }
  18202. $package = $this->getComposerInformation($file);
  18203. if (!$package) {
  18204. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  18205. continue;
  18206. }
  18207. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  18208. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  18209. $this->addPackage($package);
  18210. }
  18211. }
  18212. private function locateFile(\ZipArchive $zip, $filename)
  18213. {
  18214. $indexOfShortestMatch = false;
  18215. $lengthOfShortestMatch = -1;
  18216. for ($i = 0; $i < $zip->numFiles; $i++) {
  18217. $stat = $zip->statIndex($i);
  18218. if (strcmp(basename($stat['name']), $filename) === 0) {
  18219. $directoryName = dirname($stat['name']);
  18220. if ($directoryName == '.') {
  18221. return $i;
  18222. }
  18223. if (strpos($directoryName, '\\') !== false ||
  18224. strpos($directoryName, '/') !== false) {
  18225. continue;
  18226. }
  18227. $length = strlen($stat['name']);
  18228. if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) {
  18229. $contents = $zip->getFromIndex($i);
  18230. if ($contents !== false) {
  18231. $indexOfShortestMatch = $i;
  18232. $lengthOfShortestMatch = $length;
  18233. }
  18234. }
  18235. }
  18236. }
  18237. return $indexOfShortestMatch;
  18238. }
  18239. private function getComposerInformation(\SplFileInfo $file)
  18240. {
  18241. $zip = new \ZipArchive();
  18242. $zip->open($file->getPathname());
  18243. if (0 == $zip->numFiles) {
  18244. return false;
  18245. }
  18246. $foundFileIndex = $this->locateFile($zip, 'composer.json');
  18247. if (false === $foundFileIndex) {
  18248. return false;
  18249. }
  18250. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  18251. $composerFile = "zip://{$file->getPathname()}#$configurationFileName";
  18252. $json = file_get_contents($composerFile);
  18253. $package = JsonFile::parseJson($json, $composerFile);
  18254. $package['dist'] = array(
  18255. 'type' => 'zip',
  18256. 'url' => strtr($file->getPathname(), '\\', '/'),
  18257. 'shasum' => sha1_file($file->getRealPath()),
  18258. );
  18259. try {
  18260. $package = $this->loader->load($package);
  18261. } catch (\UnexpectedValueException $e) {
  18262. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  18263. }
  18264. return $package;
  18265. }
  18266. }
  18267. <?php
  18268. namespace Composer\Repository;
  18269. use Composer\Package\RootPackageInterface;
  18270. use Composer\Semver\Constraint\ConstraintInterface;
  18271. use Composer\Semver\Constraint\Constraint;
  18272. use Composer\Package\Link;
  18273. abstract class BaseRepository implements RepositoryInterface
  18274. {
  18275. public function getDependents($needle, $constraint = null, $invert = false, $recurse = true, $packagesFound = null)
  18276. {
  18277. $needles = (array) $needle;
  18278. $results = array();
  18279. if (null === $packagesFound) {
  18280. $packagesFound = $needles;
  18281. }
  18282. $rootPackage = null;
  18283. foreach ($this->getPackages() as $package) {
  18284. if ($package instanceof RootPackageInterface) {
  18285. $rootPackage = $package;
  18286. break;
  18287. }
  18288. }
  18289. foreach ($this->getPackages() as $package) {
  18290. $links = $package->getRequires();
  18291. $packagesInTree = $packagesFound;
  18292. if (!$invert) {
  18293. $links += $package->getReplaces();
  18294. }
  18295. if ($package instanceof RootPackageInterface) {
  18296. $links += $package->getDevRequires();
  18297. }
  18298. foreach ($links as $link) {
  18299. foreach ($needles as $needle) {
  18300. if ($link->getTarget() === $needle) {
  18301. if (is_null($constraint) || (($link->getConstraint()->matches($constraint) === !$invert))) {
  18302. if (in_array($link->getSource(), $packagesInTree)) {
  18303. $results[$link->getSource()] = array($package, $link, false);
  18304. continue;
  18305. }
  18306. $packagesInTree[] = $link->getSource();
  18307. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
  18308. $results[$link->getSource()] = array($package, $link, $dependents);
  18309. }
  18310. }
  18311. }
  18312. }
  18313. if ($invert && in_array($package->getName(), $needles)) {
  18314. foreach ($package->getConflicts() as $link) {
  18315. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  18316. $version = new Constraint('=', $pkg->getVersion());
  18317. if ($link->getConstraint()->matches($version) === $invert) {
  18318. $results[] = array($package, $link, false);
  18319. }
  18320. }
  18321. }
  18322. }
  18323. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  18324. foreach ($package->getRequires() as $link) {
  18325. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  18326. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  18327. continue;
  18328. }
  18329. $platformPkg = $this->findPackage($link->getTarget(), '*');
  18330. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  18331. $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false);
  18332. continue;
  18333. }
  18334. foreach ($this->getPackages() as $pkg) {
  18335. if (!in_array($link->getTarget(), $pkg->getNames())) {
  18336. continue;
  18337. }
  18338. $version = new Constraint('=', $pkg->getVersion());
  18339. if (!$link->getConstraint()->matches($version)) {
  18340. if ($rootPackage) {
  18341. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  18342. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  18343. $results[] = array($package, $link, false);
  18344. $results[] = array($rootPackage, $rootReq, false);
  18345. continue 3;
  18346. }
  18347. }
  18348. $results[] = array($package, $link, false);
  18349. $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), null, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
  18350. } else {
  18351. $results[] = array($package, $link, false);
  18352. }
  18353. }
  18354. continue 2;
  18355. }
  18356. }
  18357. }
  18358. }
  18359. ksort($results);
  18360. return $results;
  18361. }
  18362. }
  18363. <?php
  18364. namespace Composer\Repository;
  18365. use Composer\Package\Loader\ArrayLoader;
  18366. use Composer\Package\PackageInterface;
  18367. use Composer\Package\AliasPackage;
  18368. use Composer\Package\Version\VersionParser;
  18369. use Composer\DependencyResolver\Pool;
  18370. use Composer\Json\JsonFile;
  18371. use Composer\Cache;
  18372. use Composer\Config;
  18373. use Composer\Factory;
  18374. use Composer\IO\IOInterface;
  18375. use Composer\Util\RemoteFilesystem;
  18376. use Composer\Plugin\PluginEvents;
  18377. use Composer\Plugin\PreFileDownloadEvent;
  18378. use Composer\EventDispatcher\EventDispatcher;
  18379. use Composer\Downloader\TransportException;
  18380. use Composer\Semver\Constraint\ConstraintInterface;
  18381. use Composer\Semver\Constraint\Constraint;
  18382. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  18383. {
  18384. protected $config;
  18385. protected $repoConfig;
  18386. protected $options;
  18387. protected $url;
  18388. protected $baseUrl;
  18389. protected $io;
  18390. protected $rfs;
  18391. protected $cache;
  18392. protected $notifyUrl;
  18393. protected $searchUrl;
  18394. protected $hasProviders = false;
  18395. protected $providersUrl;
  18396. protected $lazyProvidersUrl;
  18397. protected $providerListing;
  18398. protected $providers = array();
  18399. protected $providersByUid = array();
  18400. protected $loader;
  18401. protected $rootAliases;
  18402. protected $allowSslDowngrade = false;
  18403. protected $eventDispatcher;
  18404. protected $sourceMirrors;
  18405. protected $distMirrors;
  18406. private $degradedMode = false;
  18407. private $rootData;
  18408. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  18409. {
  18410. parent::__construct();
  18411. if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
  18412. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  18413. }
  18414. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  18415. if ('https?' === substr($repoConfig['url'], 0, 6)) {
  18416. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  18417. }
  18418. $urlBits = parse_url($repoConfig['url']);
  18419. if ($urlBits === false || empty($urlBits['scheme'])) {
  18420. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  18421. }
  18422. if (!isset($repoConfig['options'])) {
  18423. $repoConfig['options'] = array();
  18424. }
  18425. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  18426. $this->allowSslDowngrade = true;
  18427. }
  18428. $this->config = $config;
  18429. $this->options = $repoConfig['options'];
  18430. $this->url = $repoConfig['url'];
  18431. $this->baseUrl = rtrim(preg_replace('{^(.*)(?:/[^/\\]+.json)?(?:[?#].*)?$}', '$1', $this->url), '/');
  18432. $this->io = $io;
  18433. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
  18434. $this->loader = new ArrayLoader();
  18435. if ($rfs && $this->options) {
  18436. $rfs = clone $rfs;
  18437. $rfs->setOptions($this->options);
  18438. }
  18439. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
  18440. $this->eventDispatcher = $eventDispatcher;
  18441. $this->repoConfig = $repoConfig;
  18442. }
  18443. public function getRepoConfig()
  18444. {
  18445. return $this->repoConfig;
  18446. }
  18447. public function setRootAliases(array $rootAliases)
  18448. {
  18449. $this->rootAliases = $rootAliases;
  18450. }
  18451. public function findPackage($name, $constraint)
  18452. {
  18453. if (!$this->hasProviders()) {
  18454. return parent::findPackage($name, $constraint);
  18455. }
  18456. $name = strtolower($name);
  18457. if (!$constraint instanceof ConstraintInterface) {
  18458. $versionParser = new VersionParser();
  18459. $constraint = $versionParser->parseConstraints($constraint);
  18460. }
  18461. foreach ($this->getProviderNames() as $providerName) {
  18462. if ($name === $providerName) {
  18463. $packages = $this->whatProvides(new Pool('dev'), $providerName);
  18464. foreach ($packages as $package) {
  18465. if ($name === $package->getName()) {
  18466. $pkgConstraint = new Constraint('==', $package->getVersion());
  18467. if ($constraint->matches($pkgConstraint)) {
  18468. return $package;
  18469. }
  18470. }
  18471. }
  18472. break;
  18473. }
  18474. }
  18475. }
  18476. public function findPackages($name, $constraint = null)
  18477. {
  18478. if (!$this->hasProviders()) {
  18479. return parent::findPackages($name, $constraint);
  18480. }
  18481. $name = strtolower($name);
  18482. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  18483. $versionParser = new VersionParser();
  18484. $constraint = $versionParser->parseConstraints($constraint);
  18485. }
  18486. $packages = array();
  18487. foreach ($this->getProviderNames() as $providerName) {
  18488. if ($name === $providerName) {
  18489. $candidates = $this->whatProvides(new Pool('dev'), $providerName);
  18490. foreach ($candidates as $package) {
  18491. if ($name === $package->getName()) {
  18492. $pkgConstraint = new Constraint('==', $package->getVersion());
  18493. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  18494. $packages[] = $package;
  18495. }
  18496. }
  18497. }
  18498. break;
  18499. }
  18500. }
  18501. return $packages;
  18502. }
  18503. public function getPackages()
  18504. {
  18505. if ($this->hasProviders()) {
  18506. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
  18507. }
  18508. return parent::getPackages();
  18509. }
  18510. public function search($query, $mode = 0, $type = null)
  18511. {
  18512. $this->loadRootServerFile();
  18513. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  18514. $url = str_replace(array('%query%', '%type%'), array($query, $type), $this->searchUrl);
  18515. $hostname = parse_url($url, PHP_URL_HOST) ?: $url;
  18516. $json = $this->rfs->getContents($hostname, $url, false);
  18517. $results = JsonFile::parseJson($json, $url);
  18518. return $results['results'];
  18519. }
  18520. if ($this->hasProviders()) {
  18521. $results = array();
  18522. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  18523. foreach ($this->getProviderNames() as $name) {
  18524. if (preg_match($regex, $name)) {
  18525. $results[] = array('name' => $name);
  18526. }
  18527. }
  18528. return $results;
  18529. }
  18530. return parent::search($query, $mode);
  18531. }
  18532. public function getProviderNames()
  18533. {
  18534. $this->loadRootServerFile();
  18535. if (null === $this->providerListing) {
  18536. $this->loadProviderListings($this->loadRootServerFile());
  18537. }
  18538. if ($this->lazyProvidersUrl) {
  18539. return array();
  18540. }
  18541. if ($this->providersUrl) {
  18542. return array_keys($this->providerListing);
  18543. }
  18544. return array();
  18545. }
  18546. protected function configurePackageTransportOptions(PackageInterface $package)
  18547. {
  18548. foreach ($package->getDistUrls() as $url) {
  18549. if (strpos($url, $this->baseUrl) === 0) {
  18550. $package->setTransportOptions($this->options);
  18551. return;
  18552. }
  18553. }
  18554. }
  18555. public function hasProviders()
  18556. {
  18557. $this->loadRootServerFile();
  18558. return $this->hasProviders;
  18559. }
  18560. public function resetPackageIds()
  18561. {
  18562. foreach ($this->providersByUid as $package) {
  18563. if ($package instanceof AliasPackage) {
  18564. $package->getAliasOf()->setId(-1);
  18565. }
  18566. $package->setId(-1);
  18567. }
  18568. }
  18569. public function whatProvides(Pool $pool, $name, $bypassFilters = false)
  18570. {
  18571. if (isset($this->providers[$name]) && !$bypassFilters) {
  18572. return $this->providers[$name];
  18573. }
  18574. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
  18575. return array();
  18576. }
  18577. if (null === $this->providerListing) {
  18578. $this->loadProviderListings($this->loadRootServerFile());
  18579. }
  18580. $useLastModifiedCheck = false;
  18581. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  18582. $hash = null;
  18583. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  18584. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  18585. $useLastModifiedCheck = true;
  18586. } elseif ($this->providersUrl) {
  18587. if (!isset($this->providerListing[$name])) {
  18588. return array();
  18589. }
  18590. $hash = $this->providerListing[$name]['sha256'];
  18591. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  18592. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  18593. } else {
  18594. return array();
  18595. }
  18596. $packages = null;
  18597. if ($cacheKey) {
  18598. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  18599. $packages = json_decode($this->cache->read($cacheKey), true);
  18600. } elseif ($useLastModifiedCheck) {
  18601. if ($contents = $this->cache->read($cacheKey)) {
  18602. $contents = json_decode($contents, true);
  18603. if (isset($contents['last-modified'])) {
  18604. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  18605. if (true === $response) {
  18606. $packages = $contents;
  18607. } elseif ($response) {
  18608. $packages = $response;
  18609. }
  18610. }
  18611. }
  18612. }
  18613. }
  18614. if (!$packages) {
  18615. try {
  18616. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  18617. } catch (TransportException $e) {
  18618. if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) {
  18619. $packages = array('packages' => array());
  18620. } else {
  18621. throw $e;
  18622. }
  18623. }
  18624. }
  18625. $this->providers[$name] = array();
  18626. foreach ($packages['packages'] as $versions) {
  18627. foreach ($versions as $version) {
  18628. if (isset($this->providersByUid[$version['uid']])) {
  18629. if (!isset($this->providers[$name][$version['uid']])) {
  18630. if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
  18631. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
  18632. $this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
  18633. } else {
  18634. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
  18635. }
  18636. if (isset($this->providersByUid[$version['uid'].'-root'])) {
  18637. $this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
  18638. }
  18639. }
  18640. } else {
  18641. if (!$bypassFilters && !$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
  18642. continue;
  18643. }
  18644. $package = $this->createPackage($version, 'Composer\Package\CompletePackage');
  18645. $package->setRepository($this);
  18646. if ($package instanceof AliasPackage) {
  18647. $aliased = $package->getAliasOf();
  18648. $aliased->setRepository($this);
  18649. $this->providers[$name][$version['uid']] = $aliased;
  18650. $this->providers[$name][$version['uid'].'-alias'] = $package;
  18651. $this->providersByUid[$version['uid']] = $package;
  18652. } else {
  18653. $this->providers[$name][$version['uid']] = $package;
  18654. $this->providersByUid[$version['uid']] = $package;
  18655. }
  18656. unset($rootAliasData);
  18657. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  18658. $rootAliasData = $this->rootAliases[$package->getName()][$package->getVersion()];
  18659. } elseif ($package instanceof AliasPackage && isset($this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()])) {
  18660. $rootAliasData = $this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()];
  18661. }
  18662. if (isset($rootAliasData)) {
  18663. $alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
  18664. $alias->setRepository($this);
  18665. $this->providers[$name][$version['uid'].'-root'] = $alias;
  18666. $this->providersByUid[$version['uid'].'-root'] = $alias;
  18667. }
  18668. }
  18669. }
  18670. }
  18671. $result = $this->providers[$name];
  18672. if ($bypassFilters) {
  18673. foreach ($this->providers[$name] as $uid => $provider) {
  18674. unset($this->providersByUid[$uid]);
  18675. }
  18676. unset($this->providers[$name]);
  18677. }
  18678. return $result;
  18679. }
  18680. protected function initialize()
  18681. {
  18682. parent::initialize();
  18683. $repoData = $this->loadDataFromServer();
  18684. foreach ($repoData as $package) {
  18685. $this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
  18686. }
  18687. }
  18688. public function addPackage(PackageInterface $package)
  18689. {
  18690. parent::addPackage($package);
  18691. $this->configurePackageTransportOptions($package);
  18692. }
  18693. protected function loadRootServerFile()
  18694. {
  18695. if (null !== $this->rootData) {
  18696. return $this->rootData;
  18697. }
  18698. if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
  18699. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  18700. }
  18701. $jsonUrlParts = parse_url($this->url);
  18702. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  18703. $jsonUrl = $this->url;
  18704. } else {
  18705. $jsonUrl = $this->url . '/packages.json';
  18706. }
  18707. $data = $this->fetchFile($jsonUrl, 'packages.json');
  18708. if (!empty($data['notify-batch'])) {
  18709. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  18710. } elseif (!empty($data['notify'])) {
  18711. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  18712. }
  18713. if (!empty($data['search'])) {
  18714. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  18715. }
  18716. if (!empty($data['mirrors'])) {
  18717. foreach ($data['mirrors'] as $mirror) {
  18718. if (!empty($mirror['git-url'])) {
  18719. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  18720. }
  18721. if (!empty($mirror['hg-url'])) {
  18722. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  18723. }
  18724. if (!empty($mirror['dist-url'])) {
  18725. $this->distMirrors[] = array('url' => $mirror['dist-url'], 'preferred' => !empty($mirror['preferred']));
  18726. }
  18727. }
  18728. }
  18729. if (!empty($data['warning'])) {
  18730. $this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
  18731. }
  18732. if (!empty($data['providers-lazy-url'])) {
  18733. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  18734. $this->hasProviders = true;
  18735. }
  18736. if ($this->allowSslDowngrade) {
  18737. $this->url = str_replace('https://', 'http://', $this->url);
  18738. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  18739. }
  18740. if (!empty($data['providers-url'])) {
  18741. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  18742. $this->hasProviders = true;
  18743. }
  18744. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  18745. $this->hasProviders = true;
  18746. }
  18747. if (preg_match('{^https?://packagist.org/?$}i', $this->url) && !empty($this->repoConfig['force-lazy-providers'])) {
  18748. $this->url = 'https://packagist.org';
  18749. $this->baseUrl = 'https://packagist.org';
  18750. $this->lazyProvidersUrl = $this->canonicalizeUrl('https://packagist.org/p/%package%.json');
  18751. $this->providersUrl = null;
  18752. } elseif (!empty($this->repoConfig['force-lazy-providers'])) {
  18753. $this->lazyProvidersUrl = $this->canonicalizeUrl('/p/%package%.json');
  18754. $this->providersUrl = null;
  18755. }
  18756. return $this->rootData = $data;
  18757. }
  18758. protected function canonicalizeUrl($url)
  18759. {
  18760. if ('/' === $url[0]) {
  18761. return preg_replace('{(https?://[^/]+).*}i', '$1' . $url, $this->url);
  18762. }
  18763. return $url;
  18764. }
  18765. protected function loadDataFromServer()
  18766. {
  18767. $data = $this->loadRootServerFile();
  18768. return $this->loadIncludes($data);
  18769. }
  18770. protected function loadProviderListings($data)
  18771. {
  18772. if (isset($data['providers'])) {
  18773. if (!is_array($this->providerListing)) {
  18774. $this->providerListing = array();
  18775. }
  18776. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  18777. }
  18778. if ($this->providersUrl && isset($data['provider-includes'])) {
  18779. $includes = $data['provider-includes'];
  18780. foreach ($includes as $include => $metadata) {
  18781. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  18782. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  18783. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  18784. $includedData = json_decode($this->cache->read($cacheKey), true);
  18785. } else {
  18786. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  18787. }
  18788. $this->loadProviderListings($includedData);
  18789. }
  18790. }
  18791. }
  18792. protected function loadIncludes($data)
  18793. {
  18794. $packages = array();
  18795. if (!isset($data['packages']) && !isset($data['includes'])) {
  18796. foreach ($data as $pkg) {
  18797. foreach ($pkg['versions'] as $metadata) {
  18798. $packages[] = $metadata;
  18799. }
  18800. }
  18801. return $packages;
  18802. }
  18803. if (isset($data['packages'])) {
  18804. foreach ($data['packages'] as $package => $versions) {
  18805. foreach ($versions as $version => $metadata) {
  18806. $packages[] = $metadata;
  18807. }
  18808. }
  18809. }
  18810. if (isset($data['includes'])) {
  18811. foreach ($data['includes'] as $include => $metadata) {
  18812. if ($this->cache->sha1($include) === $metadata['sha1']) {
  18813. $includedData = json_decode($this->cache->read($include), true);
  18814. } else {
  18815. $includedData = $this->fetchFile($include);
  18816. }
  18817. $packages = array_merge($packages, $this->loadIncludes($includedData));
  18818. }
  18819. }
  18820. return $packages;
  18821. }
  18822. protected function createPackage(array $data, $class = 'Composer\Package\CompletePackage')
  18823. {
  18824. try {
  18825. if (!isset($data['notification-url'])) {
  18826. $data['notification-url'] = $this->notifyUrl;
  18827. }
  18828. $package = $this->loader->load($data, $class);
  18829. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  18830. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  18831. }
  18832. $package->setDistMirrors($this->distMirrors);
  18833. $this->configurePackageTransportOptions($package);
  18834. return $package;
  18835. } catch (\Exception $e) {
  18836. throw new \RuntimeException('Could not load package '.(isset($data['name']) ? $data['name'] : json_encode($data)).' in '.$this->url.': ['.get_class($e).'] '.$e->getMessage(), 0, $e);
  18837. }
  18838. }
  18839. protected function fetchFile($filename, $cacheKey = null, $sha256 = null, $storeLastModifiedTime = false)
  18840. {
  18841. if (null === $cacheKey) {
  18842. $cacheKey = $filename;
  18843. $filename = $this->baseUrl.'/'.$filename;
  18844. }
  18845. if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
  18846. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  18847. }
  18848. $retries = 3;
  18849. while ($retries--) {
  18850. try {
  18851. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  18852. if ($this->eventDispatcher) {
  18853. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  18854. }
  18855. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  18856. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  18857. $json = $rfs->getContents($hostname, $filename, false);
  18858. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  18859. if ($this->allowSslDowngrade) {
  18860. $this->url = str_replace('http://', 'https://', $this->url);
  18861. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  18862. $filename = str_replace('http://', 'https://', $filename);
  18863. }
  18864. if ($retries) {
  18865. usleep(100000);
  18866. continue;
  18867. }
  18868. throw new RepositorySecurityException('The contents of '.$filename.' do not match its signature. This should indicate a man-in-the-middle attack. Try running composer again and report this if you think it is a mistake.');
  18869. }
  18870. $data = JsonFile::parseJson($json, $filename);
  18871. if ($cacheKey) {
  18872. if ($storeLastModifiedTime) {
  18873. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  18874. if ($lastModifiedDate) {
  18875. $data['last-modified'] = $lastModifiedDate;
  18876. $json = json_encode($data);
  18877. }
  18878. }
  18879. $this->cache->write($cacheKey, $json);
  18880. }
  18881. break;
  18882. } catch (\Exception $e) {
  18883. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  18884. throw $e;
  18885. }
  18886. if ($retries) {
  18887. usleep(100000);
  18888. continue;
  18889. }
  18890. if ($e instanceof RepositorySecurityException) {
  18891. throw $e;
  18892. }
  18893. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  18894. if (!$this->degradedMode) {
  18895. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  18896. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  18897. }
  18898. $this->degradedMode = true;
  18899. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  18900. break;
  18901. }
  18902. throw $e;
  18903. }
  18904. }
  18905. return $data;
  18906. }
  18907. protected function fetchFileIfLastModified($filename, $cacheKey, $lastModifiedTime)
  18908. {
  18909. $retries = 3;
  18910. while ($retries--) {
  18911. try {
  18912. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  18913. if ($this->eventDispatcher) {
  18914. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  18915. }
  18916. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  18917. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  18918. $options = array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime)));
  18919. $json = $rfs->getContents($hostname, $filename, false, $options);
  18920. if ($json === '' && $rfs->findStatusCode($rfs->getLastHeaders()) === 304) {
  18921. return true;
  18922. }
  18923. $data = JsonFile::parseJson($json, $filename);
  18924. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  18925. if ($lastModifiedDate) {
  18926. $data['last-modified'] = $lastModifiedDate;
  18927. $json = json_encode($data);
  18928. }
  18929. $this->cache->write($cacheKey, $json);
  18930. return $data;
  18931. } catch (\Exception $e) {
  18932. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  18933. throw $e;
  18934. }
  18935. if ($retries) {
  18936. usleep(100000);
  18937. continue;
  18938. }
  18939. if (!$this->degradedMode) {
  18940. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  18941. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  18942. }
  18943. $this->degradedMode = true;
  18944. return true;
  18945. }
  18946. }
  18947. }
  18948. }
  18949. <?php
  18950. namespace Composer\Repository;
  18951. use Composer\Package\PackageInterface;
  18952. class CompositeRepository extends BaseRepository
  18953. {
  18954. private $repositories;
  18955. public function __construct(array $repositories)
  18956. {
  18957. $this->repositories = array();
  18958. foreach ($repositories as $repo) {
  18959. $this->addRepository($repo);
  18960. }
  18961. }
  18962. public function getRepositories()
  18963. {
  18964. return $this->repositories;
  18965. }
  18966. public function hasPackage(PackageInterface $package)
  18967. {
  18968. foreach ($this->repositories as $repository) {
  18969. if ($repository->hasPackage($package)) {
  18970. return true;
  18971. }
  18972. }
  18973. return false;
  18974. }
  18975. public function findPackage($name, $constraint)
  18976. {
  18977. foreach ($this->repositories as $repository) {
  18978. $package = $repository->findPackage($name, $constraint);
  18979. if (null !== $package) {
  18980. return $package;
  18981. }
  18982. }
  18983. return null;
  18984. }
  18985. public function findPackages($name, $constraint = null)
  18986. {
  18987. $packages = array();
  18988. foreach ($this->repositories as $repository) {
  18989. $packages[] = $repository->findPackages($name, $constraint);
  18990. }
  18991. return $packages ? call_user_func_array('array_merge', $packages) : array();
  18992. }
  18993. public function search($query, $mode = 0, $type = null)
  18994. {
  18995. $matches = array();
  18996. foreach ($this->repositories as $repository) {
  18997. $matches[] = $repository->search($query, $mode, $type);
  18998. }
  18999. return $matches ? call_user_func_array('array_merge', $matches) : array();
  19000. }
  19001. public function getPackages()
  19002. {
  19003. $packages = array();
  19004. foreach ($this->repositories as $repository) {
  19005. $packages[] = $repository->getPackages();
  19006. }
  19007. return $packages ? call_user_func_array('array_merge', $packages) : array();
  19008. }
  19009. public function removePackage(PackageInterface $package)
  19010. {
  19011. foreach ($this->repositories as $repository) {
  19012. $repository->removePackage($package);
  19013. }
  19014. }
  19015. public function count()
  19016. {
  19017. $total = 0;
  19018. foreach ($this->repositories as $repository) {
  19019. $total += $repository->count();
  19020. }
  19021. return $total;
  19022. }
  19023. public function addRepository(RepositoryInterface $repository)
  19024. {
  19025. if ($repository instanceof self) {
  19026. foreach ($repository->getRepositories() as $repo) {
  19027. $this->addRepository($repo);
  19028. }
  19029. } else {
  19030. $this->repositories[] = $repository;
  19031. }
  19032. }
  19033. }
  19034. <?php
  19035. namespace Composer\Repository;
  19036. interface ConfigurableRepositoryInterface
  19037. {
  19038. public function getRepoConfig();
  19039. }
  19040. <?php
  19041. namespace Composer\Repository;
  19042. use Composer\Json\JsonFile;
  19043. use Composer\Package\Loader\ArrayLoader;
  19044. use Composer\Package\Dumper\ArrayDumper;
  19045. class FilesystemRepository extends WritableArrayRepository
  19046. {
  19047. private $file;
  19048. public function __construct(JsonFile $repositoryFile)
  19049. {
  19050. parent::__construct();
  19051. $this->file = $repositoryFile;
  19052. }
  19053. protected function initialize()
  19054. {
  19055. parent::initialize();
  19056. if (!$this->file->exists()) {
  19057. return;
  19058. }
  19059. try {
  19060. $packages = $this->file->read();
  19061. if (!is_array($packages)) {
  19062. throw new \UnexpectedValueException('Could not parse package list from the repository');
  19063. }
  19064. } catch (\Exception $e) {
  19065. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  19066. }
  19067. $loader = new ArrayLoader(null, true);
  19068. foreach ($packages as $packageData) {
  19069. $package = $loader->load($packageData);
  19070. $this->addPackage($package);
  19071. }
  19072. }
  19073. public function reload()
  19074. {
  19075. $this->packages = null;
  19076. $this->initialize();
  19077. }
  19078. public function write()
  19079. {
  19080. $data = array();
  19081. $dumper = new ArrayDumper();
  19082. foreach ($this->getCanonicalPackages() as $package) {
  19083. $data[] = $dumper->dump($package);
  19084. }
  19085. $this->file->write($data);
  19086. }
  19087. }
  19088. <?php
  19089. namespace Composer\Repository;
  19090. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  19091. {
  19092. }
  19093. <?php
  19094. namespace Composer\Repository;
  19095. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  19096. {
  19097. }
  19098. <?php
  19099. namespace Composer\Repository;
  19100. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  19101. {
  19102. }
  19103. <?php
  19104. namespace Composer\Repository;
  19105. class InvalidRepositoryException extends \Exception
  19106. {
  19107. }
  19108. <?php
  19109. namespace Composer\Repository;
  19110. use Composer\Package\Loader\ArrayLoader;
  19111. use Composer\Package\Loader\ValidatingArrayLoader;
  19112. class PackageRepository extends ArrayRepository
  19113. {
  19114. private $config;
  19115. public function __construct(array $config)
  19116. {
  19117. parent::__construct();
  19118. $this->config = $config['package'];
  19119. if (!is_numeric(key($this->config))) {
  19120. $this->config = array($this->config);
  19121. }
  19122. }
  19123. protected function initialize()
  19124. {
  19125. parent::initialize();
  19126. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), false);
  19127. foreach ($this->config as $package) {
  19128. try {
  19129. $package = $loader->load($package);
  19130. } catch (\Exception $e) {
  19131. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  19132. }
  19133. $this->addPackage($package);
  19134. }
  19135. }
  19136. }
  19137. <?php
  19138. namespace Composer\Repository;
  19139. use Composer\Config;
  19140. use Composer\IO\IOInterface;
  19141. use Composer\Json\JsonFile;
  19142. use Composer\Package\Loader\ArrayLoader;
  19143. use Composer\Package\Version\VersionGuesser;
  19144. use Composer\Package\Version\VersionParser;
  19145. use Composer\Util\Platform;
  19146. use Composer\Util\ProcessExecutor;
  19147. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  19148. {
  19149. private $loader;
  19150. private $versionGuesser;
  19151. private $url;
  19152. private $repoConfig;
  19153. private $process;
  19154. private $options;
  19155. public function __construct(array $repoConfig, IOInterface $io, Config $config)
  19156. {
  19157. if (!isset($repoConfig['url'])) {
  19158. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  19159. }
  19160. $this->loader = new ArrayLoader(null, true);
  19161. $this->url = Platform::expandPath($repoConfig['url']);
  19162. $this->process = new ProcessExecutor($io);
  19163. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  19164. $this->repoConfig = $repoConfig;
  19165. $this->options = isset($repoConfig['options']) ? $repoConfig['options'] : array();
  19166. parent::__construct();
  19167. }
  19168. public function getRepoConfig()
  19169. {
  19170. return $this->repoConfig;
  19171. }
  19172. protected function initialize()
  19173. {
  19174. parent::initialize();
  19175. foreach ($this->getUrlMatches() as $url) {
  19176. $path = realpath($url) . DIRECTORY_SEPARATOR;
  19177. $composerFilePath = $path.'composer.json';
  19178. if (!file_exists($composerFilePath)) {
  19179. continue;
  19180. }
  19181. $json = file_get_contents($composerFilePath);
  19182. $package = JsonFile::parseJson($json, $composerFilePath);
  19183. $package['dist'] = array(
  19184. 'type' => 'path',
  19185. 'url' => $url,
  19186. 'reference' => sha1($json . serialize($this->options)),
  19187. );
  19188. $package['transport-options'] = $this->options;
  19189. if (!isset($package['version'])) {
  19190. $versionData = $this->versionGuesser->guessVersion($package, $path);
  19191. $package['version'] = $versionData['version'] ?: 'dev-master';
  19192. }
  19193. $output = '';
  19194. if (is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H', $output, $path)) {
  19195. $package['dist']['reference'] = trim($output);
  19196. }
  19197. $package = $this->loader->load($package);
  19198. $this->addPackage($package);
  19199. }
  19200. }
  19201. private function getUrlMatches()
  19202. {
  19203. return array_map(function ($val) {
  19204. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  19205. }, glob($this->url, GLOB_MARK | GLOB_ONLYDIR));
  19206. }
  19207. }
  19208. <?php
  19209. namespace Composer\Repository\Pear;
  19210. use Composer\Util\RemoteFilesystem;
  19211. abstract class BaseChannelReader
  19212. {
  19213. const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
  19214. const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
  19215. const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
  19216. const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
  19217. const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
  19218. const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
  19219. private $rfs;
  19220. protected function __construct(RemoteFilesystem $rfs)
  19221. {
  19222. $this->rfs = $rfs;
  19223. }
  19224. protected function requestContent($origin, $path)
  19225. {
  19226. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  19227. $content = $this->rfs->getContents($origin, $url, false);
  19228. if (!$content) {
  19229. throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
  19230. }
  19231. return str_replace('http://pear.php.net/rest/', 'https://pear.php.net/rest/', $content);
  19232. }
  19233. protected function requestXml($origin, $path)
  19234. {
  19235. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
  19236. if (false === $xml) {
  19237. throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
  19238. }
  19239. return $xml;
  19240. }
  19241. }
  19242. <?php
  19243. namespace Composer\Repository\Pear;
  19244. class ChannelInfo
  19245. {
  19246. private $name;
  19247. private $alias;
  19248. private $packages;
  19249. public function __construct($name, $alias, array $packages)
  19250. {
  19251. $this->name = $name;
  19252. $this->alias = $alias;
  19253. $this->packages = $packages;
  19254. }
  19255. public function getName()
  19256. {
  19257. return $this->name;
  19258. }
  19259. public function getAlias()
  19260. {
  19261. return $this->alias;
  19262. }
  19263. public function getPackages()
  19264. {
  19265. return $this->packages;
  19266. }
  19267. }
  19268. <?php
  19269. namespace Composer\Repository\Pear;
  19270. use Composer\Util\RemoteFilesystem;
  19271. class ChannelReader extends BaseChannelReader
  19272. {
  19273. private $readerMap;
  19274. public function __construct(RemoteFilesystem $rfs)
  19275. {
  19276. parent::__construct($rfs);
  19277. $rest10reader = new ChannelRest10Reader($rfs);
  19278. $rest11reader = new ChannelRest11Reader($rfs);
  19279. $this->readerMap = array(
  19280. 'REST1.3' => $rest11reader,
  19281. 'REST1.2' => $rest11reader,
  19282. 'REST1.1' => $rest11reader,
  19283. 'REST1.0' => $rest10reader,
  19284. );
  19285. }
  19286. public function read($url)
  19287. {
  19288. $xml = $this->requestXml($url, "/channel.xml");
  19289. $channelName = (string) $xml->name;
  19290. $channelAlias = (string) $xml->suggestedalias;
  19291. $supportedVersions = array_keys($this->readerMap);
  19292. $selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
  19293. if (!$selectedRestVersion) {
  19294. throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
  19295. }
  19296. $reader = $this->readerMap[$selectedRestVersion['version']];
  19297. $packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
  19298. return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
  19299. }
  19300. private function selectRestVersion($channelXml, $supportedVersions)
  19301. {
  19302. $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
  19303. foreach ($supportedVersions as $version) {
  19304. $xpathTest = "ns:servers/ns:*/ns:rest/ns:baseurl[@type='{$version}']";
  19305. $testResult = $channelXml->xpath($xpathTest);
  19306. foreach ($testResult as $result) {
  19307. $result = (string) $result;
  19308. if (preg_match('{^https://}i', $result)) {
  19309. return array('version' => $version, 'baseUrl' => $result);
  19310. }
  19311. }
  19312. if (count($testResult) > 0) {
  19313. return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
  19314. }
  19315. }
  19316. return null;
  19317. }
  19318. }
  19319. <?php
  19320. namespace Composer\Repository\Pear;
  19321. use Composer\Downloader\TransportException;
  19322. class ChannelRest10Reader extends BaseChannelReader
  19323. {
  19324. private $dependencyReader;
  19325. public function __construct($rfs)
  19326. {
  19327. parent::__construct($rfs);
  19328. $this->dependencyReader = new PackageDependencyParser();
  19329. }
  19330. public function read($baseUrl)
  19331. {
  19332. return $this->readPackages($baseUrl);
  19333. }
  19334. private function readPackages($baseUrl)
  19335. {
  19336. $result = array();
  19337. $xmlPath = '/p/packages.xml';
  19338. $xml = $this->requestXml($baseUrl, $xmlPath);
  19339. $xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
  19340. foreach ($xml->xpath('ns:p') as $node) {
  19341. $packageName = (string) $node;
  19342. $packageInfo = $this->readPackage($baseUrl, $packageName);
  19343. $result[] = $packageInfo;
  19344. }
  19345. return $result;
  19346. }
  19347. private function readPackage($baseUrl, $packageName)
  19348. {
  19349. $xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
  19350. $xml = $this->requestXml($baseUrl, $xmlPath);
  19351. $xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
  19352. $channelName = (string) $xml->c;
  19353. $packageName = (string) $xml->n;
  19354. $license = (string) $xml->l;
  19355. $shortDescription = (string) $xml->s;
  19356. $description = (string) $xml->d;
  19357. return new PackageInfo(
  19358. $channelName,
  19359. $packageName,
  19360. $license,
  19361. $shortDescription,
  19362. $description,
  19363. $this->readPackageReleases($baseUrl, $packageName)
  19364. );
  19365. }
  19366. private function readPackageReleases($baseUrl, $packageName)
  19367. {
  19368. $result = array();
  19369. try {
  19370. $xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
  19371. $xml = $this->requestXml($baseUrl, $xmlPath);
  19372. $xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
  19373. foreach ($xml->xpath('ns:r') as $node) {
  19374. $releaseVersion = (string) $node->v;
  19375. $releaseStability = (string) $node->s;
  19376. try {
  19377. $result[$releaseVersion] = new ReleaseInfo(
  19378. $releaseStability,
  19379. $this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
  19380. );
  19381. } catch (TransportException $exception) {
  19382. if ($exception->getCode() != 404) {
  19383. throw $exception;
  19384. }
  19385. }
  19386. }
  19387. } catch (TransportException $exception) {
  19388. if ($exception->getCode() != 404) {
  19389. throw $exception;
  19390. }
  19391. }
  19392. return $result;
  19393. }
  19394. private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
  19395. {
  19396. $dependencyReader = new PackageDependencyParser();
  19397. $depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
  19398. $content = $this->requestContent($baseUrl, $depthPath);
  19399. $dependencyArray = unserialize($content);
  19400. $result = $dependencyReader->buildDependencyInfo($dependencyArray);
  19401. return $result;
  19402. }
  19403. }
  19404. <?php
  19405. namespace Composer\Repository\Pear;
  19406. class ChannelRest11Reader extends BaseChannelReader
  19407. {
  19408. private $dependencyReader;
  19409. public function __construct($rfs)
  19410. {
  19411. parent::__construct($rfs);
  19412. $this->dependencyReader = new PackageDependencyParser();
  19413. }
  19414. public function read($baseUrl)
  19415. {
  19416. return $this->readChannelPackages($baseUrl);
  19417. }
  19418. private function readChannelPackages($baseUrl)
  19419. {
  19420. $result = array();
  19421. $xml = $this->requestXml($baseUrl, "/c/categories.xml");
  19422. $xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
  19423. foreach ($xml->xpath('ns:c') as $node) {
  19424. $categoryName = (string) $node;
  19425. $categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
  19426. $result = array_merge($result, $categoryPackages);
  19427. }
  19428. return $result;
  19429. }
  19430. private function readCategoryPackages($baseUrl, $categoryName)
  19431. {
  19432. $result = array();
  19433. $categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
  19434. $xml = $this->requestXml($baseUrl, $categoryPath);
  19435. $xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  19436. foreach ($xml->xpath('ns:pi') as $node) {
  19437. $packageInfo = $this->parsePackage($node);
  19438. $result[] = $packageInfo;
  19439. }
  19440. return $result;
  19441. }
  19442. private function parsePackage($packageInfo)
  19443. {
  19444. $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  19445. $channelName = (string) $packageInfo->p->c;
  19446. $packageName = (string) $packageInfo->p->n;
  19447. $license = (string) $packageInfo->p->l;
  19448. $shortDescription = (string) $packageInfo->p->s;
  19449. $description = (string) $packageInfo->p->d;
  19450. $dependencies = array();
  19451. foreach ($packageInfo->xpath('ns:deps') as $node) {
  19452. $dependencyVersion = (string) $node->v;
  19453. $dependencyArray = unserialize((string) $node->d);
  19454. $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
  19455. $dependencies[$dependencyVersion] = $dependencyInfo;
  19456. }
  19457. $releases = array();
  19458. $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
  19459. if ($releasesInfo) {
  19460. foreach ($releasesInfo as $node) {
  19461. $releaseVersion = (string) $node->v;
  19462. $releaseStability = (string) $node->s;
  19463. $releases[$releaseVersion] = new ReleaseInfo(
  19464. $releaseStability,
  19465. isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
  19466. );
  19467. }
  19468. }
  19469. return new PackageInfo(
  19470. $channelName,
  19471. $packageName,
  19472. $license,
  19473. $shortDescription,
  19474. $description,
  19475. $releases
  19476. );
  19477. }
  19478. }
  19479. <?php
  19480. namespace Composer\Repository\Pear;
  19481. class DependencyConstraint
  19482. {
  19483. private $type;
  19484. private $constraint;
  19485. private $channelName;
  19486. private $packageName;
  19487. public function __construct($type, $constraint, $channelName, $packageName)
  19488. {
  19489. $this->type = $type;
  19490. $this->constraint = $constraint;
  19491. $this->channelName = $channelName;
  19492. $this->packageName = $packageName;
  19493. }
  19494. public function getChannelName()
  19495. {
  19496. return $this->channelName;
  19497. }
  19498. public function getConstraint()
  19499. {
  19500. return $this->constraint;
  19501. }
  19502. public function getPackageName()
  19503. {
  19504. return $this->packageName;
  19505. }
  19506. public function getType()
  19507. {
  19508. return $this->type;
  19509. }
  19510. }
  19511. <?php
  19512. namespace Composer\Repository\Pear;
  19513. class DependencyInfo
  19514. {
  19515. private $requires;
  19516. private $optionals;
  19517. public function __construct($requires, $optionals)
  19518. {
  19519. $this->requires = $requires;
  19520. $this->optionals = $optionals;
  19521. }
  19522. public function getRequires()
  19523. {
  19524. return $this->requires;
  19525. }
  19526. public function getOptionals()
  19527. {
  19528. return $this->optionals;
  19529. }
  19530. }
  19531. <?php
  19532. namespace Composer\Repository\Pear;
  19533. class PackageDependencyParser
  19534. {
  19535. public function buildDependencyInfo($depArray)
  19536. {
  19537. if (!is_array($depArray)) {
  19538. return new DependencyInfo(array(), array());
  19539. }
  19540. if (!$this->isHash($depArray)) {
  19541. return new DependencyInfo($this->buildDependency10Info($depArray), array());
  19542. }
  19543. return $this->buildDependency20Info($depArray);
  19544. }
  19545. private function buildDependency10Info($depArray)
  19546. {
  19547. static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
  19548. $result = array();
  19549. foreach ($depArray as $depItem) {
  19550. if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
  19551. continue;
  19552. }
  19553. $depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
  19554. ? 'optional'
  19555. : 'required';
  19556. $depType = 'not' == $depItem['rel']
  19557. ? 'conflicts'
  19558. : $depType;
  19559. $depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
  19560. $depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
  19561. ? '*'
  19562. : $dep10toOperatorMap[$depItem['rel']] . $depVersion;
  19563. switch ($depItem['type']) {
  19564. case 'php':
  19565. $depChannelName = 'php';
  19566. $depPackageName = '';
  19567. break;
  19568. case 'pkg':
  19569. $depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
  19570. $depPackageName = $depItem['name'];
  19571. break;
  19572. case 'ext':
  19573. $depChannelName = 'ext';
  19574. $depPackageName = $depItem['name'];
  19575. break;
  19576. case 'os':
  19577. case 'sapi':
  19578. $depChannelName = '';
  19579. $depPackageName = '';
  19580. break;
  19581. default:
  19582. $depChannelName = '';
  19583. $depPackageName = '';
  19584. break;
  19585. }
  19586. if ('' != $depChannelName) {
  19587. $result[] = new DependencyConstraint(
  19588. $depType,
  19589. $depVersionConstraint,
  19590. $depChannelName,
  19591. $depPackageName
  19592. );
  19593. }
  19594. }
  19595. return $result;
  19596. }
  19597. private function buildDependency20Info($depArray)
  19598. {
  19599. $result = array();
  19600. $optionals = array();
  19601. $defaultOptionals = array();
  19602. foreach ($depArray as $depType => $depTypeGroup) {
  19603. if (!is_array($depTypeGroup)) {
  19604. continue;
  19605. }
  19606. if ('required' == $depType || 'optional' == $depType) {
  19607. foreach ($depTypeGroup as $depItemType => $depItem) {
  19608. switch ($depItemType) {
  19609. case 'php':
  19610. $result[] = new DependencyConstraint(
  19611. $depType,
  19612. $this->parse20VersionConstraint($depItem),
  19613. 'php',
  19614. ''
  19615. );
  19616. break;
  19617. case 'package':
  19618. $deps = $this->buildDepPackageConstraints($depItem, $depType);
  19619. $result = array_merge($result, $deps);
  19620. break;
  19621. case 'extension':
  19622. $deps = $this->buildDepExtensionConstraints($depItem, $depType);
  19623. $result = array_merge($result, $deps);
  19624. break;
  19625. case 'subpackage':
  19626. $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
  19627. $defaultOptionals += $deps;
  19628. break;
  19629. case 'os':
  19630. case 'pearinstaller':
  19631. break;
  19632. default:
  19633. break;
  19634. }
  19635. }
  19636. } elseif ('group' == $depType) {
  19637. if ($this->isHash($depTypeGroup)) {
  19638. $depTypeGroup = array($depTypeGroup);
  19639. }
  19640. foreach ($depTypeGroup as $depItem) {
  19641. $groupName = $depItem['attribs']['name'];
  19642. if (!isset($optionals[$groupName])) {
  19643. $optionals[$groupName] = array();
  19644. }
  19645. if (isset($depItem['subpackage'])) {
  19646. $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
  19647. } else {
  19648. $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
  19649. }
  19650. }
  19651. }
  19652. }
  19653. if (count($defaultOptionals) > 0) {
  19654. $optionals['*'] = $defaultOptionals;
  19655. }
  19656. return new DependencyInfo($result, $optionals);
  19657. }
  19658. private function buildDepExtensionConstraints($depItem, $depType)
  19659. {
  19660. if ($this->isHash($depItem)) {
  19661. $depItem = array($depItem);
  19662. }
  19663. $result = array();
  19664. foreach ($depItem as $subDepItem) {
  19665. $depChannelName = 'ext';
  19666. $depPackageName = $subDepItem['name'];
  19667. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  19668. $result[] = new DependencyConstraint(
  19669. $depType,
  19670. $depVersionConstraint,
  19671. $depChannelName,
  19672. $depPackageName
  19673. );
  19674. }
  19675. return $result;
  19676. }
  19677. private function buildDepPackageConstraints($depItem, $depType)
  19678. {
  19679. if ($this->isHash($depItem)) {
  19680. $depItem = array($depItem);
  19681. }
  19682. $result = array();
  19683. foreach ($depItem as $subDepItem) {
  19684. $depChannelName = $subDepItem['channel'];
  19685. $depPackageName = $subDepItem['name'];
  19686. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  19687. if (isset($subDepItem['conflicts'])) {
  19688. $depType = 'conflicts';
  19689. }
  19690. $result[] = new DependencyConstraint(
  19691. $depType,
  19692. $depVersionConstraint,
  19693. $depChannelName,
  19694. $depPackageName
  19695. );
  19696. }
  19697. return $result;
  19698. }
  19699. private function parse20VersionConstraint(array $data)
  19700. {
  19701. static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
  19702. $versions = array();
  19703. $values = array_intersect_key($data, $dep20toOperatorMap);
  19704. if (0 == count($values)) {
  19705. return '*';
  19706. }
  19707. if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
  19708. $versions[] = '>' . $this->parseVersion($values['min']);
  19709. } elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
  19710. $versions[] = '<' . $this->parseVersion($values['max']);
  19711. } else {
  19712. foreach ($values as $op => $version) {
  19713. if ('exclude' == $op && is_array($version)) {
  19714. foreach ($version as $versionPart) {
  19715. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
  19716. }
  19717. } else {
  19718. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
  19719. }
  19720. }
  19721. }
  19722. return implode(',', $versions);
  19723. }
  19724. private function parseVersion($version)
  19725. {
  19726. if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
  19727. $version = $matches[1]
  19728. .(!empty($matches[2]) ? $matches[2] : '.0')
  19729. .(!empty($matches[3]) ? $matches[3] : '.0')
  19730. .(!empty($matches[4]) ? $matches[4] : '.0');
  19731. return $version;
  19732. }
  19733. return null;
  19734. }
  19735. private function isHash(array $array)
  19736. {
  19737. return !array_key_exists(1, $array) && !array_key_exists(0, $array);
  19738. }
  19739. }
  19740. <?php
  19741. namespace Composer\Repository\Pear;
  19742. class PackageInfo
  19743. {
  19744. private $channelName;
  19745. private $packageName;
  19746. private $license;
  19747. private $shortDescription;
  19748. private $description;
  19749. private $releases;
  19750. public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
  19751. {
  19752. $this->channelName = $channelName;
  19753. $this->packageName = $packageName;
  19754. $this->license = $license;
  19755. $this->shortDescription = $shortDescription;
  19756. $this->description = $description;
  19757. $this->releases = $releases;
  19758. }
  19759. public function getChannelName()
  19760. {
  19761. return $this->channelName;
  19762. }
  19763. public function getPackageName()
  19764. {
  19765. return $this->packageName;
  19766. }
  19767. public function getDescription()
  19768. {
  19769. return $this->description;
  19770. }
  19771. public function getShortDescription()
  19772. {
  19773. return $this->shortDescription;
  19774. }
  19775. public function getLicense()
  19776. {
  19777. return $this->license;
  19778. }
  19779. public function getReleases()
  19780. {
  19781. return $this->releases;
  19782. }
  19783. }
  19784. <?php
  19785. namespace Composer\Repository\Pear;
  19786. class ReleaseInfo
  19787. {
  19788. private $stability;
  19789. private $dependencyInfo;
  19790. public function __construct($stability, $dependencyInfo)
  19791. {
  19792. $this->stability = $stability;
  19793. $this->dependencyInfo = $dependencyInfo;
  19794. }
  19795. public function getDependencyInfo()
  19796. {
  19797. return $this->dependencyInfo;
  19798. }
  19799. public function getStability()
  19800. {
  19801. return $this->stability;
  19802. }
  19803. }
  19804. <?php
  19805. namespace Composer\Repository;
  19806. use Composer\IO\IOInterface;
  19807. use Composer\Semver\VersionParser as SemverVersionParser;
  19808. use Composer\Package\Version\VersionParser;
  19809. use Composer\Repository\Pear\ChannelReader;
  19810. use Composer\Package\CompletePackage;
  19811. use Composer\Repository\Pear\ChannelInfo;
  19812. use Composer\EventDispatcher\EventDispatcher;
  19813. use Composer\Package\Link;
  19814. use Composer\Semver\Constraint\Constraint;
  19815. use Composer\Util\RemoteFilesystem;
  19816. use Composer\Config;
  19817. use Composer\Factory;
  19818. class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  19819. {
  19820. private $url;
  19821. private $io;
  19822. private $rfs;
  19823. private $versionParser;
  19824. private $repoConfig;
  19825. private $vendorAlias;
  19826. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
  19827. {
  19828. parent::__construct();
  19829. if (!preg_match('{^https?://}', $repoConfig['url'])) {
  19830. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  19831. }
  19832. $urlBits = parse_url($repoConfig['url']);
  19833. if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
  19834. throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
  19835. }
  19836. $this->url = rtrim($repoConfig['url'], '/');
  19837. $this->io = $io;
  19838. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  19839. $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
  19840. $this->versionParser = new VersionParser();
  19841. $this->repoConfig = $repoConfig;
  19842. }
  19843. public function getRepoConfig()
  19844. {
  19845. return $this->repoConfig;
  19846. }
  19847. protected function initialize()
  19848. {
  19849. parent::initialize();
  19850. $this->io->writeError('Initializing PEAR repository '.$this->url);
  19851. $reader = new ChannelReader($this->rfs);
  19852. try {
  19853. $channelInfo = $reader->read($this->url);
  19854. } catch (\Exception $e) {
  19855. $this->io->writeError('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
  19856. return;
  19857. }
  19858. $packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
  19859. foreach ($packages as $package) {
  19860. $this->addPackage($package);
  19861. }
  19862. }
  19863. private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser)
  19864. {
  19865. $result = array();
  19866. foreach ($channelInfo->getPackages() as $packageDefinition) {
  19867. foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
  19868. try {
  19869. $normalizedVersion = $versionParser->normalize($version);
  19870. } catch (\UnexpectedValueException $e) {
  19871. $this->io->writeError('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage(), true, IOInterface::VERBOSE);
  19872. continue;
  19873. }
  19874. $composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
  19875. $urlBits = parse_url($this->url);
  19876. $scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
  19877. $distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
  19878. $requires = array();
  19879. $suggests = array();
  19880. $conflicts = array();
  19881. $replaces = array();
  19882. if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
  19883. $composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
  19884. $aliasConstraint = new Constraint('==', $normalizedVersion);
  19885. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  19886. }
  19887. if (!empty($this->vendorAlias)
  19888. && ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
  19889. ) {
  19890. $composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
  19891. $aliasConstraint = new Constraint('==', $normalizedVersion);
  19892. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  19893. }
  19894. foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
  19895. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  19896. $constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
  19897. $link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
  19898. switch ($dependencyConstraint->getType()) {
  19899. case 'required':
  19900. $requires[] = $link;
  19901. break;
  19902. case 'conflicts':
  19903. $conflicts[] = $link;
  19904. break;
  19905. case 'replaces':
  19906. $replaces[] = $link;
  19907. break;
  19908. }
  19909. }
  19910. foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
  19911. foreach ($dependencyConstraints as $dependencyConstraint) {
  19912. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  19913. $suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
  19914. }
  19915. }
  19916. $package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
  19917. $package->setType('pear-library');
  19918. $package->setDescription($packageDefinition->getDescription());
  19919. $package->setLicense(array($packageDefinition->getLicense()));
  19920. $package->setDistType('file');
  19921. $package->setDistUrl($distUrl);
  19922. $package->setAutoload(array('classmap' => array('')));
  19923. $package->setIncludePaths(array('/'));
  19924. $package->setRequires($requires);
  19925. $package->setConflicts($conflicts);
  19926. $package->setSuggests($suggests);
  19927. $package->setReplaces($replaces);
  19928. $result[] = $package;
  19929. }
  19930. }
  19931. return $result;
  19932. }
  19933. private function buildComposerPackageName($channelName, $packageName)
  19934. {
  19935. if ('php' === $channelName) {
  19936. return "php";
  19937. }
  19938. if ('ext' === $channelName) {
  19939. return "ext-{$packageName}";
  19940. }
  19941. return "pear-{$channelName}/{$packageName}";
  19942. }
  19943. }
  19944. <?php
  19945. namespace Composer\Repository;
  19946. use Composer\Package\CompletePackage;
  19947. use Composer\Package\PackageInterface;
  19948. use Composer\Package\Version\VersionParser;
  19949. use Composer\Plugin\PluginInterface;
  19950. use Composer\Util\Silencer;
  19951. class PlatformRepository extends ArrayRepository
  19952. {
  19953. const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit)?|hhvm|(?:ext|lib)-[^/]+)$}i';
  19954. private $overrides = array();
  19955. public function __construct(array $packages = array(), array $overrides = array())
  19956. {
  19957. foreach ($overrides as $name => $version) {
  19958. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  19959. }
  19960. parent::__construct($packages);
  19961. }
  19962. protected function initialize()
  19963. {
  19964. parent::initialize();
  19965. $versionParser = new VersionParser();
  19966. foreach ($this->overrides as $override) {
  19967. if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
  19968. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  19969. }
  19970. $version = $versionParser->normalize($override['version']);
  19971. $package = new CompletePackage($override['name'], $version, $override['version']);
  19972. $package->setDescription('Package overridden via config.platform');
  19973. $package->setExtra(array('config.platform' => true));
  19974. parent::addPackage($package);
  19975. }
  19976. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  19977. $version = $versionParser->normalize($prettyVersion);
  19978. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  19979. $composerPluginApi->setDescription('The Composer Plugin API');
  19980. $this->addPackage($composerPluginApi);
  19981. try {
  19982. $prettyVersion = PHP_VERSION;
  19983. $version = $versionParser->normalize($prettyVersion);
  19984. } catch (\UnexpectedValueException $e) {
  19985. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
  19986. $version = $versionParser->normalize($prettyVersion);
  19987. }
  19988. $php = new CompletePackage('php', $version, $prettyVersion);
  19989. $php->setDescription('The PHP interpreter');
  19990. $this->addPackage($php);
  19991. if (PHP_INT_SIZE === 8) {
  19992. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  19993. $php64->setDescription('The PHP interpreter, 64bit');
  19994. $this->addPackage($php64);
  19995. }
  19996. if (defined('AF_INET6') || Silencer::call('inet_pton', '::') !== false) {
  19997. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  19998. $phpIpv6->setDescription('The PHP interpreter with IPv6 support');
  19999. $this->addPackage($phpIpv6);
  20000. }
  20001. $loadedExtensions = get_loaded_extensions();
  20002. foreach ($loadedExtensions as $name) {
  20003. if (in_array($name, array('standard', 'Core'))) {
  20004. continue;
  20005. }
  20006. $extraDescription = null;
  20007. $reflExt = new \ReflectionExtension($name);
  20008. try {
  20009. $prettyVersion = $reflExt->getVersion();
  20010. $version = $versionParser->normalize($prettyVersion);
  20011. } catch (\UnexpectedValueException $e) {
  20012. $extraDescription = ' (actual version: '.$prettyVersion.')';
  20013. if (preg_match('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  20014. $prettyVersion = $match[1];
  20015. } else {
  20016. $prettyVersion = '0';
  20017. }
  20018. $version = $versionParser->normalize($prettyVersion);
  20019. }
  20020. $packageName = $this->buildPackageName($name);
  20021. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  20022. $ext->setDescription('The '.$name.' PHP extension' . $extraDescription);
  20023. $this->addPackage($ext);
  20024. }
  20025. foreach ($loadedExtensions as $name) {
  20026. $prettyVersion = null;
  20027. $description = 'The '.$name.' PHP library';
  20028. switch ($name) {
  20029. case 'curl':
  20030. $curlVersion = curl_version();
  20031. $prettyVersion = $curlVersion['version'];
  20032. break;
  20033. case 'iconv':
  20034. $prettyVersion = ICONV_VERSION;
  20035. break;
  20036. case 'intl':
  20037. $name = 'ICU';
  20038. if (defined('INTL_ICU_VERSION')) {
  20039. $prettyVersion = INTL_ICU_VERSION;
  20040. } else {
  20041. $reflector = new \ReflectionExtension('intl');
  20042. ob_start();
  20043. $reflector->info();
  20044. $output = ob_get_clean();
  20045. preg_match('/^ICU version => (.*)$/m', $output, $matches);
  20046. $prettyVersion = $matches[1];
  20047. }
  20048. break;
  20049. case 'libxml':
  20050. $prettyVersion = LIBXML_DOTTED_VERSION;
  20051. break;
  20052. case 'openssl':
  20053. $prettyVersion = preg_replace_callback('{^(?:OpenSSL\s*)?([0-9.]+)([a-z]*).*}', function ($match) {
  20054. if (empty($match[2])) {
  20055. return $match[1];
  20056. }
  20057. if (!preg_match('{^z*[a-z]$}', $match[2])) {
  20058. return 0;
  20059. }
  20060. $len = strlen($match[2]);
  20061. $patchVersion = ($len - 1) * 26;
  20062. $patchVersion += ord($match[2][$len - 1]) - 96;
  20063. return $match[1].'.'.$patchVersion;
  20064. }, OPENSSL_VERSION_TEXT);
  20065. $description = OPENSSL_VERSION_TEXT;
  20066. break;
  20067. case 'pcre':
  20068. $prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
  20069. break;
  20070. case 'uuid':
  20071. $prettyVersion = phpversion('uuid');
  20072. break;
  20073. case 'xsl':
  20074. $prettyVersion = LIBXSLT_DOTTED_VERSION;
  20075. break;
  20076. default:
  20077. continue 2;
  20078. }
  20079. try {
  20080. $version = $versionParser->normalize($prettyVersion);
  20081. } catch (\UnexpectedValueException $e) {
  20082. continue;
  20083. }
  20084. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  20085. $lib->setDescription($description);
  20086. $this->addPackage($lib);
  20087. }
  20088. if (defined('HHVM_VERSION')) {
  20089. try {
  20090. $prettyVersion = HHVM_VERSION;
  20091. $version = $versionParser->normalize($prettyVersion);
  20092. } catch (\UnexpectedValueException $e) {
  20093. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', HHVM_VERSION);
  20094. $version = $versionParser->normalize($prettyVersion);
  20095. }
  20096. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  20097. $hhvm->setDescription('The HHVM Runtime (64bit)');
  20098. $this->addPackage($hhvm);
  20099. }
  20100. }
  20101. public function addPackage(PackageInterface $package)
  20102. {
  20103. if (isset($this->overrides[strtolower($package->getName())])) {
  20104. $overrider = $this->findPackage($package->getName(), '*');
  20105. $overrider->setDescription($overrider->getDescription().' (actual: '.$package->getPrettyVersion().')');
  20106. return;
  20107. }
  20108. parent::addPackage($package);
  20109. }
  20110. private function buildPackageName($name)
  20111. {
  20112. return 'ext-' . str_replace(' ', '-', $name);
  20113. }
  20114. }
  20115. <?php
  20116. namespace Composer\Repository;
  20117. use Composer\Factory;
  20118. use Composer\IO\IOInterface;
  20119. use Composer\Config;
  20120. use Composer\EventDispatcher\EventDispatcher;
  20121. use Composer\Util\RemoteFilesystem;
  20122. use Composer\Json\JsonFile;
  20123. class RepositoryFactory
  20124. {
  20125. public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  20126. {
  20127. if (0 === strpos($repository, 'http')) {
  20128. $repoConfig = array('type' => 'composer', 'url' => $repository);
  20129. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  20130. $json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config));
  20131. $data = $json->read();
  20132. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  20133. $repoConfig = array('type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/'));
  20134. } elseif ($allowFilesystem) {
  20135. $repoConfig = array('type' => 'filesystem', 'json' => $json);
  20136. } else {
  20137. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  20138. }
  20139. } elseif ('{' === substr($repository, 0, 1)) {
  20140. $repoConfig = JsonFile::parseJson($repository);
  20141. } else {
  20142. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  20143. }
  20144. return $repoConfig;
  20145. }
  20146. public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  20147. {
  20148. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  20149. return static::createRepo($io, $config, $repoConfig);
  20150. }
  20151. public static function createRepo(IOInterface $io, Config $config, array $repoConfig)
  20152. {
  20153. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  20154. $repos = static::createRepos($rm, array($repoConfig));
  20155. return reset($repos);
  20156. }
  20157. public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  20158. {
  20159. if (!$config) {
  20160. $config = Factory::createConfig($io);
  20161. }
  20162. if (!$rm) {
  20163. if (!$io) {
  20164. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  20165. }
  20166. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  20167. }
  20168. return static::createRepos($rm, $config->getRepositories());
  20169. }
  20170. public static function manager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  20171. {
  20172. $rm = new RepositoryManager($io, $config, $eventDispatcher, $rfs);
  20173. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  20174. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  20175. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  20176. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  20177. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  20178. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  20179. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  20180. $rm->setRepositoryClass('fossil', 'Composer\Repository\FossilRepository');
  20181. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  20182. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  20183. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  20184. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  20185. return $rm;
  20186. }
  20187. private static function createRepos(RepositoryManager $rm, array $repoConfigs)
  20188. {
  20189. $repos = array();
  20190. foreach ($repoConfigs as $index => $repo) {
  20191. if (is_string($repo)) {
  20192. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  20193. }
  20194. if (!is_array($repo)) {
  20195. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  20196. }
  20197. if (!isset($repo['type'])) {
  20198. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  20199. }
  20200. $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
  20201. while (isset($repos[$name])) {
  20202. $name .= '2';
  20203. }
  20204. if ($repo['type'] === 'filesystem') {
  20205. $repos[$name] = new FilesystemRepository($repo['json']);
  20206. } else {
  20207. $repos[$name] = $rm->createRepository($repo['type'], $repo, $index);
  20208. }
  20209. }
  20210. return $repos;
  20211. }
  20212. }
  20213. <?php
  20214. namespace Composer\Repository;
  20215. use Composer\Package\PackageInterface;
  20216. interface RepositoryInterface extends \Countable
  20217. {
  20218. const SEARCH_FULLTEXT = 0;
  20219. const SEARCH_NAME = 1;
  20220. public function hasPackage(PackageInterface $package);
  20221. public function findPackage($name, $constraint);
  20222. public function findPackages($name, $constraint = null);
  20223. public function getPackages();
  20224. public function search($query, $mode = 0);
  20225. }
  20226. <?php
  20227. namespace Composer\Repository;
  20228. use Composer\IO\IOInterface;
  20229. use Composer\Config;
  20230. use Composer\EventDispatcher\EventDispatcher;
  20231. use Composer\Package\PackageInterface;
  20232. use Composer\Util\RemoteFilesystem;
  20233. class RepositoryManager
  20234. {
  20235. private $localRepository;
  20236. private $repositories = array();
  20237. private $repositoryClasses = array();
  20238. private $io;
  20239. private $config;
  20240. private $eventDispatcher;
  20241. private $rfs;
  20242. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  20243. {
  20244. $this->io = $io;
  20245. $this->config = $config;
  20246. $this->eventDispatcher = $eventDispatcher;
  20247. $this->rfs = $rfs;
  20248. }
  20249. public function findPackage($name, $constraint)
  20250. {
  20251. foreach ($this->repositories as $repository) {
  20252. if ($package = $repository->findPackage($name, $constraint)) {
  20253. return $package;
  20254. }
  20255. }
  20256. return null;
  20257. }
  20258. public function findPackages($name, $constraint)
  20259. {
  20260. $packages = array();
  20261. foreach ($this->repositories as $repository) {
  20262. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  20263. }
  20264. return $packages;
  20265. }
  20266. public function addRepository(RepositoryInterface $repository)
  20267. {
  20268. $this->repositories[] = $repository;
  20269. }
  20270. public function prependRepository(RepositoryInterface $repository)
  20271. {
  20272. array_unshift($this->repositories, $repository);
  20273. }
  20274. public function createRepository($type, $config, $name = null)
  20275. {
  20276. if (!isset($this->repositoryClasses[$type])) {
  20277. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  20278. }
  20279. if (isset($config['packagist']) && false === $config['packagist']) {
  20280. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  20281. }
  20282. $class = $this->repositoryClasses[$type];
  20283. $reflMethod = new \ReflectionMethod($class, '__construct');
  20284. $params = $reflMethod->getParameters();
  20285. if (isset($params[4]) && $params[4]->getClass() && $params[4]->getClass()->getName() === 'Composer\Util\RemoteFilesystem') {
  20286. return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs);
  20287. }
  20288. return new $class($config, $this->io, $this->config, $this->eventDispatcher);
  20289. }
  20290. public function setRepositoryClass($type, $class)
  20291. {
  20292. $this->repositoryClasses[$type] = $class;
  20293. }
  20294. public function getRepositories()
  20295. {
  20296. return $this->repositories;
  20297. }
  20298. public function setLocalRepository(WritableRepositoryInterface $repository)
  20299. {
  20300. $this->localRepository = $repository;
  20301. }
  20302. public function getLocalRepository()
  20303. {
  20304. return $this->localRepository;
  20305. }
  20306. }
  20307. <?php
  20308. namespace Composer\Repository;
  20309. class RepositorySecurityException extends \Exception
  20310. {
  20311. }
  20312. <?php
  20313. namespace Composer\Repository\Vcs;
  20314. use Composer\Config;
  20315. use Composer\Json\JsonFile;
  20316. use Composer\Util\ProcessExecutor;
  20317. use Composer\Util\Filesystem;
  20318. use Composer\IO\IOInterface;
  20319. class FossilDriver extends VcsDriver
  20320. {
  20321. protected $tags;
  20322. protected $branches;
  20323. protected $rootIdentifier;
  20324. protected $repoFile;
  20325. protected $checkoutDir;
  20326. protected $infoCache = array();
  20327. public function initialize()
  20328. {
  20329. if (Filesystem::isLocalPath($this->url)) {
  20330. $this->checkoutDir = $this->url;
  20331. } else {
  20332. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '.fossil';
  20333. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  20334. $fs = new Filesystem();
  20335. $fs->ensureDirectoryExists($this->checkoutDir);
  20336. if (!is_writable(dirname($this->checkoutDir))) {
  20337. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  20338. }
  20339. $this->config->prohibitUrlByConfig($this->url, $this->io);
  20340. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  20341. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  20342. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  20343. }
  20344. } else {
  20345. $fs->removeDirectory($this->checkoutDir);
  20346. $fs->remove($this->repoFile);
  20347. $fs->ensureDirectoryExists($this->checkoutDir);
  20348. if (0 !== $this->process->execute(sprintf('fossil clone %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  20349. $output = $this->process->getErrorOutput();
  20350. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  20351. throw new \RuntimeException('Failed to clone '.$this->url.', fossil was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  20352. }
  20353. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  20354. }
  20355. if (0 !== $this->process->execute(sprintf('fossil open %s', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  20356. $output = $this->process->getErrorOutput();
  20357. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  20358. }
  20359. }
  20360. }
  20361. $this->getTags();
  20362. $this->getBranches();
  20363. }
  20364. public function getRootIdentifier()
  20365. {
  20366. if (null === $this->rootIdentifier) {
  20367. $this->rootIdentifier = 'trunk';
  20368. }
  20369. return $this->rootIdentifier;
  20370. }
  20371. public function getUrl()
  20372. {
  20373. return $this->url;
  20374. }
  20375. public function getSource($identifier)
  20376. {
  20377. return array('type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier);
  20378. }
  20379. public function getDist($identifier)
  20380. {
  20381. return null;
  20382. }
  20383. public function getComposerInformation($identifier)
  20384. {
  20385. if (!isset($this->infoCache[$identifier])) {
  20386. $command = sprintf('fossil cat -r %s composer.json', ProcessExecutor::escape($identifier));
  20387. $this->process->execute($command, $composer, $this->checkoutDir);
  20388. if (trim($composer) === '') {
  20389. return;
  20390. }
  20391. $composer = JsonFile::parseJson(trim($composer), $identifier);
  20392. if (empty($composer['time'])) {
  20393. $this->process->execute(sprintf('fossil finfo composer.json | head -n 2 | tail -n 1 | awk \'{print $1}\''), $output, $this->checkoutDir);
  20394. $date = new \DateTime(trim($output), new \DateTimeZone('UTC'));
  20395. $composer['time'] = $date->format('Y-m-d H:i:s');
  20396. }
  20397. $this->infoCache[$identifier] = $composer;
  20398. }
  20399. return $this->infoCache[$identifier];
  20400. }
  20401. public function getTags()
  20402. {
  20403. if (null === $this->tags) {
  20404. $tags = array();
  20405. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  20406. foreach ($this->process->splitLines($output) as $tag) {
  20407. $tags[$tag] = $tag;
  20408. }
  20409. $this->tags = $tags;
  20410. }
  20411. return $this->tags;
  20412. }
  20413. public function getBranches()
  20414. {
  20415. if (null === $this->branches) {
  20416. $branches = array();
  20417. $bookmarks = array();
  20418. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  20419. foreach ($this->process->splitLines($output) as $branch) {
  20420. $branch = trim(preg_replace('/^\*/', '', trim($branch)));
  20421. $branches[$branch] = $branch;
  20422. }
  20423. $this->branches = $branches;
  20424. }
  20425. return $this->branches;
  20426. }
  20427. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  20428. {
  20429. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  20430. return true;
  20431. }
  20432. if (preg_match('!/fossil/|\.fossil!', $url))
  20433. {
  20434. return true;
  20435. }
  20436. if (Filesystem::isLocalPath($url)) {
  20437. $url = Filesystem::getPlatformPath($url);
  20438. if (!is_dir($url)) {
  20439. return false;
  20440. }
  20441. $process = new ProcessExecutor();
  20442. if ($process->execute('fossil info', $output, $url) === 0) {
  20443. return true;
  20444. }
  20445. }
  20446. return false;
  20447. }
  20448. }
  20449. <?php
  20450. namespace Composer\Repository\Vcs;
  20451. use Composer\Cache;
  20452. use Composer\Config;
  20453. use Composer\Downloader\TransportException;
  20454. use Composer\Json\JsonFile;
  20455. use Composer\IO\IOInterface;
  20456. use Composer\Util\Bitbucket;
  20457. class GitBitbucketDriver extends VcsDriver implements VcsDriverInterface
  20458. {
  20459. protected $cache;
  20460. protected $owner;
  20461. protected $repository;
  20462. protected $tags;
  20463. protected $branches;
  20464. protected $rootIdentifier;
  20465. protected $infoCache = array();
  20466. private $hasIssues;
  20467. private $gitDriver;
  20468. public function initialize()
  20469. {
  20470. preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#', $this->url, $match);
  20471. $this->owner = $match[1];
  20472. $this->repository = $match[2];
  20473. $this->originUrl = 'bitbucket.org';
  20474. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  20475. }
  20476. public function getRootIdentifier()
  20477. {
  20478. if ($this->gitDriver) {
  20479. return $this->gitDriver->getRootIdentifier();
  20480. }
  20481. if (null === $this->rootIdentifier) {
  20482. $resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository;
  20483. $repoData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource, true), $resource);
  20484. $this->hasIssues = !empty($repoData['has_issues']);
  20485. $this->rootIdentifier = !empty($repoData['main_branch']) ? $repoData['main_branch'] : 'master';
  20486. }
  20487. return $this->rootIdentifier;
  20488. }
  20489. public function getUrl()
  20490. {
  20491. if ($this->gitDriver) {
  20492. return $this->gitDriver->getUrl();
  20493. }
  20494. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  20495. }
  20496. public function getSource($identifier)
  20497. {
  20498. if ($this->gitDriver) {
  20499. return $this->gitDriver->getSource($identifier);
  20500. }
  20501. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  20502. }
  20503. public function getDist($identifier)
  20504. {
  20505. $url = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$identifier.'.zip';
  20506. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  20507. }
  20508. public function getComposerInformation($identifier)
  20509. {
  20510. if ($this->gitDriver) {
  20511. return $this->gitDriver->getComposerInformation($identifier);
  20512. }
  20513. if (preg_match('{[a-f0-9]{40}}i', $identifier) && $res = $this->cache->read($identifier)) {
  20514. $this->infoCache[$identifier] = JsonFile::parseJson($res);
  20515. }
  20516. if (!isset($this->infoCache[$identifier])) {
  20517. $resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/src/'.$identifier.'/composer.json';
  20518. $file = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  20519. if (!is_array($file) || ! array_key_exists('data', $file)) {
  20520. return array();
  20521. }
  20522. $composer = JsonFile::parseJson($file['data'], $resource);
  20523. if (empty($composer['time'])) {
  20524. $resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/changesets/'.$identifier;
  20525. $changeset = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  20526. $composer['time'] = $changeset['timestamp'];
  20527. }
  20528. if (!isset($composer['support']['source'])) {
  20529. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  20530. if (array_key_exists($label, $tags = $this->getTags())) {
  20531. $hash = $tags[$label];
  20532. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  20533. $hash = $branches[$label];
  20534. }
  20535. if (! isset($hash)) {
  20536. $composer['support']['source'] = sprintf('https://%s/%s/%s/src', $this->originUrl, $this->owner, $this->repository);
  20537. } else {
  20538. $composer['support']['source'] = sprintf(
  20539. 'https://%s/%s/%s/src/%s/?at=%s',
  20540. $this->originUrl,
  20541. $this->owner,
  20542. $this->repository,
  20543. $hash,
  20544. $label
  20545. );
  20546. }
  20547. }
  20548. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  20549. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  20550. }
  20551. if (preg_match('{[a-f0-9]{40}}i', $identifier)) {
  20552. $this->cache->write($identifier, json_encode($composer));
  20553. }
  20554. $this->infoCache[$identifier] = $composer;
  20555. }
  20556. return $this->infoCache[$identifier];
  20557. }
  20558. public function getTags()
  20559. {
  20560. if ($this->gitDriver) {
  20561. return $this->gitDriver->getTags();
  20562. }
  20563. if (null === $this->tags) {
  20564. $resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags';
  20565. $tagsData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  20566. $this->tags = array();
  20567. foreach ($tagsData as $tag => $data) {
  20568. $this->tags[$tag] = $data['raw_node'];
  20569. }
  20570. }
  20571. return $this->tags;
  20572. }
  20573. public function getBranches()
  20574. {
  20575. if ($this->gitDriver) {
  20576. return $this->gitDriver->getBranches();
  20577. }
  20578. if (null === $this->branches) {
  20579. $resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/branches';
  20580. $branchData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  20581. $this->branches = array();
  20582. foreach ($branchData as $branch => $data) {
  20583. $this->branches[$branch] = $data['raw_node'];
  20584. }
  20585. }
  20586. return $this->branches;
  20587. }
  20588. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  20589. {
  20590. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#', $url)) {
  20591. return false;
  20592. }
  20593. if (!extension_loaded('openssl')) {
  20594. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  20595. return false;
  20596. }
  20597. return true;
  20598. }
  20599. protected function attemptCloneFallback()
  20600. {
  20601. try {
  20602. $this->setupGitDriver($this->generateSshUrl());
  20603. return;
  20604. } catch (\RuntimeException $e) {
  20605. $this->gitDriver = null;
  20606. $this->io->writeError('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your Bitbucket OAuth consumer credentials</error>');
  20607. throw $e;
  20608. }
  20609. }
  20610. private function generateSshUrl()
  20611. {
  20612. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  20613. }
  20614. protected function getContentsWithOAuthCredentials($url, $fetchingRepoData = false)
  20615. {
  20616. try {
  20617. return parent::getContents($url);
  20618. } catch (TransportException $e) {
  20619. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->remoteFilesystem);
  20620. switch ($e->getCode()) {
  20621. case 403:
  20622. if (!$this->io->hasAuthentication($this->originUrl) && $bitbucketUtil->authorizeOAuth($this->originUrl)) {
  20623. return parent::getContents($url);
  20624. }
  20625. if (!$this->io->isInteractive() && $fetchingRepoData) {
  20626. return $this->attemptCloneFallback();
  20627. }
  20628. throw $e;
  20629. default:
  20630. throw $e;
  20631. }
  20632. }
  20633. }
  20634. private function setupGitDriver($url)
  20635. {
  20636. $this->gitDriver = new GitDriver(
  20637. array('url' => $url),
  20638. $this->io,
  20639. $this->config,
  20640. $this->process,
  20641. $this->remoteFilesystem
  20642. );
  20643. $this->gitDriver->initialize();
  20644. }
  20645. }
  20646. <?php
  20647. namespace Composer\Repository\Vcs;
  20648. use Composer\Json\JsonFile;
  20649. use Composer\Util\ProcessExecutor;
  20650. use Composer\Util\Filesystem;
  20651. use Composer\Util\Git as GitUtil;
  20652. use Composer\IO\IOInterface;
  20653. use Composer\Cache;
  20654. use Composer\Config;
  20655. class GitDriver extends VcsDriver
  20656. {
  20657. protected $cache;
  20658. protected $tags;
  20659. protected $branches;
  20660. protected $rootIdentifier;
  20661. protected $repoDir;
  20662. protected $infoCache = array();
  20663. public function initialize()
  20664. {
  20665. if (Filesystem::isLocalPath($this->url)) {
  20666. $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
  20667. $this->repoDir = $this->url;
  20668. $cacheUrl = realpath($this->url);
  20669. } else {
  20670. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  20671. GitUtil::cleanEnv();
  20672. $fs = new Filesystem();
  20673. $fs->ensureDirectoryExists(dirname($this->repoDir));
  20674. if (!is_writable(dirname($this->repoDir))) {
  20675. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  20676. }
  20677. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  20678. throw new \InvalidArgumentException('The source URL '.$this->url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  20679. }
  20680. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  20681. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  20682. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  20683. }
  20684. $cacheUrl = $this->url;
  20685. }
  20686. $this->getTags();
  20687. $this->getBranches();
  20688. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
  20689. }
  20690. public function getRootIdentifier()
  20691. {
  20692. if (null === $this->rootIdentifier) {
  20693. $this->rootIdentifier = 'master';
  20694. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  20695. $branches = $this->process->splitLines($output);
  20696. if (!in_array('* master', $branches)) {
  20697. foreach ($branches as $branch) {
  20698. if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
  20699. $this->rootIdentifier = $match[1];
  20700. break;
  20701. }
  20702. }
  20703. }
  20704. }
  20705. return $this->rootIdentifier;
  20706. }
  20707. public function getUrl()
  20708. {
  20709. return $this->url;
  20710. }
  20711. public function getSource($identifier)
  20712. {
  20713. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  20714. }
  20715. public function getDist($identifier)
  20716. {
  20717. return null;
  20718. }
  20719. public function getComposerInformation($identifier)
  20720. {
  20721. if (preg_match('{[a-f0-9]{40}}i', $identifier) && $res = $this->cache->read($identifier)) {
  20722. $this->infoCache[$identifier] = JsonFile::parseJson($res);
  20723. }
  20724. if (!isset($this->infoCache[$identifier])) {
  20725. $resource = sprintf('%s:composer.json', ProcessExecutor::escape($identifier));
  20726. $this->process->execute(sprintf('git show %s', $resource), $composer, $this->repoDir);
  20727. if (!trim($composer)) {
  20728. return;
  20729. }
  20730. $composer = JsonFile::parseJson($composer, $resource);
  20731. if (empty($composer['time'])) {
  20732. $this->process->execute(sprintf('git log -1 --format=%%at %s', ProcessExecutor::escape($identifier)), $output, $this->repoDir);
  20733. $date = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  20734. $composer['time'] = $date->format('Y-m-d H:i:s');
  20735. }
  20736. if (preg_match('{[a-f0-9]{40}}i', $identifier)) {
  20737. $this->cache->write($identifier, json_encode($composer));
  20738. }
  20739. $this->infoCache[$identifier] = $composer;
  20740. }
  20741. return $this->infoCache[$identifier];
  20742. }
  20743. public function getTags()
  20744. {
  20745. if (null === $this->tags) {
  20746. $this->tags = array();
  20747. $this->process->execute('git show-ref --tags', $output, $this->repoDir);
  20748. foreach ($output = $this->process->splitLines($output) as $tag) {
  20749. if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+)$}', $tag, $match)) {
  20750. $this->tags[$match[2]] = $match[1];
  20751. }
  20752. }
  20753. }
  20754. return $this->tags;
  20755. }
  20756. public function getBranches()
  20757. {
  20758. if (null === $this->branches) {
  20759. $branches = array();
  20760. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  20761. foreach ($this->process->splitLines($output) as $branch) {
  20762. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  20763. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  20764. $branches[$match[1]] = $match[2];
  20765. }
  20766. }
  20767. }
  20768. $this->branches = $branches;
  20769. }
  20770. return $this->branches;
  20771. }
  20772. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  20773. {
  20774. if (preg_match('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  20775. return true;
  20776. }
  20777. if (Filesystem::isLocalPath($url)) {
  20778. $url = Filesystem::getPlatformPath($url);
  20779. if (!is_dir($url)) {
  20780. return false;
  20781. }
  20782. $process = new ProcessExecutor($io);
  20783. if ($process->execute('git tag', $output, $url) === 0) {
  20784. return true;
  20785. }
  20786. }
  20787. if (!$deep) {
  20788. return false;
  20789. }
  20790. $process = new ProcessExecutor($io);
  20791. if ($process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0) {
  20792. return true;
  20793. }
  20794. return false;
  20795. }
  20796. }
  20797. <?php
  20798. namespace Composer\Repository\Vcs;
  20799. use Composer\Config;
  20800. use Composer\Downloader\TransportException;
  20801. use Composer\Json\JsonFile;
  20802. use Composer\Cache;
  20803. use Composer\IO\IOInterface;
  20804. use Composer\Util\GitHub;
  20805. class GitHubDriver extends VcsDriver
  20806. {
  20807. protected $cache;
  20808. protected $owner;
  20809. protected $repository;
  20810. protected $tags;
  20811. protected $branches;
  20812. protected $rootIdentifier;
  20813. protected $repoData;
  20814. protected $hasIssues;
  20815. protected $infoCache = array();
  20816. protected $isPrivate = false;
  20817. protected $gitDriver;
  20818. public function initialize()
  20819. {
  20820. preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
  20821. $this->owner = $match[3];
  20822. $this->repository = $match[4];
  20823. $this->originUrl = !empty($match[1]) ? $match[1] : $match[2];
  20824. if ($this->originUrl === 'www.github.com') {
  20825. $this->originUrl = 'github.com';
  20826. }
  20827. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  20828. if (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api']) {
  20829. $this->setupGitDriver($this->url);
  20830. return;
  20831. }
  20832. $this->fetchRootIdentifier();
  20833. }
  20834. public function getRepositoryUrl()
  20835. {
  20836. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  20837. }
  20838. public function getRootIdentifier()
  20839. {
  20840. if ($this->gitDriver) {
  20841. return $this->gitDriver->getRootIdentifier();
  20842. }
  20843. return $this->rootIdentifier;
  20844. }
  20845. public function getUrl()
  20846. {
  20847. if ($this->gitDriver) {
  20848. return $this->gitDriver->getUrl();
  20849. }
  20850. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  20851. }
  20852. protected function getApiUrl()
  20853. {
  20854. if ('github.com' === $this->originUrl) {
  20855. $apiUrl = 'api.github.com';
  20856. } else {
  20857. $apiUrl = $this->originUrl . '/api/v3';
  20858. }
  20859. return 'https://' . $apiUrl;
  20860. }
  20861. public function getSource($identifier)
  20862. {
  20863. if ($this->gitDriver) {
  20864. return $this->gitDriver->getSource($identifier);
  20865. }
  20866. if ($this->isPrivate) {
  20867. $url = $this->generateSshUrl();
  20868. } else {
  20869. $url = $this->getUrl();
  20870. }
  20871. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  20872. }
  20873. public function getDist($identifier)
  20874. {
  20875. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  20876. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  20877. }
  20878. public function getComposerInformation($identifier)
  20879. {
  20880. if ($this->gitDriver) {
  20881. return $this->gitDriver->getComposerInformation($identifier);
  20882. }
  20883. if (preg_match('{[a-f0-9]{40}}i', $identifier) && $res = $this->cache->read($identifier)) {
  20884. $this->infoCache[$identifier] = JsonFile::parseJson($res);
  20885. }
  20886. if (!isset($this->infoCache[$identifier])) {
  20887. $notFoundRetries = 2;
  20888. while ($notFoundRetries) {
  20889. try {
  20890. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/composer.json?ref='.urlencode($identifier);
  20891. $resource = JsonFile::parseJson($this->getContents($resource));
  20892. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($composer = base64_decode($resource['content']))) {
  20893. throw new \RuntimeException('Could not retrieve composer.json for '.$identifier);
  20894. }
  20895. break;
  20896. } catch (TransportException $e) {
  20897. if (404 !== $e->getCode()) {
  20898. throw $e;
  20899. }
  20900. $notFoundRetries--;
  20901. $composer = null;
  20902. }
  20903. }
  20904. if ($composer) {
  20905. $composer = JsonFile::parseJson($composer, $resource);
  20906. if (empty($composer['time'])) {
  20907. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  20908. $commit = JsonFile::parseJson($this->getContents($resource), $resource);
  20909. $composer['time'] = $commit['commit']['committer']['date'];
  20910. }
  20911. if (!isset($composer['support']['source'])) {
  20912. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  20913. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  20914. }
  20915. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  20916. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  20917. }
  20918. }
  20919. if ($composer && preg_match('{[a-f0-9]{40}}i', $identifier)) {
  20920. $this->cache->write($identifier, json_encode($composer));
  20921. }
  20922. $this->infoCache[$identifier] = $composer;
  20923. }
  20924. return $this->infoCache[$identifier];
  20925. }
  20926. public function getTags()
  20927. {
  20928. if ($this->gitDriver) {
  20929. return $this->gitDriver->getTags();
  20930. }
  20931. if (null === $this->tags) {
  20932. $this->tags = array();
  20933. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  20934. do {
  20935. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  20936. foreach ($tagsData as $tag) {
  20937. $this->tags[$tag['name']] = $tag['commit']['sha'];
  20938. }
  20939. $resource = $this->getNextPage();
  20940. } while ($resource);
  20941. }
  20942. return $this->tags;
  20943. }
  20944. public function getBranches()
  20945. {
  20946. if ($this->gitDriver) {
  20947. return $this->gitDriver->getBranches();
  20948. }
  20949. if (null === $this->branches) {
  20950. $this->branches = array();
  20951. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  20952. $branchBlacklist = array('gh-pages');
  20953. do {
  20954. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  20955. foreach ($branchData as $branch) {
  20956. $name = substr($branch['ref'], 11);
  20957. if (!in_array($name, $branchBlacklist)) {
  20958. $this->branches[$name] = $branch['object']['sha'];
  20959. }
  20960. }
  20961. $resource = $this->getNextPage();
  20962. } while ($resource);
  20963. }
  20964. return $this->branches;
  20965. }
  20966. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  20967. {
  20968. if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  20969. return false;
  20970. }
  20971. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  20972. if (!in_array(preg_replace('{^www\.}i', '', $originUrl), $config->get('github-domains'))) {
  20973. return false;
  20974. }
  20975. if (!extension_loaded('openssl')) {
  20976. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  20977. return false;
  20978. }
  20979. return true;
  20980. }
  20981. public function getRepoData()
  20982. {
  20983. $this->fetchRootIdentifier();
  20984. return $this->repoData;
  20985. }
  20986. protected function generateSshUrl()
  20987. {
  20988. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  20989. }
  20990. protected function getContents($url, $fetchingRepoData = false)
  20991. {
  20992. try {
  20993. return parent::getContents($url);
  20994. } catch (TransportException $e) {
  20995. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
  20996. switch ($e->getCode()) {
  20997. case 401:
  20998. case 404:
  20999. if (!$fetchingRepoData) {
  21000. throw $e;
  21001. }
  21002. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  21003. return parent::getContents($url);
  21004. }
  21005. if (!$this->io->isInteractive()) {
  21006. return $this->attemptCloneFallback();
  21007. }
  21008. $scopesIssued = array();
  21009. $scopesNeeded = array();
  21010. if ($headers = $e->getHeaders()) {
  21011. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-OAuth-Scopes')) {
  21012. $scopesIssued = explode(' ', $scopes);
  21013. }
  21014. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  21015. $scopesNeeded = explode(' ', $scopes);
  21016. }
  21017. }
  21018. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  21019. if (!$headers || count($scopesFailed)) {
  21020. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  21021. }
  21022. return parent::getContents($url);
  21023. case 403:
  21024. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  21025. return parent::getContents($url);
  21026. }
  21027. if (!$this->io->isInteractive() && $fetchingRepoData) {
  21028. return $this->attemptCloneFallback();
  21029. }
  21030. $rateLimited = false;
  21031. foreach ($e->getHeaders() as $header) {
  21032. if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  21033. $rateLimited = true;
  21034. }
  21035. }
  21036. if (!$this->io->hasAuthentication($this->originUrl)) {
  21037. if (!$this->io->isInteractive()) {
  21038. $this->io->writeError('<error>GitHub API limit exhausted. Failed to get metadata for the '.$this->url.' repository, try running in interactive mode so that you can enter your GitHub credentials to increase the API limit</error>');
  21039. throw $e;
  21040. }
  21041. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  21042. return parent::getContents($url);
  21043. }
  21044. if ($rateLimited) {
  21045. $rateLimit = $this->getRateLimit($e->getHeaders());
  21046. $this->io->writeError(sprintf(
  21047. '<error>GitHub API limit (%d calls/hr) is exhausted. You are already authorized so you have to wait until %s before doing more requests</error>',
  21048. $rateLimit['limit'],
  21049. $rateLimit['reset']
  21050. ));
  21051. }
  21052. throw $e;
  21053. default:
  21054. throw $e;
  21055. }
  21056. }
  21057. }
  21058. protected function getRateLimit(array $headers)
  21059. {
  21060. $rateLimit = array(
  21061. 'limit' => '?',
  21062. 'reset' => '?',
  21063. );
  21064. foreach ($headers as $header) {
  21065. $header = trim($header);
  21066. if (false === strpos($header, 'X-RateLimit-')) {
  21067. continue;
  21068. }
  21069. list($type, $value) = explode(':', $header, 2);
  21070. switch ($type) {
  21071. case 'X-RateLimit-Limit':
  21072. $rateLimit['limit'] = (int) trim($value);
  21073. break;
  21074. case 'X-RateLimit-Reset':
  21075. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  21076. break;
  21077. }
  21078. }
  21079. return $rateLimit;
  21080. }
  21081. protected function fetchRootIdentifier()
  21082. {
  21083. if ($this->repoData) {
  21084. return;
  21085. }
  21086. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  21087. $this->repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
  21088. if (null === $this->repoData && null !== $this->gitDriver) {
  21089. return;
  21090. }
  21091. $this->owner = $this->repoData['owner']['login'];
  21092. $this->repository = $this->repoData['name'];
  21093. $this->isPrivate = !empty($this->repoData['private']);
  21094. if (isset($this->repoData['default_branch'])) {
  21095. $this->rootIdentifier = $this->repoData['default_branch'];
  21096. } elseif (isset($this->repoData['master_branch'])) {
  21097. $this->rootIdentifier = $this->repoData['master_branch'];
  21098. } else {
  21099. $this->rootIdentifier = 'master';
  21100. }
  21101. $this->hasIssues = !empty($this->repoData['has_issues']);
  21102. }
  21103. protected function attemptCloneFallback()
  21104. {
  21105. $this->isPrivate = true;
  21106. try {
  21107. $this->setupGitDriver($this->generateSshUrl());
  21108. return;
  21109. } catch (\RuntimeException $e) {
  21110. $this->gitDriver = null;
  21111. $this->io->writeError('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your GitHub credentials</error>');
  21112. throw $e;
  21113. }
  21114. }
  21115. protected function setupGitDriver($url)
  21116. {
  21117. $this->gitDriver = new GitDriver(
  21118. array('url' => $url),
  21119. $this->io,
  21120. $this->config,
  21121. $this->process,
  21122. $this->remoteFilesystem
  21123. );
  21124. $this->gitDriver->initialize();
  21125. }
  21126. protected function getNextPage()
  21127. {
  21128. $headers = $this->remoteFilesystem->getLastHeaders();
  21129. foreach ($headers as $header) {
  21130. if (substr($header, 0, 5) === 'Link:') {
  21131. $links = explode(',', substr($header, 5));
  21132. foreach ($links as $link) {
  21133. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  21134. return $match[1];
  21135. }
  21136. }
  21137. }
  21138. }
  21139. }
  21140. }
  21141. <?php
  21142. namespace Composer\Repository\Vcs;
  21143. use Composer\Config;
  21144. use Composer\Cache;
  21145. use Composer\IO\IOInterface;
  21146. use Composer\Json\JsonFile;
  21147. use Composer\Downloader\TransportException;
  21148. use Composer\Util\RemoteFilesystem;
  21149. use Composer\Util\GitLab;
  21150. class GitLabDriver extends VcsDriver
  21151. {
  21152. private $scheme;
  21153. private $owner;
  21154. private $repository;
  21155. private $cache;
  21156. private $infoCache = array();
  21157. private $project;
  21158. private $commits = array();
  21159. private $tags;
  21160. private $branches;
  21161. protected $gitDriver;
  21162. const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)/|git@(?P<domain2>[^:]+):)(?P<owner>[^/]+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  21163. public function initialize()
  21164. {
  21165. if (!preg_match(self::URL_REGEX, $this->url, $match)) {
  21166. throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
  21167. }
  21168. $this->scheme = !empty($match['scheme']) ? $match['scheme'] : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https');
  21169. $this->originUrl = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  21170. $this->owner = $match['owner'];
  21171. $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
  21172. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  21173. $this->fetchProject();
  21174. }
  21175. public function setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)
  21176. {
  21177. $this->remoteFilesystem = $remoteFilesystem;
  21178. }
  21179. public function getComposerInformation($identifier)
  21180. {
  21181. if (!preg_match('{[a-f0-9]{40}}i', $identifier)) {
  21182. $branches = $this->getBranches();
  21183. if (isset($branches[$identifier])) {
  21184. $identifier = $branches[$identifier];
  21185. }
  21186. }
  21187. if (isset($this->infoCache[$identifier])) {
  21188. return $this->infoCache[$identifier];
  21189. }
  21190. if (preg_match('{[a-f0-9]{40}}i', $identifier) && $res = $this->cache->read($identifier)) {
  21191. return $this->infoCache[$identifier] = JsonFile::parseJson($res, $res);
  21192. }
  21193. try {
  21194. $composer = $this->fetchComposerFile($identifier);
  21195. } catch (TransportException $e) {
  21196. if ($e->getCode() !== 404) {
  21197. throw $e;
  21198. }
  21199. $composer = false;
  21200. }
  21201. if ($composer && !isset($composer['time']) && isset($this->commits[$identifier])) {
  21202. $composer['time'] = $this->commits[$identifier]['committed_date'];
  21203. }
  21204. if (preg_match('{[a-f0-9]{40}}i', $identifier)) {
  21205. $this->cache->write($identifier, json_encode($composer));
  21206. }
  21207. return $this->infoCache[$identifier] = $composer;
  21208. }
  21209. public function getRepositoryUrl()
  21210. {
  21211. return $this->project['ssh_url_to_repo'];
  21212. }
  21213. public function getUrl()
  21214. {
  21215. return $this->project['web_url'];
  21216. }
  21217. public function getDist($identifier)
  21218. {
  21219. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  21220. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  21221. }
  21222. public function getSource($identifier)
  21223. {
  21224. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  21225. }
  21226. public function getRootIdentifier()
  21227. {
  21228. return $this->project['default_branch'];
  21229. }
  21230. public function getBranches()
  21231. {
  21232. if (!$this->branches) {
  21233. $this->branches = $this->getReferences('branches');
  21234. }
  21235. return $this->branches;
  21236. }
  21237. public function getTags()
  21238. {
  21239. if (!$this->tags) {
  21240. $this->tags = $this->getReferences('tags');
  21241. }
  21242. return $this->tags;
  21243. }
  21244. protected function fetchComposerFile($identifier)
  21245. {
  21246. $resource = $this->getApiUrl().'/repository/blobs/'.$identifier.'?filepath=composer.json';
  21247. return JsonFile::parseJson($this->getContents($resource), $resource);
  21248. }
  21249. public function getApiUrl()
  21250. {
  21251. return $this->scheme.'://'.$this->originUrl.'/api/v3/projects/'.$this->owner.'%2F'.$this->repository;
  21252. }
  21253. protected function getReferences($type)
  21254. {
  21255. $resource = $this->getApiUrl().'/repository/'.$type;
  21256. $data = JsonFile::parseJson($this->getContents($resource), $resource);
  21257. $references = array();
  21258. foreach ($data as $datum) {
  21259. $references[$datum['name']] = $datum['commit']['id'];
  21260. $this->commits[$datum['commit']['id']] = $datum['commit'];
  21261. }
  21262. return $references;
  21263. }
  21264. protected function fetchProject()
  21265. {
  21266. $resource = $this->getApiUrl();
  21267. $this->project = JsonFile::parseJson($this->getContents($resource, true), $resource);
  21268. }
  21269. protected function attemptCloneFallback()
  21270. {
  21271. try {
  21272. $this->setupGitDriver($this->generateSshUrl());
  21273. return;
  21274. } catch (\RuntimeException $e) {
  21275. $this->gitDriver = null;
  21276. $this->io->writeError('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your credentials</error>');
  21277. throw $e;
  21278. }
  21279. }
  21280. protected function generateSshUrl()
  21281. {
  21282. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  21283. }
  21284. protected function setupGitDriver($url)
  21285. {
  21286. $this->gitDriver = new GitDriver(
  21287. array('url' => $url),
  21288. $this->io,
  21289. $this->config,
  21290. $this->process,
  21291. $this->remoteFilesystem
  21292. );
  21293. $this->gitDriver->initialize();
  21294. }
  21295. protected function getContents($url, $fetchingRepoData = false)
  21296. {
  21297. try {
  21298. return parent::getContents($url);
  21299. } catch (TransportException $e) {
  21300. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->remoteFilesystem);
  21301. switch ($e->getCode()) {
  21302. case 401:
  21303. case 404:
  21304. if (!$fetchingRepoData) {
  21305. throw $e;
  21306. }
  21307. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  21308. return parent::getContents($url);
  21309. }
  21310. if (!$this->io->isInteractive()) {
  21311. return $this->attemptCloneFallback();
  21312. }
  21313. $this->io->writeError('<warning>Failed to download ' . $this->owner . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  21314. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  21315. return parent::getContents($url);
  21316. case 403:
  21317. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  21318. return parent::getContents($url);
  21319. }
  21320. if (!$this->io->isInteractive() && $fetchingRepoData) {
  21321. return $this->attemptCloneFallback();
  21322. }
  21323. throw $e;
  21324. default:
  21325. throw $e;
  21326. }
  21327. }
  21328. }
  21329. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21330. {
  21331. if (!preg_match(self::URL_REGEX, $url, $match)) {
  21332. return false;
  21333. }
  21334. $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
  21335. $originUrl = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  21336. if (!in_array($originUrl, (array) $config->get('gitlab-domains'))) {
  21337. return false;
  21338. }
  21339. if ('https' === $scheme && !extension_loaded('openssl')) {
  21340. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  21341. return false;
  21342. }
  21343. return true;
  21344. }
  21345. }
  21346. <?php
  21347. namespace Composer\Repository\Vcs;
  21348. use Composer\Cache;
  21349. use Composer\Config;
  21350. use Composer\Json\JsonFile;
  21351. use Composer\IO\IOInterface;
  21352. class HgBitbucketDriver extends VcsDriver
  21353. {
  21354. protected $cache;
  21355. protected $owner;
  21356. protected $repository;
  21357. protected $tags;
  21358. protected $branches;
  21359. protected $rootIdentifier;
  21360. protected $infoCache = array();
  21361. public function initialize()
  21362. {
  21363. preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#', $this->url, $match);
  21364. $this->owner = $match[1];
  21365. $this->repository = $match[2];
  21366. $this->originUrl = 'bitbucket.org';
  21367. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  21368. }
  21369. public function getRootIdentifier()
  21370. {
  21371. if (null === $this->rootIdentifier) {
  21372. $resource = $this->getScheme() . '://bitbucket.org/api/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags';
  21373. $repoData = JsonFile::parseJson($this->getContents($resource), $resource);
  21374. if (array() === $repoData || !isset($repoData['tip'])) {
  21375. throw new \RuntimeException($this->url.' does not appear to be a mercurial repository, use '.$this->url.'.git if this is a git bitbucket repository');
  21376. }
  21377. $this->rootIdentifier = $repoData['tip']['raw_node'];
  21378. }
  21379. return $this->rootIdentifier;
  21380. }
  21381. public function getUrl()
  21382. {
  21383. return $this->url;
  21384. }
  21385. public function getSource($identifier)
  21386. {
  21387. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  21388. }
  21389. public function getDist($identifier)
  21390. {
  21391. $url = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$identifier.'.zip';
  21392. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  21393. }
  21394. public function getComposerInformation($identifier)
  21395. {
  21396. if (preg_match('{[a-f0-9]{40}}i', $identifier) && $res = $this->cache->read($identifier)) {
  21397. $this->infoCache[$identifier] = JsonFile::parseJson($res);
  21398. }
  21399. if (!isset($this->infoCache[$identifier])) {
  21400. $resource = $this->getScheme() . '://bitbucket.org/api/1.0/repositories/'.$this->owner.'/'.$this->repository.'/src/'.$identifier.'/composer.json';
  21401. $repoData = JsonFile::parseJson($this->getContents($resource), $resource);
  21402. if (!array_key_exists('data', $repoData)) {
  21403. return;
  21404. }
  21405. $composer = JsonFile::parseJson($repoData['data'], $resource);
  21406. if (empty($composer['time'])) {
  21407. $resource = $this->getScheme() . '://bitbucket.org/api/1.0/repositories/'.$this->owner.'/'.$this->repository.'/changesets/'.$identifier;
  21408. $changeset = JsonFile::parseJson($this->getContents($resource), $resource);
  21409. $composer['time'] = $changeset['timestamp'];
  21410. }
  21411. if (preg_match('{[a-f0-9]{40}}i', $identifier)) {
  21412. $this->cache->write($identifier, json_encode($composer));
  21413. }
  21414. $this->infoCache[$identifier] = $composer;
  21415. }
  21416. return $this->infoCache[$identifier];
  21417. }
  21418. public function getTags()
  21419. {
  21420. if (null === $this->tags) {
  21421. $resource = $this->getScheme() . '://bitbucket.org/api/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags';
  21422. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  21423. $this->tags = array();
  21424. foreach ($tagsData as $tag => $data) {
  21425. $this->tags[$tag] = $data['raw_node'];
  21426. }
  21427. unset($this->tags['tip']);
  21428. }
  21429. return $this->tags;
  21430. }
  21431. public function getBranches()
  21432. {
  21433. if (null === $this->branches) {
  21434. $resource = $this->getScheme() . '://bitbucket.org/api/1.0/repositories/'.$this->owner.'/'.$this->repository.'/branches';
  21435. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  21436. $this->branches = array();
  21437. foreach ($branchData as $branch => $data) {
  21438. $this->branches[$branch] = $data['raw_node'];
  21439. }
  21440. }
  21441. return $this->branches;
  21442. }
  21443. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21444. {
  21445. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#', $url)) {
  21446. return false;
  21447. }
  21448. if (!extension_loaded('openssl')) {
  21449. $io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  21450. return false;
  21451. }
  21452. return true;
  21453. }
  21454. }
  21455. <?php
  21456. namespace Composer\Repository\Vcs;
  21457. use Composer\Config;
  21458. use Composer\Json\JsonFile;
  21459. use Composer\Util\ProcessExecutor;
  21460. use Composer\Util\Filesystem;
  21461. use Composer\IO\IOInterface;
  21462. class HgDriver extends VcsDriver
  21463. {
  21464. protected $tags;
  21465. protected $branches;
  21466. protected $rootIdentifier;
  21467. protected $repoDir;
  21468. protected $infoCache = array();
  21469. public function initialize()
  21470. {
  21471. if (Filesystem::isLocalPath($this->url)) {
  21472. $this->repoDir = $this->url;
  21473. } else {
  21474. $cacheDir = $this->config->get('cache-vcs-dir');
  21475. $this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  21476. $fs = new Filesystem();
  21477. $fs->ensureDirectoryExists($cacheDir);
  21478. if (!is_writable(dirname($this->repoDir))) {
  21479. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  21480. }
  21481. $this->config->prohibitUrlByConfig($this->url, $this->io);
  21482. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  21483. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  21484. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  21485. }
  21486. } else {
  21487. $fs->removeDirectory($this->repoDir);
  21488. if (0 !== $this->process->execute(sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoDir)), $output, $cacheDir)) {
  21489. $output = $this->process->getErrorOutput();
  21490. if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
  21491. throw new \RuntimeException('Failed to clone '.$this->url.', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  21492. }
  21493. throw new \RuntimeException('Failed to clone '.$this->url.', could not read packages from it' . "\n\n" .$output);
  21494. }
  21495. }
  21496. }
  21497. $this->getTags();
  21498. $this->getBranches();
  21499. }
  21500. public function getRootIdentifier()
  21501. {
  21502. if (null === $this->rootIdentifier) {
  21503. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  21504. $output = $this->process->splitLines($output);
  21505. $this->rootIdentifier = $output[0];
  21506. }
  21507. return $this->rootIdentifier;
  21508. }
  21509. public function getUrl()
  21510. {
  21511. return $this->url;
  21512. }
  21513. public function getSource($identifier)
  21514. {
  21515. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  21516. }
  21517. public function getDist($identifier)
  21518. {
  21519. return null;
  21520. }
  21521. public function getComposerInformation($identifier)
  21522. {
  21523. if (!isset($this->infoCache[$identifier])) {
  21524. $this->process->execute(sprintf('hg cat -r %s composer.json', ProcessExecutor::escape($identifier)), $composer, $this->repoDir);
  21525. if (!trim($composer)) {
  21526. return;
  21527. }
  21528. $composer = JsonFile::parseJson($composer, $identifier);
  21529. if (empty($composer['time'])) {
  21530. $this->process->execute(sprintf('hg log --template "{date|rfc3339date}" -r %s', ProcessExecutor::escape($identifier)), $output, $this->repoDir);
  21531. $date = new \DateTime(trim($output), new \DateTimeZone('UTC'));
  21532. $composer['time'] = $date->format('Y-m-d H:i:s');
  21533. }
  21534. $this->infoCache[$identifier] = $composer;
  21535. }
  21536. return $this->infoCache[$identifier];
  21537. }
  21538. public function getTags()
  21539. {
  21540. if (null === $this->tags) {
  21541. $tags = array();
  21542. $this->process->execute('hg tags', $output, $this->repoDir);
  21543. foreach ($this->process->splitLines($output) as $tag) {
  21544. if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  21545. $tags[$match[1]] = $match[2];
  21546. }
  21547. }
  21548. unset($tags['tip']);
  21549. $this->tags = $tags;
  21550. }
  21551. return $this->tags;
  21552. }
  21553. public function getBranches()
  21554. {
  21555. if (null === $this->branches) {
  21556. $branches = array();
  21557. $bookmarks = array();
  21558. $this->process->execute('hg branches', $output, $this->repoDir);
  21559. foreach ($this->process->splitLines($output) as $branch) {
  21560. if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  21561. $branches[$match[1]] = $match[2];
  21562. }
  21563. }
  21564. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  21565. foreach ($this->process->splitLines($output) as $branch) {
  21566. if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  21567. $bookmarks[$match[1]] = $match[2];
  21568. }
  21569. }
  21570. $this->branches = array_merge($bookmarks, $branches);
  21571. }
  21572. return $this->branches;
  21573. }
  21574. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21575. {
  21576. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  21577. return true;
  21578. }
  21579. if (Filesystem::isLocalPath($url)) {
  21580. $url = Filesystem::getPlatformPath($url);
  21581. if (!is_dir($url)) {
  21582. return false;
  21583. }
  21584. $process = new ProcessExecutor();
  21585. if ($process->execute('hg summary', $output, $url) === 0) {
  21586. return true;
  21587. }
  21588. }
  21589. if (!$deep) {
  21590. return false;
  21591. }
  21592. $processExecutor = new ProcessExecutor();
  21593. $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
  21594. return $exit === 0;
  21595. }
  21596. }
  21597. <?php
  21598. namespace Composer\Repository\Vcs;
  21599. use Composer\Config;
  21600. use Composer\IO\IOInterface;
  21601. use Composer\Util\ProcessExecutor;
  21602. use Composer\Util\Perforce;
  21603. class PerforceDriver extends VcsDriver
  21604. {
  21605. protected $depot;
  21606. protected $branch;
  21607. protected $perforce;
  21608. protected $composerInfo;
  21609. protected $composerInfoIdentifier;
  21610. public function initialize()
  21611. {
  21612. $this->depot = $this->repoConfig['depot'];
  21613. $this->branch = '';
  21614. if (!empty($this->repoConfig['branch'])) {
  21615. $this->branch = $this->repoConfig['branch'];
  21616. }
  21617. $this->initPerforce($this->repoConfig);
  21618. $this->perforce->p4Login($this->io);
  21619. $this->perforce->checkStream($this->depot);
  21620. $this->perforce->writeP4ClientSpec();
  21621. $this->perforce->connectClient();
  21622. return true;
  21623. }
  21624. private function initPerforce($repoConfig)
  21625. {
  21626. if (!empty($this->perforce)) {
  21627. return;
  21628. }
  21629. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  21630. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  21631. }
  21632. public function getComposerInformation($identifier)
  21633. {
  21634. if (!empty($this->composerInfoIdentifier)) {
  21635. if (strcmp($identifier, $this->composerInfoIdentifier) === 0) {
  21636. return $this->composerInfo;
  21637. }
  21638. }
  21639. $composer_info = $this->perforce->getComposerInformation($identifier);
  21640. return $composer_info;
  21641. }
  21642. public function getRootIdentifier()
  21643. {
  21644. return $this->branch;
  21645. }
  21646. public function getBranches()
  21647. {
  21648. $branches = $this->perforce->getBranches();
  21649. return $branches;
  21650. }
  21651. public function getTags()
  21652. {
  21653. $tags = $this->perforce->getTags();
  21654. return $tags;
  21655. }
  21656. public function getDist($identifier)
  21657. {
  21658. return null;
  21659. }
  21660. public function getSource($identifier)
  21661. {
  21662. $source = array(
  21663. 'type' => 'perforce',
  21664. 'url' => $this->repoConfig['url'],
  21665. 'reference' => $identifier,
  21666. 'p4user' => $this->perforce->getUser(),
  21667. );
  21668. return $source;
  21669. }
  21670. public function getUrl()
  21671. {
  21672. return $this->url;
  21673. }
  21674. public function hasComposerFile($identifier)
  21675. {
  21676. $this->composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  21677. $this->composerInfoIdentifier = $identifier;
  21678. return !empty($this->composerInfo);
  21679. }
  21680. public function getContents($url)
  21681. {
  21682. return false;
  21683. }
  21684. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21685. {
  21686. if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
  21687. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  21688. }
  21689. return false;
  21690. }
  21691. public function cleanup()
  21692. {
  21693. $this->perforce->cleanupClientSpec();
  21694. $this->perforce = null;
  21695. }
  21696. public function getDepot()
  21697. {
  21698. return $this->depot;
  21699. }
  21700. public function getBranch()
  21701. {
  21702. return $this->branch;
  21703. }
  21704. }
  21705. <?php
  21706. namespace Composer\Repository\Vcs;
  21707. use Composer\Cache;
  21708. use Composer\Config;
  21709. use Composer\Json\JsonFile;
  21710. use Composer\Util\ProcessExecutor;
  21711. use Composer\Util\Filesystem;
  21712. use Composer\Util\Svn as SvnUtil;
  21713. use Composer\IO\IOInterface;
  21714. use Composer\Downloader\TransportException;
  21715. class SvnDriver extends VcsDriver
  21716. {
  21717. protected $cache;
  21718. protected $baseUrl;
  21719. protected $tags;
  21720. protected $branches;
  21721. protected $rootIdentifier;
  21722. protected $infoCache = array();
  21723. protected $trunkPath = 'trunk';
  21724. protected $branchesPath = 'branches';
  21725. protected $tagsPath = 'tags';
  21726. protected $packagePath = '';
  21727. protected $cacheCredentials = true;
  21728. private $util;
  21729. public function initialize()
  21730. {
  21731. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  21732. SvnUtil::cleanEnv();
  21733. if (isset($this->repoConfig['trunk-path'])) {
  21734. $this->trunkPath = $this->repoConfig['trunk-path'];
  21735. }
  21736. if (isset($this->repoConfig['branches-path'])) {
  21737. $this->branchesPath = $this->repoConfig['branches-path'];
  21738. }
  21739. if (isset($this->repoConfig['tags-path'])) {
  21740. $this->tagsPath = $this->repoConfig['tags-path'];
  21741. }
  21742. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  21743. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  21744. }
  21745. if (isset($this->repoConfig['package-path'])) {
  21746. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  21747. }
  21748. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  21749. $this->baseUrl = substr($this->url, 0, $pos);
  21750. }
  21751. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
  21752. $this->getBranches();
  21753. $this->getTags();
  21754. }
  21755. public function getRootIdentifier()
  21756. {
  21757. return $this->rootIdentifier ?: $this->trunkPath;
  21758. }
  21759. public function getUrl()
  21760. {
  21761. return $this->url;
  21762. }
  21763. public function getSource($identifier)
  21764. {
  21765. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  21766. }
  21767. public function getDist($identifier)
  21768. {
  21769. return null;
  21770. }
  21771. public function getComposerInformation($identifier)
  21772. {
  21773. $identifier = '/' . trim($identifier, '/') . '/';
  21774. if ($res = $this->cache->read($identifier.'.json')) {
  21775. $this->infoCache[$identifier] = JsonFile::parseJson($res);
  21776. }
  21777. if (!isset($this->infoCache[$identifier])) {
  21778. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  21779. if (!empty($match[2])) {
  21780. $path = $match[1];
  21781. $rev = $match[2];
  21782. } else {
  21783. $path = $identifier;
  21784. $rev = '';
  21785. }
  21786. try {
  21787. $resource = $path.'composer.json';
  21788. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  21789. if (!trim($output)) {
  21790. return;
  21791. }
  21792. } catch (\RuntimeException $e) {
  21793. throw new TransportException($e->getMessage());
  21794. }
  21795. $composer = JsonFile::parseJson($output, $this->baseUrl . $resource . $rev);
  21796. if (empty($composer['time'])) {
  21797. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  21798. foreach ($this->process->splitLines($output) as $line) {
  21799. if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  21800. $date = new \DateTime($match[1], new \DateTimeZone('UTC'));
  21801. $composer['time'] = $date->format('Y-m-d H:i:s');
  21802. break;
  21803. }
  21804. }
  21805. }
  21806. $this->cache->write($identifier.'.json', json_encode($composer));
  21807. $this->infoCache[$identifier] = $composer;
  21808. }
  21809. return $this->infoCache[$identifier];
  21810. }
  21811. public function getTags()
  21812. {
  21813. if (null === $this->tags) {
  21814. $this->tags = array();
  21815. if ($this->tagsPath !== false) {
  21816. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  21817. if ($output) {
  21818. foreach ($this->process->splitLines($output) as $line) {
  21819. $line = trim($line);
  21820. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  21821. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  21822. $this->tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  21823. '/' . $this->tagsPath . '/' . $match[2],
  21824. $match[1]
  21825. );
  21826. }
  21827. }
  21828. }
  21829. }
  21830. }
  21831. }
  21832. return $this->tags;
  21833. }
  21834. public function getBranches()
  21835. {
  21836. if (null === $this->branches) {
  21837. $this->branches = array();
  21838. if (false === $this->trunkPath) {
  21839. $trunkParent = $this->baseUrl . '/';
  21840. } else {
  21841. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  21842. }
  21843. $output = $this->execute('svn ls --verbose', $trunkParent);
  21844. if ($output) {
  21845. foreach ($this->process->splitLines($output) as $line) {
  21846. $line = trim($line);
  21847. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  21848. if (isset($match[1]) && isset($match[2]) && $match[2] === './') {
  21849. $this->branches['trunk'] = $this->buildIdentifier(
  21850. '/' . $this->trunkPath,
  21851. $match[1]
  21852. );
  21853. $this->rootIdentifier = $this->branches['trunk'];
  21854. break;
  21855. }
  21856. }
  21857. }
  21858. }
  21859. unset($output);
  21860. if ($this->branchesPath !== false) {
  21861. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  21862. if ($output) {
  21863. foreach ($this->process->splitLines(trim($output)) as $line) {
  21864. $line = trim($line);
  21865. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  21866. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  21867. $this->branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  21868. '/' . $this->branchesPath . '/' . $match[2],
  21869. $match[1]
  21870. );
  21871. }
  21872. }
  21873. }
  21874. }
  21875. }
  21876. }
  21877. return $this->branches;
  21878. }
  21879. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21880. {
  21881. $url = self::normalizeUrl($url);
  21882. if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  21883. return true;
  21884. }
  21885. if (!$deep && !Filesystem::isLocalPath($url)) {
  21886. return false;
  21887. }
  21888. $processExecutor = new ProcessExecutor();
  21889. $exit = $processExecutor->execute(
  21890. "svn info --non-interactive {$url}",
  21891. $ignoredOutput
  21892. );
  21893. if ($exit === 0) {
  21894. return true;
  21895. }
  21896. if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
  21897. return true;
  21898. }
  21899. return false;
  21900. }
  21901. protected static function normalizeUrl($url)
  21902. {
  21903. $fs = new Filesystem();
  21904. if ($fs->isAbsolutePath($url)) {
  21905. return 'file://' . strtr($url, '\\', '/');
  21906. }
  21907. return $url;
  21908. }
  21909. protected function execute($command, $url)
  21910. {
  21911. if (null === $this->util) {
  21912. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  21913. $this->util->setCacheCredentials($this->cacheCredentials);
  21914. }
  21915. try {
  21916. return $this->util->execute($command, $url);
  21917. } catch (\RuntimeException $e) {
  21918. if (0 !== $this->process->execute('svn --version', $ignoredOutput)) {
  21919. throw new \RuntimeException('Failed to load '.$this->url.', svn was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  21920. }
  21921. throw new \RuntimeException(
  21922. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  21923. );
  21924. }
  21925. }
  21926. protected function buildIdentifier($baseDir, $revision)
  21927. {
  21928. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  21929. }
  21930. }
  21931. <?php
  21932. namespace Composer\Repository\Vcs;
  21933. use Composer\Downloader\TransportException;
  21934. use Composer\Config;
  21935. use Composer\Factory;
  21936. use Composer\IO\IOInterface;
  21937. use Composer\Util\ProcessExecutor;
  21938. use Composer\Util\RemoteFilesystem;
  21939. use Composer\Util\Filesystem;
  21940. abstract class VcsDriver implements VcsDriverInterface
  21941. {
  21942. protected $url;
  21943. protected $originUrl;
  21944. protected $repoConfig;
  21945. protected $io;
  21946. protected $config;
  21947. protected $process;
  21948. protected $remoteFilesystem;
  21949. final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  21950. {
  21951. if (Filesystem::isLocalPath($repoConfig['url'])) {
  21952. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  21953. }
  21954. $this->url = $repoConfig['url'];
  21955. $this->originUrl = $repoConfig['url'];
  21956. $this->repoConfig = $repoConfig;
  21957. $this->io = $io;
  21958. $this->config = $config;
  21959. $this->process = $process ?: new ProcessExecutor($io);
  21960. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  21961. }
  21962. public function hasComposerFile($identifier)
  21963. {
  21964. try {
  21965. return (bool) $this->getComposerInformation($identifier);
  21966. } catch (TransportException $e) {
  21967. }
  21968. return false;
  21969. }
  21970. protected function getScheme()
  21971. {
  21972. if (extension_loaded('openssl')) {
  21973. return 'https';
  21974. }
  21975. return 'http';
  21976. }
  21977. protected function getContents($url)
  21978. {
  21979. return $this->remoteFilesystem->getContents($this->originUrl, $url, false);
  21980. }
  21981. public function cleanup()
  21982. {
  21983. return;
  21984. }
  21985. }
  21986. <?php
  21987. namespace Composer\Repository\Vcs;
  21988. use Composer\Config;
  21989. use Composer\IO\IOInterface;
  21990. interface VcsDriverInterface
  21991. {
  21992. public function initialize();
  21993. public function getComposerInformation($identifier);
  21994. public function getRootIdentifier();
  21995. public function getBranches();
  21996. public function getTags();
  21997. public function getDist($identifier);
  21998. public function getSource($identifier);
  21999. public function getUrl();
  22000. public function hasComposerFile($identifier);
  22001. public function cleanup();
  22002. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  22003. }
  22004. <?php
  22005. namespace Composer\Repository;
  22006. use Composer\Downloader\TransportException;
  22007. use Composer\Repository\Vcs\VcsDriverInterface;
  22008. use Composer\Package\Version\VersionParser;
  22009. use Composer\Package\Loader\ArrayLoader;
  22010. use Composer\Package\Loader\ValidatingArrayLoader;
  22011. use Composer\Package\Loader\InvalidPackageException;
  22012. use Composer\Package\Loader\LoaderInterface;
  22013. use Composer\EventDispatcher\EventDispatcher;
  22014. use Composer\IO\IOInterface;
  22015. use Composer\Config;
  22016. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  22017. {
  22018. protected $url;
  22019. protected $packageName;
  22020. protected $verbose;
  22021. protected $io;
  22022. protected $config;
  22023. protected $versionParser;
  22024. protected $type;
  22025. protected $loader;
  22026. protected $repoConfig;
  22027. protected $branchErrorOccurred = false;
  22028. private $drivers;
  22029. private $driver;
  22030. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null)
  22031. {
  22032. parent::__construct();
  22033. $this->drivers = $drivers ?: array(
  22034. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  22035. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  22036. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  22037. 'git' => 'Composer\Repository\Vcs\GitDriver',
  22038. 'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
  22039. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  22040. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  22041. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  22042. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  22043. );
  22044. $this->url = $repoConfig['url'];
  22045. $this->io = $io;
  22046. $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
  22047. $this->verbose = $io->isVeryVerbose();
  22048. $this->config = $config;
  22049. $this->repoConfig = $repoConfig;
  22050. }
  22051. public function getRepoConfig()
  22052. {
  22053. return $this->repoConfig;
  22054. }
  22055. public function setLoader(LoaderInterface $loader)
  22056. {
  22057. $this->loader = $loader;
  22058. }
  22059. public function getDriver()
  22060. {
  22061. if ($this->driver) {
  22062. return $this->driver;
  22063. }
  22064. if (isset($this->drivers[$this->type])) {
  22065. $class = $this->drivers[$this->type];
  22066. $this->driver = new $class($this->repoConfig, $this->io, $this->config);
  22067. $this->driver->initialize();
  22068. return $this->driver;
  22069. }
  22070. foreach ($this->drivers as $driver) {
  22071. if ($driver::supports($this->io, $this->config, $this->url)) {
  22072. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  22073. $this->driver->initialize();
  22074. return $this->driver;
  22075. }
  22076. }
  22077. foreach ($this->drivers as $driver) {
  22078. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  22079. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  22080. $this->driver->initialize();
  22081. return $this->driver;
  22082. }
  22083. }
  22084. }
  22085. public function hadInvalidBranches()
  22086. {
  22087. return $this->branchErrorOccurred;
  22088. }
  22089. protected function initialize()
  22090. {
  22091. parent::initialize();
  22092. $verbose = $this->verbose;
  22093. $driver = $this->getDriver();
  22094. if (!$driver) {
  22095. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  22096. }
  22097. $this->versionParser = new VersionParser;
  22098. if (!$this->loader) {
  22099. $this->loader = new ArrayLoader($this->versionParser);
  22100. }
  22101. try {
  22102. if ($driver->hasComposerFile($driver->getRootIdentifier())) {
  22103. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  22104. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  22105. }
  22106. } catch (\Exception $e) {
  22107. if ($verbose) {
  22108. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  22109. }
  22110. }
  22111. foreach ($driver->getTags() as $tag => $identifier) {
  22112. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  22113. if ($verbose) {
  22114. $this->io->writeError($msg);
  22115. } else {
  22116. $this->io->overwriteError($msg, false);
  22117. }
  22118. $tag = str_replace('release-', '', $tag);
  22119. if (!$parsedTag = $this->validateTag($tag)) {
  22120. if ($verbose) {
  22121. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  22122. }
  22123. continue;
  22124. }
  22125. try {
  22126. if (!$data = $driver->getComposerInformation($identifier)) {
  22127. if ($verbose) {
  22128. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  22129. }
  22130. continue;
  22131. }
  22132. if (isset($data['version'])) {
  22133. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  22134. } else {
  22135. $data['version'] = $tag;
  22136. $data['version_normalized'] = $parsedTag;
  22137. }
  22138. $data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
  22139. $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  22140. if ($data['version_normalized'] !== $parsedTag) {
  22141. if ($verbose) {
  22142. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  22143. }
  22144. continue;
  22145. }
  22146. if ($verbose) {
  22147. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  22148. }
  22149. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  22150. } catch (\Exception $e) {
  22151. if ($verbose) {
  22152. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).'</warning>');
  22153. }
  22154. continue;
  22155. }
  22156. }
  22157. if (!$verbose) {
  22158. $this->io->overwriteError('', false);
  22159. }
  22160. foreach ($driver->getBranches() as $branch => $identifier) {
  22161. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  22162. if ($verbose) {
  22163. $this->io->writeError($msg);
  22164. } else {
  22165. $this->io->overwriteError($msg, false);
  22166. }
  22167. if (!$parsedBranch = $this->validateBranch($branch)) {
  22168. if ($verbose) {
  22169. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  22170. }
  22171. continue;
  22172. }
  22173. try {
  22174. if (!$data = $driver->getComposerInformation($identifier)) {
  22175. if ($verbose) {
  22176. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  22177. }
  22178. continue;
  22179. }
  22180. $data['version'] = $branch;
  22181. $data['version_normalized'] = $parsedBranch;
  22182. if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
  22183. $data['version'] = 'dev-' . $data['version'];
  22184. } else {
  22185. $prefix = substr($branch, 0, 1) === 'v' ? 'v' : '';
  22186. $data['version'] = $prefix . preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
  22187. }
  22188. if ($verbose) {
  22189. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  22190. }
  22191. $packageData = $this->preProcess($driver, $data, $identifier);
  22192. $package = $this->loader->load($packageData);
  22193. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  22194. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  22195. }
  22196. $this->addPackage($package);
  22197. } catch (TransportException $e) {
  22198. if ($verbose) {
  22199. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found</warning>');
  22200. }
  22201. continue;
  22202. } catch (\Exception $e) {
  22203. if (!$verbose) {
  22204. $this->io->writeError('');
  22205. }
  22206. $this->branchErrorOccurred = true;
  22207. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  22208. $this->io->writeError('');
  22209. continue;
  22210. }
  22211. }
  22212. $driver->cleanup();
  22213. if (!$verbose) {
  22214. $this->io->overwriteError('', false);
  22215. }
  22216. if (!$this->getPackages()) {
  22217. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  22218. }
  22219. }
  22220. protected function preProcess(VcsDriverInterface $driver, array $data, $identifier)
  22221. {
  22222. $data['name'] = $this->packageName ?: $data['name'];
  22223. if (!isset($data['dist'])) {
  22224. $data['dist'] = $driver->getDist($identifier);
  22225. }
  22226. if (!isset($data['source'])) {
  22227. $data['source'] = $driver->getSource($identifier);
  22228. }
  22229. return $data;
  22230. }
  22231. private function validateBranch($branch)
  22232. {
  22233. try {
  22234. return $this->versionParser->normalizeBranch($branch);
  22235. } catch (\Exception $e) {
  22236. }
  22237. return false;
  22238. }
  22239. private function validateTag($version)
  22240. {
  22241. try {
  22242. return $this->versionParser->normalize($version);
  22243. } catch (\Exception $e) {
  22244. }
  22245. return false;
  22246. }
  22247. }
  22248. <?php
  22249. namespace Composer\Repository;
  22250. use Composer\Package\AliasPackage;
  22251. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  22252. {
  22253. public function write()
  22254. {
  22255. }
  22256. public function reload()
  22257. {
  22258. }
  22259. public function getCanonicalPackages()
  22260. {
  22261. $packages = $this->getPackages();
  22262. $packagesByName = array();
  22263. foreach ($packages as $package) {
  22264. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  22265. $packagesByName[$package->getName()] = $package;
  22266. }
  22267. }
  22268. $canonicalPackages = array();
  22269. foreach ($packagesByName as $package) {
  22270. while ($package instanceof AliasPackage) {
  22271. $package = $package->getAliasOf();
  22272. }
  22273. $canonicalPackages[] = $package;
  22274. }
  22275. return $canonicalPackages;
  22276. }
  22277. }
  22278. <?php
  22279. namespace Composer\Repository;
  22280. use Composer\Package\PackageInterface;
  22281. interface WritableRepositoryInterface extends RepositoryInterface
  22282. {
  22283. public function write();
  22284. public function addPackage(PackageInterface $package);
  22285. public function removePackage(PackageInterface $package);
  22286. public function getCanonicalPackages();
  22287. public function reload();
  22288. }
  22289. <?php
  22290. namespace Composer\Script;
  22291. class CommandEvent extends Event
  22292. {
  22293. }
  22294. <?php
  22295. namespace Composer\Script;
  22296. use Composer\Composer;
  22297. use Composer\IO\IOInterface;
  22298. use Composer\EventDispatcher\Event as BaseEvent;
  22299. class Event extends BaseEvent
  22300. {
  22301. private $composer;
  22302. private $io;
  22303. private $devMode;
  22304. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array(), array $flags = array())
  22305. {
  22306. parent::__construct($name, $args, $flags);
  22307. $this->composer = $composer;
  22308. $this->io = $io;
  22309. $this->devMode = $devMode;
  22310. }
  22311. public function getComposer()
  22312. {
  22313. return $this->composer;
  22314. }
  22315. public function getIO()
  22316. {
  22317. return $this->io;
  22318. }
  22319. public function isDevMode()
  22320. {
  22321. return $this->devMode;
  22322. }
  22323. }
  22324. <?php
  22325. namespace Composer\Script;
  22326. use Composer\Installer\PackageEvent as BasePackageEvent;
  22327. class PackageEvent extends BasePackageEvent
  22328. {
  22329. }
  22330. <?php
  22331. namespace Composer\Script;
  22332. class ScriptEvents
  22333. {
  22334. const PRE_INSTALL_CMD = 'pre-install-cmd';
  22335. const POST_INSTALL_CMD = 'post-install-cmd';
  22336. const PRE_UPDATE_CMD = 'pre-update-cmd';
  22337. const POST_UPDATE_CMD = 'post-update-cmd';
  22338. const PRE_STATUS_CMD = 'pre-status-cmd';
  22339. const POST_STATUS_CMD = 'post-status-cmd';
  22340. const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  22341. const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  22342. const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  22343. const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  22344. const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  22345. const POST_ARCHIVE_CMD = 'post-archive-cmd';
  22346. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  22347. const POST_PACKAGE_INSTALL = 'post-package-install';
  22348. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  22349. const POST_PACKAGE_UPDATE = 'post-package-update';
  22350. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  22351. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  22352. }
  22353. <?php
  22354. namespace Composer\SelfUpdate;
  22355. class Keys
  22356. {
  22357. public static function fingerprint($path)
  22358. {
  22359. $hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
  22360. return implode(' ', array(
  22361. substr($hash, 0, 8),
  22362. substr($hash, 8, 8),
  22363. substr($hash, 16, 8),
  22364. substr($hash, 24, 8),
  22365. '',
  22366. substr($hash, 32, 8),
  22367. substr($hash, 40, 8),
  22368. substr($hash, 48, 8),
  22369. substr($hash, 56, 8),
  22370. ));
  22371. }
  22372. }
  22373. <?php
  22374. namespace Composer\SelfUpdate;
  22375. use Composer\Util\RemoteFilesystem;
  22376. use Composer\Config;
  22377. use Composer\Json\JsonFile;
  22378. class Versions
  22379. {
  22380. private $rfs;
  22381. private $config;
  22382. private $channel;
  22383. public function __construct(Config $config, RemoteFilesystem $rfs)
  22384. {
  22385. $this->rfs = $rfs;
  22386. $this->config = $config;
  22387. }
  22388. public function getChannel()
  22389. {
  22390. if ($this->channel) {
  22391. return $this->channel;
  22392. }
  22393. $channelFile = $this->config->get('home').'/update-channel';
  22394. if (file_exists($channelFile)) {
  22395. $channel = trim(file_get_contents($channelFile));
  22396. if (in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  22397. return $this->channel = $channel;
  22398. }
  22399. }
  22400. return $this->channel = 'stable';
  22401. }
  22402. public function setChannel($channel)
  22403. {
  22404. if (!in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  22405. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: stable, preview, snapshot');
  22406. }
  22407. $channelFile = $this->config->get('home').'/update-channel';
  22408. $this->channel = $channel;
  22409. file_put_contents($channelFile, $channel.PHP_EOL);
  22410. }
  22411. public function getLatest()
  22412. {
  22413. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  22414. $versions = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
  22415. foreach ($versions[$this->getChannel()] as $version) {
  22416. if ($version['min-php'] <= PHP_VERSION_ID) {
  22417. return $version;
  22418. }
  22419. }
  22420. throw new \LogicException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  22421. }
  22422. }
  22423. <?php
  22424. namespace Composer\Util;
  22425. use Composer\Config;
  22426. use Composer\IO\IOInterface;
  22427. class AuthHelper
  22428. {
  22429. protected $io;
  22430. protected $config;
  22431. public function __construct(IOInterface $io, Config $config)
  22432. {
  22433. $this->io = $io;
  22434. $this->config = $config;
  22435. }
  22436. public function storeAuth($originUrl, $storeAuth)
  22437. {
  22438. $store = false;
  22439. $configSource = $this->config->getAuthConfigSource();
  22440. if ($storeAuth === true) {
  22441. $store = $configSource;
  22442. } elseif ($storeAuth === 'prompt') {
  22443. $answer = $this->io->askAndValidate(
  22444. 'Do you want to store credentials for '.$originUrl.' in '.$configSource->getName().' ? [Yn] ',
  22445. function ($value) {
  22446. $input = strtolower(substr(trim($value), 0, 1));
  22447. if (in_array($input, array('y','n'))) {
  22448. return $input;
  22449. }
  22450. throw new \RuntimeException('Please answer (y)es or (n)o');
  22451. },
  22452. null,
  22453. 'y'
  22454. );
  22455. if ($answer === 'y') {
  22456. $store = $configSource;
  22457. }
  22458. }
  22459. if ($store) {
  22460. $store->addConfigSetting(
  22461. 'http-basic.'.$originUrl,
  22462. $this->io->getAuthentication($originUrl)
  22463. );
  22464. }
  22465. }
  22466. }
  22467. <?php
  22468. namespace Composer\Util;
  22469. use Composer\Factory;
  22470. use Composer\IO\IOInterface;
  22471. use Composer\Config;
  22472. use Composer\Downloader\TransportException;
  22473. class Bitbucket
  22474. {
  22475. private $io;
  22476. private $config;
  22477. private $process;
  22478. private $remoteFilesystem;
  22479. private $token = array();
  22480. const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  22481. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  22482. {
  22483. $this->io = $io;
  22484. $this->config = $config;
  22485. $this->process = $process ?: new ProcessExecutor;
  22486. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  22487. }
  22488. public function getToken()
  22489. {
  22490. return $this->token;
  22491. }
  22492. public function authorizeOAuth($originUrl)
  22493. {
  22494. if ($originUrl !== 'bitbucket.org') {
  22495. return false;
  22496. }
  22497. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  22498. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  22499. return true;
  22500. }
  22501. return false;
  22502. }
  22503. private function requestAccessToken($originUrl)
  22504. {
  22505. try {
  22506. $json = $this->remoteFilesystem->getContents($originUrl, self::OAUTH2_ACCESS_TOKEN_URL, false, array(
  22507. 'retry-auth-failure' => false,
  22508. 'http' => array(
  22509. 'method' => 'POST',
  22510. 'content' => 'grant_type=client_credentials',
  22511. ),
  22512. ));
  22513. $this->token = json_decode($json, true);
  22514. } catch (TransportException $e) {
  22515. if ($e->getCode() === 400) {
  22516. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  22517. $this->io->writeError('This can have two reasons:');
  22518. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  22519. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  22520. return false;
  22521. } elseif (in_array($e->getCode(), array(403, 401))) {
  22522. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  22523. $this->io->writeError('You can also add it manually later by using "composer config bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  22524. return false;
  22525. }
  22526. throw $e;
  22527. }
  22528. }
  22529. public function authorizeOAuthInteractively($originUrl, $message = null)
  22530. {
  22531. if ($message) {
  22532. $this->io->writeError($message);
  22533. }
  22534. $url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html';
  22535. $this->io->writeError(sprintf('Follow the instructions on %s', $url));
  22536. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  22537. $this->io->writeError('Ensure you enter a "Callback URL" or it will not be possible to create an Access Token (this callback url will not be used by composer)');
  22538. $consumerKey = trim($this->io->askAndHideAnswer('Consumer Key (hidden): '));
  22539. if (!$consumerKey) {
  22540. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  22541. $this->io->writeError('You can also add it manually later by using "composer config bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  22542. return false;
  22543. }
  22544. $consumerSecret = trim($this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  22545. if (!$consumerSecret) {
  22546. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  22547. $this->io->writeError('You can also add it manually later by using "composer config bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  22548. return false;
  22549. }
  22550. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  22551. $this->requestAccessToken($originUrl);
  22552. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  22553. $consumer = array(
  22554. "consumer-key" => $consumerKey,
  22555. "consumer-secret" => $consumerSecret,
  22556. );
  22557. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  22558. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  22559. $this->io->writeError('<info>Consumer stored successfully.</info>');
  22560. return true;
  22561. }
  22562. public function requestToken($originUrl, $consumerKey, $consumerSecret)
  22563. {
  22564. if (!empty($this->token)) {
  22565. return $this->token;
  22566. }
  22567. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  22568. $this->requestAccessToken($originUrl);
  22569. return $this->token;
  22570. }
  22571. }
  22572. <?php
  22573. namespace Composer\Util;
  22574. class ComposerMirror
  22575. {
  22576. public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type)
  22577. {
  22578. if ($reference) {
  22579. $reference = preg_match('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  22580. }
  22581. $version = strpos($version, '/') === false ? $version : md5($version);
  22582. return str_replace(
  22583. array('%package%', '%version%', '%reference%', '%type%'),
  22584. array($packageName, $version, $reference, $type),
  22585. $mirrorUrl
  22586. );
  22587. }
  22588. public static function processGitUrl($mirrorUrl, $packageName, $url, $type)
  22589. {
  22590. if (preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  22591. $url = 'gh-'.$match[1].'/'.$match[2];
  22592. } elseif (preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  22593. $url = 'bb-'.$match[1].'/'.$match[2];
  22594. } else {
  22595. $url = preg_replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  22596. }
  22597. return str_replace(
  22598. array('%package%', '%normalizedUrl%', '%type%'),
  22599. array($packageName, $url, $type),
  22600. $mirrorUrl
  22601. );
  22602. }
  22603. public static function processHgUrl($mirrorUrl, $packageName, $url, $type)
  22604. {
  22605. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  22606. }
  22607. }
  22608. <?php
  22609. namespace Composer\Util;
  22610. use Composer\Package\Loader\ArrayLoader;
  22611. use Composer\Package\Loader\ValidatingArrayLoader;
  22612. use Composer\Package\Loader\InvalidPackageException;
  22613. use Composer\Json\JsonValidationException;
  22614. use Composer\IO\IOInterface;
  22615. use Composer\Json\JsonFile;
  22616. use Composer\Spdx\SpdxLicenses;
  22617. class ConfigValidator
  22618. {
  22619. private $io;
  22620. public function __construct(IOInterface $io)
  22621. {
  22622. $this->io = $io;
  22623. }
  22624. public function validate($file, $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL)
  22625. {
  22626. $errors = array();
  22627. $publishErrors = array();
  22628. $warnings = array();
  22629. $laxValid = false;
  22630. try {
  22631. $json = new JsonFile($file, null, $this->io);
  22632. $manifest = $json->read();
  22633. $json->validateSchema(JsonFile::LAX_SCHEMA);
  22634. $laxValid = true;
  22635. $json->validateSchema();
  22636. } catch (JsonValidationException $e) {
  22637. foreach ($e->getErrors() as $message) {
  22638. if ($laxValid) {
  22639. $publishErrors[] = $message;
  22640. } else {
  22641. $errors[] = $message;
  22642. }
  22643. }
  22644. } catch (\Exception $e) {
  22645. $errors[] = $e->getMessage();
  22646. return array($errors, $publishErrors, $warnings);
  22647. }
  22648. if (!empty($manifest['license'])) {
  22649. if (is_array($manifest['license'])) {
  22650. foreach ($manifest['license'] as $key => $license) {
  22651. if ('proprietary' === $license) {
  22652. unset($manifest['license'][$key]);
  22653. }
  22654. }
  22655. }
  22656. $licenseValidator = new SpdxLicenses();
  22657. if ('proprietary' !== $manifest['license'] && array() !== $manifest['license'] && !$licenseValidator->validate($manifest['license'])) {
  22658. $warnings[] = sprintf(
  22659. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.'
  22660. ."\nIf the software is closed-source, you may use \"proprietary\" as license.",
  22661. json_encode($manifest['license'])
  22662. );
  22663. }
  22664. } else {
  22665. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  22666. }
  22667. if (isset($manifest['version'])) {
  22668. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  22669. }
  22670. if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
  22671. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  22672. $suggestName = strtolower($suggestName);
  22673. $publishErrors[] = sprintf(
  22674. 'Name "%s" does not match the best practice (e.g. lower-cased/with-dashes). We suggest using "%s" instead. As such you will not be able to submit it to Packagist.',
  22675. $manifest['name'],
  22676. $suggestName
  22677. );
  22678. }
  22679. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  22680. $warnings[] = "The package type 'composer-installer' is deprecated. Please distribute your custom installers as plugins from now on. See https://getcomposer.org/doc/articles/plugins.md for plugin documentation.";
  22681. }
  22682. if (isset($manifest['require']) && isset($manifest['require-dev'])) {
  22683. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  22684. if (!empty($requireOverrides)) {
  22685. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  22686. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  22687. }
  22688. }
  22689. $require = isset($manifest['require']) ? $manifest['require'] : array();
  22690. $requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
  22691. $packages = array_merge($require, $requireDev);
  22692. foreach ($packages as $package => $version) {
  22693. if (preg_match('/#/', $version) === 1) {
  22694. $warnings[] = sprintf(
  22695. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  22696. $package
  22697. );
  22698. }
  22699. }
  22700. if (isset($manifest['autoload']['psr-0'][''])) {
  22701. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  22702. }
  22703. if (isset($manifest['autoload']['psr-4'][''])) {
  22704. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  22705. }
  22706. try {
  22707. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  22708. if (!isset($manifest['version'])) {
  22709. $manifest['version'] = '1.0.0';
  22710. }
  22711. if (!isset($manifest['name'])) {
  22712. $manifest['name'] = 'dummy/dummy';
  22713. }
  22714. $loader->load($manifest);
  22715. } catch (InvalidPackageException $e) {
  22716. $errors = array_merge($errors, $e->getErrors());
  22717. }
  22718. $warnings = array_merge($warnings, $loader->getWarnings());
  22719. return array($errors, $publishErrors, $warnings);
  22720. }
  22721. }
  22722. <?php
  22723. namespace Composer\Util;
  22724. use Composer\IO\IOInterface;
  22725. class ErrorHandler
  22726. {
  22727. private static $io;
  22728. public static function handle($level, $message, $file, $line)
  22729. {
  22730. if (!(error_reporting() & $level)) {
  22731. return;
  22732. }
  22733. if (ini_get('xdebug.scream')) {
  22734. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  22735. "\na legitimately suppressed error that you were not supposed to see.";
  22736. }
  22737. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  22738. throw new \ErrorException($message, 0, $level, $file, $line);
  22739. }
  22740. if (self::$io) {
  22741. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  22742. if (self::$io->isVerbose()) {
  22743. self::$io->writeError('<warning>Stack trace:</warning>');
  22744. self::$io->writeError(array_filter(array_map(function ($a) {
  22745. if (isset($a['line'], $a['file'])) {
  22746. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  22747. }
  22748. return null;
  22749. }, array_slice(debug_backtrace(), 2))));
  22750. }
  22751. }
  22752. }
  22753. public static function register(IOInterface $io = null)
  22754. {
  22755. set_error_handler(array(__CLASS__, 'handle'));
  22756. error_reporting(E_ALL | E_STRICT);
  22757. self::$io = $io;
  22758. }
  22759. }
  22760. <?php
  22761. namespace Composer\Util;
  22762. use RecursiveDirectoryIterator;
  22763. use RecursiveIteratorIterator;
  22764. use Symfony\Component\Filesystem\Exception\IOException;
  22765. use Symfony\Component\Finder\Finder;
  22766. class Filesystem
  22767. {
  22768. private $processExecutor;
  22769. public function __construct(ProcessExecutor $executor = null)
  22770. {
  22771. $this->processExecutor = $executor ?: new ProcessExecutor();
  22772. }
  22773. public function remove($file)
  22774. {
  22775. if (is_dir($file)) {
  22776. return $this->removeDirectory($file);
  22777. }
  22778. if (file_exists($file)) {
  22779. return $this->unlink($file);
  22780. }
  22781. return false;
  22782. }
  22783. public function isDirEmpty($dir)
  22784. {
  22785. $finder = Finder::create()
  22786. ->ignoreVCS(false)
  22787. ->ignoreDotFiles(false)
  22788. ->depth(0)
  22789. ->in($dir);
  22790. return count($finder) === 0;
  22791. }
  22792. public function emptyDirectory($dir, $ensureDirectoryExists = true)
  22793. {
  22794. if (file_exists($dir) && is_link($dir)) {
  22795. $this->unlink($dir);
  22796. }
  22797. if ($ensureDirectoryExists) {
  22798. $this->ensureDirectoryExists($dir);
  22799. }
  22800. if (is_dir($dir)) {
  22801. $finder = Finder::create()
  22802. ->ignoreVCS(false)
  22803. ->ignoreDotFiles(false)
  22804. ->depth(0)
  22805. ->in($dir);
  22806. foreach ($finder as $path) {
  22807. $this->remove((string) $path);
  22808. }
  22809. }
  22810. }
  22811. public function removeDirectory($directory)
  22812. {
  22813. if ($this->isSymlinkedDirectory($directory)) {
  22814. return $this->unlinkSymlinkedDirectory($directory);
  22815. }
  22816. if ($this->isJunction($directory)) {
  22817. return $this->removeJunction($directory);
  22818. }
  22819. if (!file_exists($directory) || !is_dir($directory)) {
  22820. return true;
  22821. }
  22822. if (preg_match('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  22823. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  22824. }
  22825. if (!function_exists('proc_open')) {
  22826. return $this->removeDirectoryPhp($directory);
  22827. }
  22828. if (Platform::isWindows()) {
  22829. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  22830. } else {
  22831. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  22832. }
  22833. $result = $this->getProcess()->execute($cmd, $output) === 0;
  22834. clearstatcache();
  22835. if ($result && !file_exists($directory)) {
  22836. return true;
  22837. }
  22838. return $this->removeDirectoryPhp($directory);
  22839. }
  22840. public function removeDirectoryPhp($directory)
  22841. {
  22842. try {
  22843. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  22844. } catch (\UnexpectedValueException $e) {
  22845. clearstatcache();
  22846. usleep(100000);
  22847. if (!is_dir($directory)) {
  22848. return true;
  22849. }
  22850. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  22851. }
  22852. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  22853. foreach ($ri as $file) {
  22854. if ($file->isDir()) {
  22855. $this->rmdir($file->getPathname());
  22856. } else {
  22857. $this->unlink($file->getPathname());
  22858. }
  22859. }
  22860. return $this->rmdir($directory);
  22861. }
  22862. public function ensureDirectoryExists($directory)
  22863. {
  22864. if (!is_dir($directory)) {
  22865. if (file_exists($directory)) {
  22866. throw new \RuntimeException(
  22867. $directory.' exists and is not a directory.'
  22868. );
  22869. }
  22870. if (!@mkdir($directory, 0777, true)) {
  22871. throw new \RuntimeException(
  22872. $directory.' does not exist and could not be created.'
  22873. );
  22874. }
  22875. }
  22876. }
  22877. public function unlink($path)
  22878. {
  22879. if (!@$this->unlinkImplementation($path)) {
  22880. if (!Platform::isWindows() || (usleep(350000) && !@$this->unlinkImplementation($path))) {
  22881. $error = error_get_last();
  22882. $message = 'Could not delete '.$path.': ' . @$error['message'];
  22883. if (Platform::isWindows()) {
  22884. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  22885. }
  22886. throw new \RuntimeException($message);
  22887. }
  22888. }
  22889. return true;
  22890. }
  22891. public function rmdir($path)
  22892. {
  22893. if (!@rmdir($path)) {
  22894. if (!Platform::isWindows() || (usleep(350000) && !@rmdir($path))) {
  22895. $error = error_get_last();
  22896. $message = 'Could not delete '.$path.': ' . @$error['message'];
  22897. if (Platform::isWindows()) {
  22898. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  22899. }
  22900. throw new \RuntimeException($message);
  22901. }
  22902. }
  22903. return true;
  22904. }
  22905. public function copyThenRemove($source, $target)
  22906. {
  22907. if (!is_dir($source)) {
  22908. copy($source, $target);
  22909. $this->unlink($source);
  22910. return;
  22911. }
  22912. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  22913. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  22914. $this->ensureDirectoryExists($target);
  22915. foreach ($ri as $file) {
  22916. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
  22917. if ($file->isDir()) {
  22918. $this->ensureDirectoryExists($targetPath);
  22919. } else {
  22920. copy($file->getPathname(), $targetPath);
  22921. }
  22922. }
  22923. $this->removeDirectoryPhp($source);
  22924. }
  22925. public function rename($source, $target)
  22926. {
  22927. if (true === @rename($source, $target)) {
  22928. return;
  22929. }
  22930. if (!function_exists('proc_open')) {
  22931. return $this->copyThenRemove($source, $target);
  22932. }
  22933. if (Platform::isWindows()) {
  22934. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  22935. $result = $this->processExecutor->execute($command, $output);
  22936. clearstatcache();
  22937. if (0 === $result) {
  22938. $this->remove($source);
  22939. return;
  22940. }
  22941. } else {
  22942. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  22943. $result = $this->processExecutor->execute($command, $output);
  22944. clearstatcache();
  22945. if (0 === $result) {
  22946. return;
  22947. }
  22948. }
  22949. return $this->copyThenRemove($source, $target);
  22950. }
  22951. public function findShortestPath($from, $to, $directories = false)
  22952. {
  22953. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  22954. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  22955. }
  22956. $from = lcfirst($this->normalizePath($from));
  22957. $to = lcfirst($this->normalizePath($to));
  22958. if ($directories) {
  22959. $from = rtrim($from, '/') . '/dummy_file';
  22960. }
  22961. if (dirname($from) === dirname($to)) {
  22962. return './'.basename($to);
  22963. }
  22964. $commonPath = $to;
  22965. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
  22966. $commonPath = strtr(dirname($commonPath), '\\', '/');
  22967. }
  22968. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  22969. return $to;
  22970. }
  22971. $commonPath = rtrim($commonPath, '/') . '/';
  22972. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
  22973. $commonPathCode = str_repeat('../', $sourcePathDepth);
  22974. return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
  22975. }
  22976. public function findShortestPathCode($from, $to, $directories = false, $staticCode = false)
  22977. {
  22978. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  22979. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  22980. }
  22981. $from = lcfirst($this->normalizePath($from));
  22982. $to = lcfirst($this->normalizePath($to));
  22983. if ($from === $to) {
  22984. return $directories ? '__DIR__' : '__FILE__';
  22985. }
  22986. $commonPath = $to;
  22987. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  22988. $commonPath = strtr(dirname($commonPath), '\\', '/');
  22989. }
  22990. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  22991. return var_export($to, true);
  22992. }
  22993. $commonPath = rtrim($commonPath, '/') . '/';
  22994. if (strpos($to, $from.'/') === 0) {
  22995. return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
  22996. }
  22997. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
  22998. if ($staticCode) {
  22999. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  23000. } else {
  23001. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  23002. }
  23003. $relTarget = substr($to, strlen($commonPath));
  23004. return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
  23005. }
  23006. public function isAbsolutePath($path)
  23007. {
  23008. return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':';
  23009. }
  23010. public function size($path)
  23011. {
  23012. if (!file_exists($path)) {
  23013. throw new \RuntimeException("$path does not exist.");
  23014. }
  23015. if (is_dir($path)) {
  23016. return $this->directorySize($path);
  23017. }
  23018. return filesize($path);
  23019. }
  23020. public function normalizePath($path)
  23021. {
  23022. $parts = array();
  23023. $path = strtr($path, '\\', '/');
  23024. $prefix = '';
  23025. $absolute = false;
  23026. if (preg_match('{^([0-9a-z]+:(?://(?:[a-z]:)?)?)}i', $path, $match)) {
  23027. $prefix = $match[1];
  23028. $path = substr($path, strlen($prefix));
  23029. }
  23030. if (substr($path, 0, 1) === '/') {
  23031. $absolute = true;
  23032. $path = substr($path, 1);
  23033. }
  23034. $up = false;
  23035. foreach (explode('/', $path) as $chunk) {
  23036. if ('..' === $chunk && ($absolute || $up)) {
  23037. array_pop($parts);
  23038. $up = !(empty($parts) || '..' === end($parts));
  23039. } elseif ('.' !== $chunk && '' !== $chunk) {
  23040. $parts[] = $chunk;
  23041. $up = '..' !== $chunk;
  23042. }
  23043. }
  23044. return $prefix.($absolute ? '/' : '').implode('/', $parts);
  23045. }
  23046. public static function isLocalPath($path)
  23047. {
  23048. return (bool) preg_match('{^(file://|/|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  23049. }
  23050. public static function getPlatformPath($path)
  23051. {
  23052. if (Platform::isWindows()) {
  23053. $path = preg_replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  23054. }
  23055. return preg_replace('{^file://}i', '', $path);
  23056. }
  23057. protected function directorySize($directory)
  23058. {
  23059. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  23060. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  23061. $size = 0;
  23062. foreach ($ri as $file) {
  23063. if ($file->isFile()) {
  23064. $size += $file->getSize();
  23065. }
  23066. }
  23067. return $size;
  23068. }
  23069. protected function getProcess()
  23070. {
  23071. return new ProcessExecutor;
  23072. }
  23073. private function unlinkImplementation($path)
  23074. {
  23075. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  23076. return rmdir($path);
  23077. }
  23078. return unlink($path);
  23079. }
  23080. public function relativeSymlink($target, $link)
  23081. {
  23082. $cwd = getcwd();
  23083. $relativePath = $this->findShortestPath($link, $target);
  23084. chdir(dirname($link));
  23085. $result = @symlink($relativePath, $link);
  23086. chdir($cwd);
  23087. return (bool) $result;
  23088. }
  23089. public function isSymlinkedDirectory($directory)
  23090. {
  23091. if (!is_dir($directory)) {
  23092. return false;
  23093. }
  23094. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  23095. return is_link($resolved);
  23096. }
  23097. private function unlinkSymlinkedDirectory($directory)
  23098. {
  23099. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  23100. return $this->unlink($resolved);
  23101. }
  23102. private function resolveSymlinkedDirectorySymlink($pathname)
  23103. {
  23104. if (!is_dir($pathname)) {
  23105. return $pathname;
  23106. }
  23107. $resolved = rtrim($pathname, '/');
  23108. if (!strlen($resolved)) {
  23109. return $pathname;
  23110. }
  23111. return $resolved;
  23112. }
  23113. public function junction($target, $junction)
  23114. {
  23115. if (!Platform::isWindows()) {
  23116. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  23117. }
  23118. if (!is_dir($target)) {
  23119. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  23120. }
  23121. $cmd = sprintf('mklink /J %s %s',
  23122. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  23123. ProcessExecutor::escape(realpath($target)));
  23124. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  23125. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  23126. }
  23127. clearstatcache(true, $junction);
  23128. }
  23129. public function isJunction($junction)
  23130. {
  23131. if (!Platform::isWindows()) {
  23132. return false;
  23133. }
  23134. if (!is_dir($junction) || is_link($junction)) {
  23135. return false;
  23136. }
  23137. clearstatcache(true, $junction);
  23138. $stat = lstat($junction);
  23139. return !($stat['mode'] & 0xC000);
  23140. }
  23141. public function removeJunction($junction)
  23142. {
  23143. if (!Platform::isWindows()) {
  23144. return false;
  23145. }
  23146. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  23147. if (!$this->isJunction($junction)) {
  23148. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  23149. }
  23150. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape($junction));
  23151. clearstatcache(true, $junction);
  23152. return ($this->getProcess()->execute($cmd, $output) === 0);
  23153. }
  23154. }
  23155. <?php
  23156. namespace Composer\Util;
  23157. use Composer\Config;
  23158. use Composer\IO\IOInterface;
  23159. class Git
  23160. {
  23161. private static $version;
  23162. protected $io;
  23163. protected $config;
  23164. protected $process;
  23165. protected $filesystem;
  23166. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  23167. {
  23168. $this->io = $io;
  23169. $this->config = $config;
  23170. $this->process = $process;
  23171. $this->filesystem = $fs;
  23172. }
  23173. public function runCommand($commandCallable, $url, $cwd, $initialClone = false)
  23174. {
  23175. $this->config->prohibitUrlByConfig($url, $this->io);
  23176. if ($initialClone) {
  23177. $origCwd = $cwd;
  23178. $cwd = null;
  23179. }
  23180. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  23181. throw new \InvalidArgumentException('The source URL '.$url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  23182. }
  23183. if (!$initialClone) {
  23184. $this->process->execute('git remote -v', $output, $cwd);
  23185. if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match)) {
  23186. $this->io->setAuthentication($match[3], urldecode($match[1]), urldecode($match[2]));
  23187. }
  23188. }
  23189. $protocols = $this->config->get('github-protocols');
  23190. if (!is_array($protocols)) {
  23191. throw new \RuntimeException('Config value "github-protocols" must be an array, got '.gettype($protocols));
  23192. }
  23193. if (preg_match('{^(?:https?|git)://'.self::getGitHubDomainsRegex($this->config).'/(.*)}', $url, $match)) {
  23194. $messages = array();
  23195. foreach ($protocols as $protocol) {
  23196. if ('ssh' === $protocol) {
  23197. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  23198. } else {
  23199. $protoUrl = $protocol ."://" . $match[1] . "/" . $match[2];
  23200. }
  23201. if (0 === $this->process->execute(call_user_func($commandCallable, $protoUrl), $ignoredOutput, $cwd)) {
  23202. return;
  23203. }
  23204. $messages[] = '- ' . $protoUrl . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
  23205. if ($initialClone) {
  23206. $this->filesystem->removeDirectory($origCwd);
  23207. }
  23208. }
  23209. $this->throwException('Failed to clone ' . $url .' via '.implode(', ', $protocols).' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  23210. }
  23211. $bypassSshForGitHub = preg_match('{^git@'.self::getGitHubDomainsRegex($this->config).':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  23212. $command = call_user_func($commandCallable, $url);
  23213. $auth = null;
  23214. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  23215. if (preg_match('{^git@'.self::getGitHubDomainsRegex($this->config).':(.+?)\.git$}i', $url, $match)) {
  23216. if (!$this->io->hasAuthentication($match[1])) {
  23217. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  23218. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  23219. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  23220. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  23221. }
  23222. }
  23223. if ($this->io->hasAuthentication($match[1])) {
  23224. $auth = $this->io->getAuthentication($match[1]);
  23225. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  23226. $command = call_user_func($commandCallable, $authUrl);
  23227. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  23228. return;
  23229. }
  23230. }
  23231. } elseif (preg_match('{^https://(bitbucket\.org)/(.*)(\.git)?$}U', $url, $match)) {
  23232. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  23233. if (!$this->io->hasAuthentication($match[1])) {
  23234. $message = 'Enter your Bitbucket credentials to access private repos';
  23235. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  23236. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  23237. $token = $bitbucketUtil->getToken();
  23238. $this->io->setAuthentication($match[1], 'x-token-auth', $token['access_token']);
  23239. }
  23240. } else {
  23241. $auth = $this->io->getAuthentication($match[1]);
  23242. if ($auth['username'] !== 'x-token-auth') {
  23243. $token = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  23244. if (! empty($token)) {
  23245. $this->io->setAuthentication($match[1], 'x-token-auth', $token['access_token']);
  23246. }
  23247. }
  23248. }
  23249. if ($this->io->hasAuthentication($match[1])) {
  23250. $auth = $this->io->getAuthentication($match[1]);
  23251. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  23252. $command = call_user_func($commandCallable, $authUrl);
  23253. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  23254. return;
  23255. }
  23256. } else {
  23257. $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
  23258. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  23259. $command = call_user_func($commandCallable, $sshUrl);
  23260. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  23261. return;
  23262. }
  23263. }
  23264. } elseif ($this->isAuthenticationFailure($url, $match)) {
  23265. if (strpos($match[2], '@')) {
  23266. list($authParts, $match[2]) = explode('@', $match[2], 2);
  23267. }
  23268. $storeAuth = false;
  23269. if ($this->io->hasAuthentication($match[2])) {
  23270. $auth = $this->io->getAuthentication($match[2]);
  23271. } elseif ($this->io->isInteractive()) {
  23272. $defaultUsername = null;
  23273. if (isset($authParts) && $authParts) {
  23274. if (false !== strpos($authParts, ':')) {
  23275. list($defaultUsername, ) = explode(':', $authParts, 2);
  23276. } else {
  23277. $defaultUsername = $authParts;
  23278. }
  23279. }
  23280. $this->io->writeError(' Authentication required (<info>'.parse_url($url, PHP_URL_HOST).'</info>):');
  23281. $auth = array(
  23282. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  23283. 'password' => $this->io->askAndHideAnswer(' Password: '),
  23284. );
  23285. $storeAuth = $this->config->get('store-auths');
  23286. }
  23287. if ($auth) {
  23288. $authUrl = $match[1].rawurlencode($auth['username']).':'.rawurlencode($auth['password']).'@'.$match[2].$match[3];
  23289. $command = call_user_func($commandCallable, $authUrl);
  23290. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  23291. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  23292. $authHelper = new AuthHelper($this->io, $this->config);
  23293. $authHelper->storeAuth($match[2], $storeAuth);
  23294. return;
  23295. }
  23296. }
  23297. }
  23298. if ($initialClone) {
  23299. $this->filesystem->removeDirectory($origCwd);
  23300. }
  23301. $this->throwException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput(), $url);
  23302. }
  23303. }
  23304. public function syncMirror($url, $dir)
  23305. {
  23306. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  23307. try {
  23308. $commandCallable = function ($url) {
  23309. return sprintf('git remote set-url origin %s && git remote update --prune origin', ProcessExecutor::escape($url));
  23310. };
  23311. $this->runCommand($commandCallable, $url, $dir);
  23312. } catch (\Exception $e) {
  23313. return false;
  23314. }
  23315. return true;
  23316. }
  23317. $this->filesystem->removeDirectory($dir);
  23318. $commandCallable = function ($url) use ($dir) {
  23319. return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  23320. };
  23321. $this->runCommand($commandCallable, $url, $dir, true);
  23322. return true;
  23323. }
  23324. private function isAuthenticationFailure($url, &$match)
  23325. {
  23326. if (!preg_match('{(https?://)([^/]+)(.*)$}i', $url, $match)) {
  23327. return false;
  23328. }
  23329. $authFailures = array(
  23330. 'fatal: Authentication failed',
  23331. 'remote error: Invalid username or password.',
  23332. 'error: 401 Unauthorized'
  23333. );
  23334. foreach ($authFailures as $authFailure) {
  23335. if (strpos($this->process->getErrorOutput(), $authFailure) !== false) {
  23336. return true;
  23337. }
  23338. }
  23339. return false;
  23340. }
  23341. public static function cleanEnv()
  23342. {
  23343. if (ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
  23344. throw new \RuntimeException('safe_mode is enabled and safe_mode_allowed_env_vars does not contain GIT_ASKPASS, can not set env var. You can disable safe_mode with "-dsafe_mode=0" when running composer');
  23345. }
  23346. if (getenv('GIT_ASKPASS') !== 'echo') {
  23347. putenv('GIT_ASKPASS=echo');
  23348. unset($_SERVER['GIT_ASKPASS']);
  23349. }
  23350. if (getenv('GIT_DIR')) {
  23351. putenv('GIT_DIR');
  23352. unset($_SERVER['GIT_DIR']);
  23353. }
  23354. if (getenv('GIT_WORK_TREE')) {
  23355. putenv('GIT_WORK_TREE');
  23356. unset($_SERVER['GIT_WORK_TREE']);
  23357. }
  23358. if (getenv('LANGUAGE') !== 'C') {
  23359. putenv('LANGUAGE=C');
  23360. }
  23361. putenv("DYLD_LIBRARY_PATH");
  23362. unset($_SERVER['DYLD_LIBRARY_PATH']);
  23363. }
  23364. public static function getGitHubDomainsRegex(Config $config)
  23365. {
  23366. return '('.implode('|', array_map('preg_quote', $config->get('github-domains'))).')';
  23367. }
  23368. public static function sanitizeUrl($message)
  23369. {
  23370. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  23371. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  23372. return '://***:***@';
  23373. }
  23374. return '://'.$m[1].':***@';
  23375. }, $message);
  23376. }
  23377. private function throwException($message, $url)
  23378. {
  23379. clearstatcache();
  23380. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  23381. throw new \RuntimeException(self::sanitizeUrl('Failed to clone '.$url.', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  23382. }
  23383. throw new \RuntimeException(self::sanitizeUrl($message));
  23384. }
  23385. public function getVersion()
  23386. {
  23387. if (isset(self::$version)) {
  23388. return self::$version;
  23389. }
  23390. if (0 !== $this->process->execute('git --version', $output)) {
  23391. return;
  23392. }
  23393. if (preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  23394. return self::$version = $matches[1];
  23395. }
  23396. }
  23397. }
  23398. <?php
  23399. namespace Composer\Util;
  23400. use Composer\Factory;
  23401. use Composer\IO\IOInterface;
  23402. use Composer\Config;
  23403. use Composer\Downloader\TransportException;
  23404. class GitHub
  23405. {
  23406. protected $io;
  23407. protected $config;
  23408. protected $process;
  23409. protected $remoteFilesystem;
  23410. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  23411. {
  23412. $this->io = $io;
  23413. $this->config = $config;
  23414. $this->process = $process ?: new ProcessExecutor;
  23415. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  23416. }
  23417. public function authorizeOAuth($originUrl)
  23418. {
  23419. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  23420. return false;
  23421. }
  23422. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  23423. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  23424. return true;
  23425. }
  23426. return false;
  23427. }
  23428. public function authorizeOAuthInteractively($originUrl, $message = null)
  23429. {
  23430. if ($message) {
  23431. $this->io->writeError($message);
  23432. }
  23433. $note = 'Composer';
  23434. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  23435. $note .= ' on ' . trim($output);
  23436. }
  23437. $note .= ' ' . date('Y-m-d Hi');
  23438. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  23439. $this->io->writeError(sprintf('Head to %s', $url));
  23440. $this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  23441. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  23442. if (!$token) {
  23443. $this->io->writeError('<warning>No token given, aborting.</warning>');
  23444. $this->io->writeError('You can also add it manually later by using "composer config github-oauth.github.com <token>"');
  23445. return false;
  23446. }
  23447. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  23448. try {
  23449. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  23450. $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
  23451. 'retry-auth-failure' => false,
  23452. ));
  23453. } catch (TransportException $e) {
  23454. if (in_array($e->getCode(), array(403, 401))) {
  23455. $this->io->writeError('<error>Invalid token provided.</error>');
  23456. $this->io->writeError('You can also add it manually later by using "composer config github-oauth.github.com <token>"');
  23457. return false;
  23458. }
  23459. throw $e;
  23460. }
  23461. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  23462. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  23463. $this->io->writeError('<info>Token stored successfully.</info>');
  23464. return true;
  23465. }
  23466. }
  23467. <?php
  23468. namespace Composer\Util;
  23469. use Composer\IO\IOInterface;
  23470. use Composer\Config;
  23471. use Composer\Factory;
  23472. use Composer\Downloader\TransportException;
  23473. use Composer\Json\JsonFile;
  23474. class GitLab
  23475. {
  23476. protected $io;
  23477. protected $config;
  23478. protected $process;
  23479. protected $remoteFilesystem;
  23480. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  23481. {
  23482. $this->io = $io;
  23483. $this->config = $config;
  23484. $this->process = $process ?: new ProcessExecutor();
  23485. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  23486. }
  23487. public function authorizeOAuth($originUrl)
  23488. {
  23489. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  23490. return false;
  23491. }
  23492. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  23493. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  23494. return true;
  23495. }
  23496. return false;
  23497. }
  23498. public function authorizeOAuthInteractively($scheme, $originUrl, $message = null)
  23499. {
  23500. if ($message) {
  23501. $this->io->writeError($message);
  23502. }
  23503. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  23504. $this->io->writeError('To revoke access to this token you can visit '.$originUrl.'/profile/applications');
  23505. $attemptCounter = 0;
  23506. while ($attemptCounter++ < 5) {
  23507. try {
  23508. $response = $this->createToken($scheme, $originUrl);
  23509. } catch (TransportException $e) {
  23510. if (in_array($e->getCode(), array(403, 401))) {
  23511. if (401 === $e->getCode()) {
  23512. $this->io->writeError('Bad credentials.');
  23513. } else {
  23514. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  23515. }
  23516. $this->io->writeError('You can also manually create a personal token at '.$scheme.'://'.$originUrl.'/profile/applications');
  23517. $this->io->writeError('Add it using "composer config gitlab-oauth.'.$originUrl.' <token>"');
  23518. continue;
  23519. }
  23520. throw $e;
  23521. }
  23522. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  23523. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  23524. return true;
  23525. }
  23526. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  23527. }
  23528. private function createToken($scheme, $originUrl)
  23529. {
  23530. $username = $this->io->ask('Username: ');
  23531. $password = $this->io->askAndHideAnswer('Password: ');
  23532. $headers = array('Content-Type: application/x-www-form-urlencoded');
  23533. $apiUrl = $originUrl;
  23534. $data = http_build_query(array(
  23535. 'username' => $username,
  23536. 'password' => $password,
  23537. 'grant_type' => 'password',
  23538. ));
  23539. $options = array(
  23540. 'retry-auth-failure' => false,
  23541. 'http' => array(
  23542. 'method' => 'POST',
  23543. 'header' => $headers,
  23544. 'content' => $data,
  23545. ),
  23546. );
  23547. $json = $this->remoteFilesystem->getContents($originUrl, $scheme.'://'.$apiUrl.'/oauth/token', false, $options);
  23548. $this->io->writeError('Token successfully created');
  23549. return JsonFile::parseJson($json);
  23550. }
  23551. }
  23552. <?php
  23553. namespace Composer\Util;
  23554. class NoProxyPattern
  23555. {
  23556. protected $rules = array();
  23557. public function __construct($pattern)
  23558. {
  23559. $this->rules = preg_split("/[\s,]+/", $pattern);
  23560. }
  23561. public function test($url)
  23562. {
  23563. $host = parse_url($url, PHP_URL_HOST);
  23564. $port = parse_url($url, PHP_URL_PORT);
  23565. if (empty($port)) {
  23566. switch (parse_url($url, PHP_URL_SCHEME)) {
  23567. case 'http':
  23568. $port = 80;
  23569. break;
  23570. case 'https':
  23571. $port = 443;
  23572. break;
  23573. }
  23574. }
  23575. foreach ($this->rules as $rule) {
  23576. if ($rule == '*') {
  23577. return true;
  23578. }
  23579. $match = false;
  23580. list($ruleHost) = explode(':', $rule);
  23581. list($base) = explode('/', $ruleHost);
  23582. if (filter_var($base, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
  23583. if (!isset($ip)) {
  23584. $ip = gethostbyname($host);
  23585. }
  23586. if (strpos($ruleHost, '/') === false) {
  23587. $match = $ip === $ruleHost;
  23588. } else {
  23589. if ($ip === $host) {
  23590. $match = false;
  23591. } else {
  23592. $match = self::inCIDRBlock($ruleHost, $ip);
  23593. }
  23594. }
  23595. } else {
  23596. $haystack = '.' . trim($host, '.') . '.';
  23597. $needle = '.'. trim($ruleHost, '.') .'.';
  23598. $match = stripos(strrev($haystack), strrev($needle)) === 0;
  23599. }
  23600. if ($match && strpos($rule, ':') !== false) {
  23601. list(, $rulePort) = explode(':', $rule);
  23602. if (!empty($rulePort) && $port != $rulePort) {
  23603. $match = false;
  23604. }
  23605. }
  23606. if ($match) {
  23607. return true;
  23608. }
  23609. }
  23610. return false;
  23611. }
  23612. private static function inCIDRBlock($cidr, $ip)
  23613. {
  23614. list($base, $bits) = explode('/', $cidr);
  23615. list($a, $b, $c, $d) = explode('.', $base);
  23616. $i = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  23617. $mask = $bits == 0 ? 0 : (~0 << (32 - $bits));
  23618. $low = $i & $mask;
  23619. $high = $i | (~$mask & 0xFFFFFFFF);
  23620. list($a, $b, $c, $d) = explode('.', $ip);
  23621. $check = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  23622. return $check >= $low && $check <= $high;
  23623. }
  23624. }
  23625. <?php
  23626. namespace Composer\Util;
  23627. use Composer\IO\IOInterface;
  23628. use Symfony\Component\Process\Process;
  23629. class Perforce
  23630. {
  23631. protected $path;
  23632. protected $p4Depot;
  23633. protected $p4Client;
  23634. protected $p4User;
  23635. protected $p4Password;
  23636. protected $p4Port;
  23637. protected $p4Stream;
  23638. protected $p4ClientSpec;
  23639. protected $p4DepotType;
  23640. protected $p4Branch;
  23641. protected $process;
  23642. protected $uniquePerforceClientName;
  23643. protected $windowsFlag;
  23644. protected $commandResult;
  23645. protected $io;
  23646. protected $filesystem;
  23647. public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)
  23648. {
  23649. $this->windowsFlag = $isWindows;
  23650. $this->p4Port = $port;
  23651. $this->initializePath($path);
  23652. $this->process = $process;
  23653. $this->initialize($repoConfig);
  23654. $this->io = $io;
  23655. }
  23656. public static function create($repoConfig, $port, $path, ProcessExecutor $process, IOInterface $io)
  23657. {
  23658. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  23659. }
  23660. public static function checkServerExists($url, ProcessExecutor $processExecutor)
  23661. {
  23662. $output = null;
  23663. return 0 === $processExecutor->execute('p4 -p ' . $url . ' info -s', $output);
  23664. }
  23665. public function initialize($repoConfig)
  23666. {
  23667. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  23668. if (!$repoConfig) {
  23669. return;
  23670. }
  23671. if (isset($repoConfig['unique_perforce_client_name'])) {
  23672. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  23673. }
  23674. if (isset($repoConfig['depot'])) {
  23675. $this->p4Depot = $repoConfig['depot'];
  23676. }
  23677. if (isset($repoConfig['branch'])) {
  23678. $this->p4Branch = $repoConfig['branch'];
  23679. }
  23680. if (isset($repoConfig['p4user'])) {
  23681. $this->p4User = $repoConfig['p4user'];
  23682. } else {
  23683. $this->p4User = $this->getP4variable('P4USER');
  23684. }
  23685. if (isset($repoConfig['p4password'])) {
  23686. $this->p4Password = $repoConfig['p4password'];
  23687. }
  23688. }
  23689. public function initializeDepotAndBranch($depot, $branch)
  23690. {
  23691. if (isset($depot)) {
  23692. $this->p4Depot = $depot;
  23693. }
  23694. if (isset($branch)) {
  23695. $this->p4Branch = $branch;
  23696. }
  23697. }
  23698. public function generateUniquePerforceClientName()
  23699. {
  23700. return gethostname() . "_" . time();
  23701. }
  23702. public function cleanupClientSpec()
  23703. {
  23704. $client = $this->getClient();
  23705. $task = 'client -d ' . $client;
  23706. $useP4Client = false;
  23707. $command = $this->generateP4Command($task, $useP4Client);
  23708. $this->executeCommand($command);
  23709. $clientSpec = $this->getP4ClientSpec();
  23710. $fileSystem = $this->getFilesystem();
  23711. $fileSystem->remove($clientSpec);
  23712. }
  23713. protected function executeCommand($command)
  23714. {
  23715. $this->commandResult = "";
  23716. $exit_code = $this->process->execute($command, $this->commandResult);
  23717. return $exit_code;
  23718. }
  23719. public function getClient()
  23720. {
  23721. if (!isset($this->p4Client)) {
  23722. $cleanStreamName = str_replace('@', '', str_replace('/', '_', str_replace('//', '', $this->getStream())));
  23723. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  23724. }
  23725. return $this->p4Client;
  23726. }
  23727. protected function getPath()
  23728. {
  23729. return $this->path;
  23730. }
  23731. public function initializePath($path)
  23732. {
  23733. $this->path = $path;
  23734. $fs = $this->getFilesystem();
  23735. $fs->ensureDirectoryExists($path);
  23736. }
  23737. protected function getPort()
  23738. {
  23739. return $this->p4Port;
  23740. }
  23741. public function setStream($stream)
  23742. {
  23743. $this->p4Stream = $stream;
  23744. $index = strrpos($stream, '/');
  23745. if ($index > 2) {
  23746. $this->p4DepotType = 'stream';
  23747. }
  23748. }
  23749. public function isStream()
  23750. {
  23751. return (strcmp($this->p4DepotType, 'stream') === 0);
  23752. }
  23753. public function getStream()
  23754. {
  23755. if (!isset($this->p4Stream)) {
  23756. if ($this->isStream()) {
  23757. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  23758. } else {
  23759. $this->p4Stream = '//' . $this->p4Depot;
  23760. }
  23761. }
  23762. return $this->p4Stream;
  23763. }
  23764. public function getStreamWithoutLabel($stream)
  23765. {
  23766. $index = strpos($stream, '@');
  23767. if ($index === false) {
  23768. return $stream;
  23769. }
  23770. return substr($stream, 0, $index);
  23771. }
  23772. public function getP4ClientSpec()
  23773. {
  23774. $p4clientSpec = $this->path . '/' . $this->getClient() . '.p4.spec';
  23775. return $p4clientSpec;
  23776. }
  23777. public function getUser()
  23778. {
  23779. return $this->p4User;
  23780. }
  23781. public function setUser($user)
  23782. {
  23783. $this->p4User = $user;
  23784. }
  23785. public function queryP4User()
  23786. {
  23787. $this->getUser();
  23788. if (strlen($this->p4User) > 0) {
  23789. return;
  23790. }
  23791. $this->p4User = $this->getP4variable('P4USER');
  23792. if (strlen($this->p4User) > 0) {
  23793. return;
  23794. }
  23795. $this->p4User = $this->io->ask('Enter P4 User:');
  23796. if ($this->windowsFlag) {
  23797. $command = 'p4 set P4USER=' . $this->p4User;
  23798. } else {
  23799. $command = 'export P4USER=' . $this->p4User;
  23800. }
  23801. $this->executeCommand($command);
  23802. }
  23803. protected function getP4variable($name)
  23804. {
  23805. if ($this->windowsFlag) {
  23806. $command = 'p4 set';
  23807. $this->executeCommand($command);
  23808. $result = trim($this->commandResult);
  23809. $resArray = explode(PHP_EOL, $result);
  23810. foreach ($resArray as $line) {
  23811. $fields = explode('=', $line);
  23812. if (strcmp($name, $fields[0]) == 0) {
  23813. $index = strpos($fields[1], ' ');
  23814. if ($index === false) {
  23815. $value = $fields[1];
  23816. } else {
  23817. $value = substr($fields[1], 0, $index);
  23818. }
  23819. $value = trim($value);
  23820. return $value;
  23821. }
  23822. }
  23823. return null;
  23824. } else {
  23825. $command = 'echo $' . $name;
  23826. $this->executeCommand($command);
  23827. $result = trim($this->commandResult);
  23828. return $result;
  23829. }
  23830. }
  23831. public function queryP4Password()
  23832. {
  23833. if (isset($this->p4Password)) {
  23834. return $this->p4Password;
  23835. }
  23836. $password = $this->getP4variable('P4PASSWD');
  23837. if (strlen($password) <= 0) {
  23838. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  23839. }
  23840. $this->p4Password = $password;
  23841. return $password;
  23842. }
  23843. public function generateP4Command($command, $useClient = true)
  23844. {
  23845. $p4Command = 'p4 ';
  23846. $p4Command = $p4Command . '-u ' . $this->getUser() . ' ';
  23847. if ($useClient) {
  23848. $p4Command = $p4Command . '-c ' . $this->getClient() . ' ';
  23849. }
  23850. $p4Command = $p4Command . '-p ' . $this->getPort() . ' ';
  23851. $p4Command = $p4Command . $command;
  23852. return $p4Command;
  23853. }
  23854. public function isLoggedIn()
  23855. {
  23856. $command = $this->generateP4Command('login -s', false);
  23857. $exitCode = $this->executeCommand($command);
  23858. if ($exitCode) {
  23859. $errorOutput = $this->process->getErrorOutput();
  23860. $index = strpos($errorOutput, $this->getUser());
  23861. if ($index === false) {
  23862. $index = strpos($errorOutput, 'p4');
  23863. if ($index === false) {
  23864. return false;
  23865. }
  23866. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  23867. }
  23868. throw new \Exception('Invalid user name: ' . $this->getUser());
  23869. }
  23870. return true;
  23871. }
  23872. public function connectClient()
  23873. {
  23874. $p4CreateClientCommand = $this->generateP4Command('client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec()));
  23875. $this->executeCommand($p4CreateClientCommand);
  23876. }
  23877. public function syncCodeBase($sourceReference)
  23878. {
  23879. $prevDir = getcwd();
  23880. chdir($this->path);
  23881. $p4SyncCommand = $this->generateP4Command('sync -f ');
  23882. if (null !== $sourceReference) {
  23883. $p4SyncCommand = $p4SyncCommand . '@' . $sourceReference;
  23884. }
  23885. $this->executeCommand($p4SyncCommand);
  23886. chdir($prevDir);
  23887. }
  23888. public function writeClientSpecToFile($spec)
  23889. {
  23890. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  23891. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  23892. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  23893. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  23894. fwrite($spec, 'Description:' . PHP_EOL);
  23895. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  23896. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  23897. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  23898. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  23899. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  23900. if ($this->isStream()) {
  23901. fwrite($spec, 'Stream:' . PHP_EOL);
  23902. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  23903. } else {
  23904. fwrite(
  23905. $spec,
  23906. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  23907. );
  23908. }
  23909. }
  23910. public function writeP4ClientSpec()
  23911. {
  23912. $clientSpec = $this->getP4ClientSpec();
  23913. $spec = fopen($clientSpec, 'w');
  23914. try {
  23915. $this->writeClientSpecToFile($spec);
  23916. } catch (\Exception $e) {
  23917. fclose($spec);
  23918. throw $e;
  23919. }
  23920. fclose($spec);
  23921. }
  23922. protected function read($pipe, $name)
  23923. {
  23924. if (feof($pipe)) {
  23925. return;
  23926. }
  23927. $line = fgets($pipe);
  23928. while ($line !== false) {
  23929. $line = fgets($pipe);
  23930. }
  23931. return;
  23932. }
  23933. public function windowsLogin($password)
  23934. {
  23935. $command = $this->generateP4Command(' login -a');
  23936. $process = new Process($command, null, null, $password);
  23937. return $process->run();
  23938. }
  23939. public function p4Login()
  23940. {
  23941. $this->queryP4User();
  23942. if (!$this->isLoggedIn()) {
  23943. $password = $this->queryP4Password();
  23944. if ($this->windowsFlag) {
  23945. $this->windowsLogin($password);
  23946. } else {
  23947. $command = 'echo ' . $password . ' | ' . $this->generateP4Command(' login -a', false);
  23948. $exitCode = $this->executeCommand($command);
  23949. $result = trim($this->commandResult);
  23950. if ($exitCode) {
  23951. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  23952. }
  23953. }
  23954. }
  23955. }
  23956. public function getComposerInformation($identifier)
  23957. {
  23958. $index = strpos($identifier, '@');
  23959. if ($index === false) {
  23960. $composerJson = $identifier. '/composer.json';
  23961. return $this->getComposerInformationFromPath($composerJson);
  23962. }
  23963. return $this->getComposerInformationFromLabel($identifier, $index);
  23964. }
  23965. public function getComposerInformationFromPath($composerJson)
  23966. {
  23967. $command = $this->generateP4Command(' print ' . $composerJson);
  23968. $this->executeCommand($command);
  23969. $result = $this->commandResult;
  23970. $index = strpos($result, '{');
  23971. if ($index === false) {
  23972. return '';
  23973. }
  23974. if ($index >= 0) {
  23975. $rawData = substr($result, $index);
  23976. $composer_info = json_decode($rawData, true);
  23977. return $composer_info;
  23978. }
  23979. return '';
  23980. }
  23981. public function getComposerInformationFromLabel($identifier, $index)
  23982. {
  23983. $composerJsonPath = substr($identifier, 0, $index) . '/composer.json' . substr($identifier, $index);
  23984. $command = $this->generateP4Command(' files ' . $composerJsonPath, false);
  23985. $this->executeCommand($command);
  23986. $result = $this->commandResult;
  23987. $index2 = strpos($result, 'no such file(s).');
  23988. if ($index2 === false) {
  23989. $index3 = strpos($result, 'change');
  23990. if (!($index3 === false)) {
  23991. $phrase = trim(substr($result, $index3));
  23992. $fields = explode(' ', $phrase);
  23993. $id = $fields[1];
  23994. $composerJson = substr($identifier, 0, $index) . '/composer.json@' . $id;
  23995. return $this->getComposerInformationFromPath($composerJson);
  23996. }
  23997. }
  23998. return "";
  23999. }
  24000. public function getBranches()
  24001. {
  24002. $possibleBranches = array();
  24003. if (!$this->isStream()) {
  24004. $possibleBranches[$this->p4Branch] = $this->getStream();
  24005. } else {
  24006. $command = $this->generateP4Command('streams //' . $this->p4Depot . '/...');
  24007. $this->executeCommand($command);
  24008. $result = $this->commandResult;
  24009. $resArray = explode(PHP_EOL, $result);
  24010. foreach ($resArray as $line) {
  24011. $resBits = explode(' ', $line);
  24012. if (count($resBits) > 4) {
  24013. $branch = preg_replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  24014. $possibleBranches[$branch] = $resBits[1];
  24015. }
  24016. }
  24017. }
  24018. $command = $this->generateP4Command('changes '. $this->getStream() . '/...', false);
  24019. $this->executeCommand($command);
  24020. $result = $this->commandResult;
  24021. $resArray = explode(PHP_EOL, $result);
  24022. $lastCommit = $resArray[0];
  24023. $lastCommitArr = explode(' ', $lastCommit);
  24024. $lastCommitNum = $lastCommitArr[1];
  24025. $branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  24026. return $branches;
  24027. }
  24028. public function getTags()
  24029. {
  24030. $command = $this->generateP4Command('labels');
  24031. $this->executeCommand($command);
  24032. $result = $this->commandResult;
  24033. $resArray = explode(PHP_EOL, $result);
  24034. $tags = array();
  24035. foreach ($resArray as $line) {
  24036. $index = strpos($line, 'Label');
  24037. if (!($index === false)) {
  24038. $fields = explode(' ', $line);
  24039. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  24040. }
  24041. }
  24042. return $tags;
  24043. }
  24044. public function checkStream()
  24045. {
  24046. $command = $this->generateP4Command('depots', false);
  24047. $this->executeCommand($command);
  24048. $result = $this->commandResult;
  24049. $resArray = explode(PHP_EOL, $result);
  24050. foreach ($resArray as $line) {
  24051. $index = strpos($line, 'Depot');
  24052. if (!($index === false)) {
  24053. $fields = explode(' ', $line);
  24054. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  24055. $this->p4DepotType = $fields[3];
  24056. return $this->isStream();
  24057. }
  24058. }
  24059. }
  24060. return false;
  24061. }
  24062. protected function getChangeList($reference)
  24063. {
  24064. $index = strpos($reference, '@');
  24065. if ($index === false) {
  24066. return null;
  24067. }
  24068. $label = substr($reference, $index);
  24069. $command = $this->generateP4Command(' changes -m1 ' . $label);
  24070. $this->executeCommand($command);
  24071. $changes = $this->commandResult;
  24072. if (strpos($changes, 'Change') !== 0) {
  24073. return null;
  24074. }
  24075. $fields = explode(' ', $changes);
  24076. $changeList = $fields[1];
  24077. return $changeList;
  24078. }
  24079. public function getCommitLogs($fromReference, $toReference)
  24080. {
  24081. $fromChangeList = $this->getChangeList($fromReference);
  24082. if ($fromChangeList === null) {
  24083. return null;
  24084. }
  24085. $toChangeList = $this->getChangeList($toReference);
  24086. if ($toChangeList === null) {
  24087. return null;
  24088. }
  24089. $index = strpos($fromReference, '@');
  24090. $main = substr($fromReference, 0, $index) . '/...';
  24091. $command = $this->generateP4Command('filelog ' . $main . '@' . $fromChangeList. ',' . $toChangeList);
  24092. $this->executeCommand($command);
  24093. $result = $this->commandResult;
  24094. return $result;
  24095. }
  24096. public function getFilesystem()
  24097. {
  24098. if (empty($this->filesystem)) {
  24099. $this->filesystem = new Filesystem($this->process);
  24100. }
  24101. return $this->filesystem;
  24102. }
  24103. public function setFilesystem(Filesystem $fs)
  24104. {
  24105. $this->filesystem = $fs;
  24106. }
  24107. }
  24108. <?php
  24109. namespace Composer\Util;
  24110. class Platform
  24111. {
  24112. public static function expandPath($path)
  24113. {
  24114. if (preg_match('#^~[\\/]#', $path)) {
  24115. return self::getUserDirectory() . substr($path, 1);
  24116. }
  24117. return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function($matches) {
  24118. if (Platform::isWindows() && $matches['var'] == 'HOME') {
  24119. return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path'];
  24120. }
  24121. return getenv($matches['var']) . $matches['path'];
  24122. }, $path);
  24123. }
  24124. public static function getUserDirectory()
  24125. {
  24126. if (false !== ($home = getenv('HOME'))) {
  24127. return $home;
  24128. }
  24129. if (self::isWindows() && false !== ($home = getenv('USERPROFILE'))) {
  24130. return $home;
  24131. }
  24132. if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
  24133. $info = posix_getpwuid(posix_getuid());
  24134. return $info['dir'];
  24135. }
  24136. throw new \RuntimeException('Could not determine user directory');
  24137. }
  24138. public static function isWindows()
  24139. {
  24140. return defined('PHP_WINDOWS_VERSION_BUILD');
  24141. }
  24142. public static function strlen($str)
  24143. {
  24144. static $useMbString = null;
  24145. if (null === $useMbString) {
  24146. $useMbString = function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  24147. }
  24148. if ($useMbString) {
  24149. return mb_strlen($str, '8bit');
  24150. }
  24151. return strlen($str);
  24152. }
  24153. }
  24154. <?php
  24155. namespace Composer\Util;
  24156. use Symfony\Component\Process\Process;
  24157. use Symfony\Component\Process\ProcessUtils;
  24158. use Composer\IO\IOInterface;
  24159. class ProcessExecutor
  24160. {
  24161. protected static $timeout = 300;
  24162. protected $captureOutput;
  24163. protected $errorOutput;
  24164. protected $io;
  24165. public function __construct(IOInterface $io = null)
  24166. {
  24167. $this->io = $io;
  24168. }
  24169. public function execute($command, &$output = null, $cwd = null)
  24170. {
  24171. if ($this->io && $this->io->isDebug()) {
  24172. $safeCommand = preg_replace_callback('{(://)(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)}i', function ($m) {
  24173. if (preg_match('{^[a-f0-9]{12,}$}', $m['user'])) {
  24174. return '://***:***';
  24175. }
  24176. return '://'.$m['user'].':***';
  24177. }, $command);
  24178. $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  24179. }
  24180. if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
  24181. $cwd = realpath(getcwd());
  24182. }
  24183. $this->captureOutput = count(func_get_args()) > 1;
  24184. $this->errorOutput = null;
  24185. $process = new Process($command, $cwd, null, null, static::getTimeout());
  24186. $callback = is_callable($output) ? $output : array($this, 'outputHandler');
  24187. $process->run($callback);
  24188. if ($this->captureOutput && !is_callable($output)) {
  24189. $output = $process->getOutput();
  24190. }
  24191. $this->errorOutput = $process->getErrorOutput();
  24192. return $process->getExitCode();
  24193. }
  24194. public function splitLines($output)
  24195. {
  24196. $output = trim($output);
  24197. return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
  24198. }
  24199. public function getErrorOutput()
  24200. {
  24201. return $this->errorOutput;
  24202. }
  24203. public function outputHandler($type, $buffer)
  24204. {
  24205. if ($this->captureOutput) {
  24206. return;
  24207. }
  24208. echo $buffer;
  24209. }
  24210. public static function getTimeout()
  24211. {
  24212. return static::$timeout;
  24213. }
  24214. public static function setTimeout($timeout)
  24215. {
  24216. static::$timeout = $timeout;
  24217. }
  24218. public static function escape($argument)
  24219. {
  24220. return ProcessUtils::escapeArgument($argument);
  24221. }
  24222. }
  24223. <?php
  24224. namespace Composer\Util;
  24225. use Composer\Config;
  24226. use Composer\IO\IOInterface;
  24227. use Composer\Downloader\TransportException;
  24228. use Composer\CaBundle\CaBundle;
  24229. use Psr\Log\LoggerInterface;
  24230. class RemoteFilesystem
  24231. {
  24232. private $io;
  24233. private $config;
  24234. private $scheme;
  24235. private $bytesMax;
  24236. private $originUrl;
  24237. private $fileUrl;
  24238. private $fileName;
  24239. private $retry;
  24240. private $progress;
  24241. private $lastProgress;
  24242. private $options = array();
  24243. private $peerCertificateMap = array();
  24244. private $disableTls = false;
  24245. private $retryAuthFailure;
  24246. private $lastHeaders;
  24247. private $storeAuth;
  24248. private $degradedMode = false;
  24249. private $redirects;
  24250. private $maxRedirects = 20;
  24251. public function __construct(IOInterface $io, Config $config = null, array $options = array(), $disableTls = false)
  24252. {
  24253. $this->io = $io;
  24254. if ($disableTls === false) {
  24255. $this->options = $this->getTlsDefaults($options);
  24256. } else {
  24257. $this->disableTls = true;
  24258. }
  24259. $this->options = array_replace_recursive($this->options, $options);
  24260. $this->config = $config;
  24261. }
  24262. public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
  24263. {
  24264. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  24265. }
  24266. public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
  24267. {
  24268. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  24269. }
  24270. public function getOptions()
  24271. {
  24272. return $this->options;
  24273. }
  24274. public function setOptions(array $options)
  24275. {
  24276. $this->options = array_replace_recursive($this->options, $options);
  24277. }
  24278. public function isTlsDisabled()
  24279. {
  24280. return $this->disableTls === true;
  24281. }
  24282. public function getLastHeaders()
  24283. {
  24284. return $this->lastHeaders;
  24285. }
  24286. public function findHeaderValue(array $headers, $name)
  24287. {
  24288. $value = null;
  24289. foreach ($headers as $header) {
  24290. if (preg_match('{^'.$name.':\s*(.+?)\s*$}i', $header, $match)) {
  24291. $value = $match[1];
  24292. } elseif (preg_match('{^HTTP/}i', $header)) {
  24293. $value = null;
  24294. }
  24295. }
  24296. return $value;
  24297. }
  24298. public function findStatusCode(array $headers)
  24299. {
  24300. $value = null;
  24301. foreach ($headers as $header) {
  24302. if (preg_match('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  24303. $value = (int) $match[1];
  24304. }
  24305. }
  24306. return $value;
  24307. }
  24308. protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
  24309. {
  24310. if (strpos($originUrl, '.github.com') === (strlen($originUrl) - 11)) {
  24311. $originUrl = 'github.com';
  24312. }
  24313. $this->scheme = parse_url($fileUrl, PHP_URL_SCHEME);
  24314. $this->bytesMax = 0;
  24315. $this->originUrl = $originUrl;
  24316. $this->fileUrl = $fileUrl;
  24317. $this->fileName = $fileName;
  24318. $this->progress = $progress;
  24319. $this->lastProgress = null;
  24320. $this->retryAuthFailure = true;
  24321. $this->lastHeaders = array();
  24322. $this->redirects = 1;
  24323. if (preg_match('{^https?://(.+):(.+)@([^/]+)}i', $fileUrl, $match)) {
  24324. $this->io->setAuthentication($originUrl, urldecode($match[1]), urldecode($match[2]));
  24325. }
  24326. $tempAdditionalOptions = $additionalOptions;
  24327. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  24328. $this->retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  24329. unset($tempAdditionalOptions['retry-auth-failure']);
  24330. }
  24331. $isRedirect = false;
  24332. if (isset($tempAdditionalOptions['redirects'])) {
  24333. $this->redirects = $tempAdditionalOptions['redirects'];
  24334. $isRedirect = true;
  24335. unset($tempAdditionalOptions['redirects']);
  24336. }
  24337. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  24338. unset($tempAdditionalOptions);
  24339. $userlandFollow = isset($options['http']['follow_location']) && !$options['http']['follow_location'];
  24340. $origFileUrl = $fileUrl;
  24341. if (isset($options['github-token'])) {
  24342. if (preg_match('{^https?://([a-z0-9-]+\.)*github\.com/}', $fileUrl)) {
  24343. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['github-token'];
  24344. }
  24345. unset($options['github-token']);
  24346. }
  24347. if (isset($options['gitlab-token'])) {
  24348. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  24349. unset($options['gitlab-token']);
  24350. }
  24351. if (isset($options['bitbucket-token'])) {
  24352. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['bitbucket-token'];
  24353. unset($options['bitbucket-token']);
  24354. }
  24355. if (isset($options['http'])) {
  24356. $options['http']['ignore_errors'] = true;
  24357. }
  24358. if ($this->degradedMode && substr($fileUrl, 0, 21) === 'http://packagist.org/') {
  24359. $fileUrl = 'http://' . gethostbyname('packagist.org') . substr($fileUrl, 20);
  24360. $degradedPackagist = true;
  24361. }
  24362. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  24363. $actualContextOptions = stream_context_get_options($ctx);
  24364. $usingProxy = !empty($actualContextOptions['http']['proxy']) ? ' using proxy ' . $actualContextOptions['http']['proxy'] : '';
  24365. $this->io->writeError((substr($origFileUrl, 0, 4) === 'http' ? 'Downloading ' : 'Reading ') . $origFileUrl . $usingProxy, true, IOInterface::DEBUG);
  24366. unset($origFileUrl, $actualContextOptions);
  24367. if ((substr($fileUrl, 0, 23) !== 'http://packagist.org/p/' || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist) && $this->config) {
  24368. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  24369. }
  24370. if ($this->progress && !$isRedirect) {
  24371. $this->io->writeError(" Downloading: <comment>Connecting...</comment>", false);
  24372. }
  24373. $errorMessage = '';
  24374. $errorCode = 0;
  24375. $result = false;
  24376. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  24377. if ($errorMessage) {
  24378. $errorMessage .= "\n";
  24379. }
  24380. $errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
  24381. });
  24382. try {
  24383. $result = file_get_contents($fileUrl, false, $ctx);
  24384. $contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
  24385. if ($contentLength && Platform::strlen($result) < $contentLength) {
  24386. throw new TransportException('Content-Length mismatch');
  24387. }
  24388. if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
  24389. $params = stream_context_get_params($ctx);
  24390. $expectedPeerFingerprint = $options['ssl']['peer_fingerprint'];
  24391. $peerFingerprint = TlsHelper::getCertificateFingerprint($params['options']['ssl']['peer_certificate']);
  24392. if ($expectedPeerFingerprint !== $peerFingerprint) {
  24393. throw new TransportException('Peer fingerprint did not match');
  24394. }
  24395. }
  24396. } catch (\Exception $e) {
  24397. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  24398. $e->setHeaders($http_response_header);
  24399. $e->setStatusCode($this->findStatusCode($http_response_header));
  24400. }
  24401. if ($e instanceof TransportException && $result !== false) {
  24402. $e->setResponse($result);
  24403. }
  24404. $result = false;
  24405. }
  24406. if ($errorMessage && !ini_get('allow_url_fopen')) {
  24407. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  24408. }
  24409. restore_error_handler();
  24410. if (isset($e) && !$this->retry) {
  24411. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  24412. $this->degradedMode = true;
  24413. $this->io->writeError(array(
  24414. '<error>'.$e->getMessage().'</error>',
  24415. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  24416. ));
  24417. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  24418. }
  24419. throw $e;
  24420. }
  24421. $statusCode = null;
  24422. $contentType = null;
  24423. if (!empty($http_response_header[0])) {
  24424. $statusCode = $this->findStatusCode($http_response_header);
  24425. $contentType = $this->findHeaderValue($http_response_header, 'content-type');
  24426. }
  24427. if ($originUrl === 'bitbucket.org'
  24428. && substr($fileUrl, -4) === '.zip'
  24429. && preg_match('{^text/html\b}i', $contentType)
  24430. ) {
  24431. $result = false;
  24432. if ($this->retryAuthFailure) {
  24433. $this->promptAuthAndRetry(401);
  24434. }
  24435. }
  24436. $hasFollowedRedirect = false;
  24437. if ($userlandFollow && $statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  24438. $hasFollowedRedirect = true;
  24439. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  24440. }
  24441. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  24442. if (!$this->retry) {
  24443. if ($this->progress && !$this->retry && !$isRedirect) {
  24444. $this->io->overwriteError(" Downloading: <error>Failed</error>");
  24445. }
  24446. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  24447. $e->setHeaders($http_response_header);
  24448. $e->setResponse($result);
  24449. $e->setStatusCode($statusCode);
  24450. throw $e;
  24451. }
  24452. $result = false;
  24453. }
  24454. if ($this->progress && !$this->retry && !$isRedirect) {
  24455. $this->io->overwriteError(" Downloading: ".($result === false ? '<error>Failed</error>' : '<comment>100%</comment>'));
  24456. }
  24457. if ($result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http' && !$hasFollowedRedirect) {
  24458. $decode = 'gzip' === strtolower($this->findHeaderValue($http_response_header, 'content-encoding'));
  24459. if ($decode) {
  24460. try {
  24461. if (PHP_VERSION_ID >= 50400) {
  24462. $result = zlib_decode($result);
  24463. } else {
  24464. $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
  24465. }
  24466. if (!$result) {
  24467. throw new TransportException('Failed to decode zlib stream');
  24468. }
  24469. } catch (\Exception $e) {
  24470. if ($this->degradedMode) {
  24471. throw $e;
  24472. }
  24473. $this->degradedMode = true;
  24474. $this->io->writeError(array(
  24475. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  24476. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  24477. ));
  24478. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  24479. }
  24480. }
  24481. }
  24482. if (false !== $result && null !== $fileName && !$isRedirect) {
  24483. if ('' === $result) {
  24484. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  24485. }
  24486. $errorMessage = '';
  24487. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  24488. if ($errorMessage) {
  24489. $errorMessage .= "\n";
  24490. }
  24491. $errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
  24492. });
  24493. $result = (bool) file_put_contents($fileName, $result);
  24494. restore_error_handler();
  24495. if (false === $result) {
  24496. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  24497. }
  24498. }
  24499. if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
  24500. if (CaBundle::isOpensslParseSafe()) {
  24501. $certDetails = $this->getCertificateCnAndFp($this->fileUrl, $options);
  24502. if ($certDetails) {
  24503. $this->peerCertificateMap[$this->getUrlAuthority($this->fileUrl)] = $certDetails;
  24504. $this->retry = true;
  24505. }
  24506. } else {
  24507. $this->io->writeError(sprintf(
  24508. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  24509. PHP_VERSION
  24510. ));
  24511. }
  24512. }
  24513. if ($this->retry) {
  24514. $this->retry = false;
  24515. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  24516. if ($this->storeAuth && $this->config) {
  24517. $authHelper = new AuthHelper($this->io, $this->config);
  24518. $authHelper->storeAuth($this->originUrl, $this->storeAuth);
  24519. $this->storeAuth = false;
  24520. }
  24521. return $result;
  24522. }
  24523. if (false === $result) {
  24524. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  24525. if (!empty($http_response_header[0])) {
  24526. $e->setHeaders($http_response_header);
  24527. }
  24528. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  24529. $this->degradedMode = true;
  24530. $this->io->writeError(array(
  24531. '<error>'.$e->getMessage().'</error>',
  24532. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  24533. ));
  24534. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  24535. }
  24536. throw $e;
  24537. }
  24538. if (!empty($http_response_header[0])) {
  24539. $this->lastHeaders = $http_response_header;
  24540. }
  24541. return $result;
  24542. }
  24543. protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
  24544. {
  24545. switch ($notificationCode) {
  24546. case STREAM_NOTIFY_FAILURE:
  24547. if (400 === $messageCode) {
  24548. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  24549. }
  24550. case STREAM_NOTIFY_AUTH_REQUIRED:
  24551. if (401 === $messageCode) {
  24552. if (!$this->retryAuthFailure) {
  24553. break;
  24554. }
  24555. $this->promptAuthAndRetry($messageCode);
  24556. }
  24557. break;
  24558. case STREAM_NOTIFY_AUTH_RESULT:
  24559. if (403 === $messageCode) {
  24560. if (!$this->retryAuthFailure) {
  24561. break;
  24562. }
  24563. $this->promptAuthAndRetry($messageCode, $message);
  24564. }
  24565. break;
  24566. case STREAM_NOTIFY_FILE_SIZE_IS:
  24567. $this->bytesMax = $bytesMax;
  24568. break;
  24569. case STREAM_NOTIFY_PROGRESS:
  24570. if ($this->bytesMax > 0 && $this->progress) {
  24571. $progression = min(100, round($bytesTransferred / $this->bytesMax * 100));
  24572. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  24573. $this->lastProgress = $progression;
  24574. $this->io->overwriteError(" Downloading: <comment>$progression%</comment>", false);
  24575. }
  24576. }
  24577. break;
  24578. default:
  24579. break;
  24580. }
  24581. }
  24582. protected function promptAuthAndRetry($httpStatus, $reason = null)
  24583. {
  24584. if ($this->config && in_array($this->originUrl, $this->config->get('github-domains'), true)) {
  24585. $message = "\n".'Could not fetch '.$this->fileUrl.', please create a GitHub OAuth token '.($httpStatus === 404 ? 'to access private repos' : 'to go over the API rate limit');
  24586. $gitHubUtil = new GitHub($this->io, $this->config, null);
  24587. if (!$gitHubUtil->authorizeOAuth($this->originUrl)
  24588. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($this->originUrl, $message))
  24589. ) {
  24590. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  24591. }
  24592. } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
  24593. $message = "\n".'Could not fetch '.$this->fileUrl.', enter your ' . $this->originUrl . ' credentials ' .($httpStatus === 401 ? 'to access private repos' : 'to go over the API rate limit');
  24594. $gitLabUtil = new GitLab($this->io, $this->config, null);
  24595. if (!$gitLabUtil->authorizeOAuth($this->originUrl)
  24596. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
  24597. ) {
  24598. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  24599. }
  24600. } elseif ($this->config && $this->originUrl === 'bitbucket.org') {
  24601. $askForOAuthToken = true;
  24602. if ($this->io->hasAuthentication($this->originUrl)) {
  24603. $auth = $this->io->getAuthentication($this->originUrl);
  24604. if ($auth['username'] !== 'x-token-auth') {
  24605. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  24606. $token = $bitbucketUtil->requestToken($this->originUrl, $auth['username'], $auth['password']);
  24607. if (! empty($token)) {
  24608. $this->io->setAuthentication($this->originUrl, 'x-token-auth', $token['access_token']);
  24609. $askForOAuthToken = false;
  24610. }
  24611. } else {
  24612. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  24613. }
  24614. }
  24615. if ($askForOAuthToken) {
  24616. $message = "\n".'Could not fetch ' . $this->fileUrl . ', please create a bitbucket OAuth token to ' . ($httpStatus === 401 ? 'to access private repos' : 'to go over the API rate limit');
  24617. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  24618. if (! $bitBucketUtil->authorizeOAuth($this->originUrl)
  24619. && (! $this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($this->originUrl, $message))
  24620. ) {
  24621. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  24622. }
  24623. }
  24624. } else {
  24625. if ($httpStatus === 404) {
  24626. return;
  24627. }
  24628. if (!$this->io->isInteractive()) {
  24629. if ($httpStatus === 401) {
  24630. $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  24631. }
  24632. if ($httpStatus === 403) {
  24633. $message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $reason;
  24634. }
  24635. throw new TransportException($message, $httpStatus);
  24636. }
  24637. if ($this->io->hasAuthentication($this->originUrl)) {
  24638. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  24639. }
  24640. $this->io->overwriteError(' Authentication required (<info>'.parse_url($this->fileUrl, PHP_URL_HOST).'</info>):');
  24641. $username = $this->io->ask(' Username: ');
  24642. $password = $this->io->askAndHideAnswer(' Password: ');
  24643. $this->io->setAuthentication($this->originUrl, $username, $password);
  24644. $this->storeAuth = $this->config->get('store-auths');
  24645. }
  24646. $this->retry = true;
  24647. throw new TransportException('RETRY');
  24648. }
  24649. protected function getOptionsForUrl($originUrl, $additionalOptions)
  24650. {
  24651. $tlsOptions = array();
  24652. if ($this->disableTls === false && PHP_VERSION_ID < 50600 && !stream_is_local($this->fileUrl)) {
  24653. $host = parse_url($this->fileUrl, PHP_URL_HOST);
  24654. if (PHP_VERSION_ID >= 50304) {
  24655. $userlandFollow = true;
  24656. } else {
  24657. if ($host === 'github.com' || $host === 'api.github.com') {
  24658. $host = '*.github.com';
  24659. }
  24660. }
  24661. $tlsOptions['ssl']['CN_match'] = $host;
  24662. $tlsOptions['ssl']['SNI_server_name'] = $host;
  24663. $urlAuthority = $this->getUrlAuthority($this->fileUrl);
  24664. if (isset($this->peerCertificateMap[$urlAuthority])) {
  24665. $certMap = $this->peerCertificateMap[$urlAuthority];
  24666. $this->io->writeError(sprintf(
  24667. 'Using <info>%s</info> as CN for subjectAltName enabled host <info>%s</info>',
  24668. $certMap['cn'],
  24669. $urlAuthority
  24670. ), true, IOInterface::DEBUG);
  24671. $tlsOptions['ssl']['CN_match'] = $certMap['cn'];
  24672. $tlsOptions['ssl']['peer_fingerprint'] = $certMap['fp'];
  24673. }
  24674. }
  24675. $headers = array();
  24676. if (extension_loaded('zlib')) {
  24677. $headers[] = 'Accept-Encoding: gzip';
  24678. }
  24679. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  24680. if (!$this->degradedMode) {
  24681. $options['http']['protocol_version'] = 1.1;
  24682. $headers[] = 'Connection: close';
  24683. }
  24684. if (isset($userlandFollow)) {
  24685. $options['http']['follow_location'] = 0;
  24686. }
  24687. if ($this->io->hasAuthentication($originUrl)) {
  24688. $auth = $this->io->getAuthentication($originUrl);
  24689. if ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
  24690. $options['github-token'] = $auth['username'];
  24691. } elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  24692. if ($auth['password'] === 'oauth2') {
  24693. $headers[] = 'Authorization: Bearer '.$auth['username'];
  24694. }
  24695. } elseif ('bitbucket.org' === $originUrl
  24696. && $this->fileUrl !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL && 'x-token-auth' === $auth['username']
  24697. ) {
  24698. $options['bitbucket-token'] = $auth['password'];
  24699. } else {
  24700. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  24701. $headers[] = 'Authorization: Basic '.$authStr;
  24702. }
  24703. }
  24704. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  24705. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  24706. }
  24707. foreach ($headers as $header) {
  24708. $options['http']['header'][] = $header;
  24709. }
  24710. return $options;
  24711. }
  24712. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  24713. {
  24714. if ($locationHeader = $this->findHeaderValue($http_response_header, 'location')) {
  24715. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  24716. $targetUrl = $locationHeader;
  24717. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  24718. $targetUrl = $this->scheme.':'.$locationHeader;
  24719. } elseif ('/' === $locationHeader[0]) {
  24720. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  24721. $targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  24722. } else {
  24723. $targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  24724. }
  24725. }
  24726. if (!empty($targetUrl)) {
  24727. $this->redirects++;
  24728. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, $targetUrl), true, IOInterface::DEBUG);
  24729. $additionalOptions['redirects'] = $this->redirects;
  24730. return $this->get($this->originUrl, $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  24731. }
  24732. if (!$this->retry) {
  24733. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  24734. $e->setHeaders($http_response_header);
  24735. $e->setResponse($result);
  24736. throw $e;
  24737. }
  24738. return false;
  24739. }
  24740. private function getTlsDefaults(array $options)
  24741. {
  24742. $ciphers = implode(':', array(
  24743. 'ECDHE-RSA-AES128-GCM-SHA256',
  24744. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  24745. 'ECDHE-RSA-AES256-GCM-SHA384',
  24746. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  24747. 'DHE-RSA-AES128-GCM-SHA256',
  24748. 'DHE-DSS-AES128-GCM-SHA256',
  24749. 'kEDH+AESGCM',
  24750. 'ECDHE-RSA-AES128-SHA256',
  24751. 'ECDHE-ECDSA-AES128-SHA256',
  24752. 'ECDHE-RSA-AES128-SHA',
  24753. 'ECDHE-ECDSA-AES128-SHA',
  24754. 'ECDHE-RSA-AES256-SHA384',
  24755. 'ECDHE-ECDSA-AES256-SHA384',
  24756. 'ECDHE-RSA-AES256-SHA',
  24757. 'ECDHE-ECDSA-AES256-SHA',
  24758. 'DHE-RSA-AES128-SHA256',
  24759. 'DHE-RSA-AES128-SHA',
  24760. 'DHE-DSS-AES128-SHA256',
  24761. 'DHE-RSA-AES256-SHA256',
  24762. 'DHE-DSS-AES256-SHA',
  24763. 'DHE-RSA-AES256-SHA',
  24764. 'AES128-GCM-SHA256',
  24765. 'AES256-GCM-SHA384',
  24766. 'AES128-SHA256',
  24767. 'AES256-SHA256',
  24768. 'AES128-SHA',
  24769. 'AES256-SHA',
  24770. 'AES',
  24771. 'CAMELLIA',
  24772. 'DES-CBC3-SHA',
  24773. '!aNULL',
  24774. '!eNULL',
  24775. '!EXPORT',
  24776. '!DES',
  24777. '!RC4',
  24778. '!MD5',
  24779. '!PSK',
  24780. '!aECDH',
  24781. '!EDH-DSS-DES-CBC3-SHA',
  24782. '!EDH-RSA-DES-CBC3-SHA',
  24783. '!KRB5-DES-CBC3-SHA',
  24784. ));
  24785. $defaults = array(
  24786. 'ssl' => array(
  24787. 'ciphers' => $ciphers,
  24788. 'verify_peer' => true,
  24789. 'verify_depth' => 7,
  24790. 'SNI_enabled' => true,
  24791. 'capture_peer_cert' => true,
  24792. ),
  24793. );
  24794. if (isset($options['ssl'])) {
  24795. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  24796. }
  24797. $caBundleLogger = $this->io instanceof LoggerInterface ? $this->io : null;
  24798. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  24799. $result = CaBundle::getSystemCaRootBundlePath($caBundleLogger);
  24800. if (preg_match('{^phar://}', $result)) {
  24801. $hash = hash_file('sha256', $result);
  24802. $targetPath = rtrim(sys_get_temp_dir(), '\\/') . '/composer-cacert-' . $hash . '.pem';
  24803. if (!file_exists($targetPath) || $hash !== hash_file('sha256', $targetPath)) {
  24804. $this->streamCopy($result, $targetPath);
  24805. chmod($targetPath, 0666);
  24806. }
  24807. $defaults['ssl']['cafile'] = $targetPath;
  24808. } elseif (is_dir($result)) {
  24809. $defaults['ssl']['capath'] = $result;
  24810. } else {
  24811. $defaults['ssl']['cafile'] = $result;
  24812. }
  24813. }
  24814. if (isset($defaults['ssl']['cafile']) && (!is_readable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $caBundleLogger))) {
  24815. throw new TransportException('The configured cafile was not valid or could not be read.');
  24816. }
  24817. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !is_readable($defaults['ssl']['capath']))) {
  24818. throw new TransportException('The configured capath was not valid or could not be read.');
  24819. }
  24820. if (PHP_VERSION_ID >= 50413) {
  24821. $defaults['ssl']['disable_compression'] = true;
  24822. }
  24823. return $defaults;
  24824. }
  24825. private function streamCopy($source, $target)
  24826. {
  24827. $source = fopen($source, 'r');
  24828. $target = fopen($target, 'w+');
  24829. stream_copy_to_stream($source, $target);
  24830. fclose($source);
  24831. fclose($target);
  24832. unset($source, $target);
  24833. }
  24834. private function getCertificateCnAndFp($url, $options)
  24835. {
  24836. if (PHP_VERSION_ID >= 50600) {
  24837. throw new \BadMethodCallException(sprintf(
  24838. '%s must not be used on PHP >= 5.6',
  24839. __METHOD__
  24840. ));
  24841. }
  24842. $context = StreamContextFactory::getContext($url, $options, array('options' => array(
  24843. 'ssl' => array(
  24844. 'capture_peer_cert' => true,
  24845. 'verify_peer' => false,
  24846. ), ),
  24847. ));
  24848. if (false === $handle = @fopen($url, 'rb', false, $context)) {
  24849. return;
  24850. }
  24851. fclose($handle);
  24852. $handle = null;
  24853. $params = stream_context_get_params($context);
  24854. if (!empty($params['options']['ssl']['peer_certificate'])) {
  24855. $peerCertificate = $params['options']['ssl']['peer_certificate'];
  24856. if (TlsHelper::checkCertificateHost($peerCertificate, parse_url($url, PHP_URL_HOST), $commonName)) {
  24857. return array(
  24858. 'cn' => $commonName,
  24859. 'fp' => TlsHelper::getCertificateFingerprint($peerCertificate),
  24860. );
  24861. }
  24862. }
  24863. }
  24864. private function getUrlAuthority($url)
  24865. {
  24866. $defaultPorts = array(
  24867. 'ftp' => 21,
  24868. 'http' => 80,
  24869. 'https' => 443,
  24870. 'ssh2.sftp' => 22,
  24871. 'ssh2.scp' => 22,
  24872. );
  24873. $scheme = parse_url($url, PHP_URL_SCHEME);
  24874. if (!isset($defaultPorts[$scheme])) {
  24875. throw new \InvalidArgumentException(sprintf(
  24876. 'Could not get default port for unknown scheme: %s',
  24877. $scheme
  24878. ));
  24879. }
  24880. $defaultPort = $defaultPorts[$scheme];
  24881. $port = parse_url($url, PHP_URL_PORT) ?: $defaultPort;
  24882. return parse_url($url, PHP_URL_HOST).':'.$port;
  24883. }
  24884. }
  24885. <?php
  24886. namespace Composer\Util;
  24887. class Silencer
  24888. {
  24889. private static $stack = array();
  24890. public static function suppress($mask = null)
  24891. {
  24892. if (!isset($mask)) {
  24893. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  24894. }
  24895. $old = error_reporting();
  24896. array_push(self::$stack, $old);
  24897. error_reporting($old & ~$mask);
  24898. return $old;
  24899. }
  24900. public static function restore()
  24901. {
  24902. if (!empty(self::$stack)) {
  24903. error_reporting(array_pop(self::$stack));
  24904. }
  24905. }
  24906. public static function call($callable )
  24907. {
  24908. try {
  24909. self::suppress();
  24910. $result = call_user_func_array($callable, array_slice(func_get_args(), 1));
  24911. self::restore();
  24912. return $result;
  24913. } catch (\Exception $e) {
  24914. self::restore();
  24915. throw $e;
  24916. }
  24917. }
  24918. }
  24919. <?php
  24920. namespace Composer\Util;
  24921. use Composer\Spdx\SpdxLicenses;
  24922. trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
  24923. class SpdxLicense extends SpdxLicenses
  24924. {
  24925. }
  24926. <?php
  24927. namespace Composer\Util;
  24928. use Composer\Composer;
  24929. final class StreamContextFactory
  24930. {
  24931. public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
  24932. {
  24933. $options = array('http' => array(
  24934. 'follow_location' => 1,
  24935. 'max_redirects' => 20,
  24936. ));
  24937. if (PHP_SAPI === 'cli' && (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy']))) {
  24938. $proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
  24939. }
  24940. if (!empty($_SERVER['CGI_HTTP_PROXY'])) {
  24941. $proxy = parse_url($_SERVER['CGI_HTTP_PROXY']);
  24942. }
  24943. if (preg_match('{^https://}i', $url) && (!empty($_SERVER['HTTPS_PROXY']) || !empty($_SERVER['https_proxy']))) {
  24944. $proxy = parse_url(!empty($_SERVER['https_proxy']) ? $_SERVER['https_proxy'] : $_SERVER['HTTPS_PROXY']);
  24945. }
  24946. if (!empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
  24947. $pattern = new NoProxyPattern($_SERVER['no_proxy']);
  24948. if ($pattern->test($url)) {
  24949. unset($proxy);
  24950. }
  24951. }
  24952. if (!empty($proxy)) {
  24953. $proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
  24954. $proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
  24955. if (isset($proxy['port'])) {
  24956. $proxyURL .= ":" . $proxy['port'];
  24957. } elseif ('http://' == substr($proxyURL, 0, 7)) {
  24958. $proxyURL .= ":80";
  24959. } elseif ('https://' == substr($proxyURL, 0, 8)) {
  24960. $proxyURL .= ":443";
  24961. }
  24962. $proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
  24963. if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
  24964. throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
  24965. }
  24966. $options['http']['proxy'] = $proxyURL;
  24967. switch (parse_url($url, PHP_URL_SCHEME)) {
  24968. case 'http':
  24969. $reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
  24970. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  24971. $options['http']['request_fulluri'] = true;
  24972. }
  24973. break;
  24974. case 'https':
  24975. $reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
  24976. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  24977. $options['http']['request_fulluri'] = true;
  24978. }
  24979. break;
  24980. }
  24981. if ('https' === parse_url($url, PHP_URL_SCHEME)) {
  24982. $options['ssl']['SNI_enabled'] = true;
  24983. if (PHP_VERSION_ID < 50600) {
  24984. $options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
  24985. }
  24986. }
  24987. if (isset($proxy['user'])) {
  24988. $auth = urldecode($proxy['user']);
  24989. if (isset($proxy['pass'])) {
  24990. $auth .= ':' . urldecode($proxy['pass']);
  24991. }
  24992. $auth = base64_encode($auth);
  24993. if (isset($defaultOptions['http']['header'])) {
  24994. if (is_string($defaultOptions['http']['header'])) {
  24995. $defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
  24996. }
  24997. $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
  24998. } else {
  24999. $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
  25000. }
  25001. }
  25002. }
  25003. $options = array_replace_recursive($options, $defaultOptions);
  25004. if (isset($options['http']['header'])) {
  25005. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  25006. }
  25007. if (defined('HHVM_VERSION')) {
  25008. $phpVersion = 'HHVM ' . HHVM_VERSION;
  25009. } else {
  25010. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  25011. }
  25012. if (!isset($options['http']['header']) || false === strpos(strtolower(implode('', $options['http']['header'])), 'user-agent')) {
  25013. $options['http']['header'][] = sprintf(
  25014. 'User-Agent: Composer/%s (%s; %s; %s)',
  25015. Composer::VERSION === '@package_version@' ? 'source' : Composer::VERSION,
  25016. php_uname('s'),
  25017. php_uname('r'),
  25018. $phpVersion
  25019. );
  25020. }
  25021. return stream_context_create($options, $defaultParams);
  25022. }
  25023. private static function fixHttpHeaderField($header)
  25024. {
  25025. if (!is_array($header)) {
  25026. $header = explode("\r\n", $header);
  25027. }
  25028. uasort($header, function ($el) {
  25029. return preg_match('{^content-type}i', $el) ? 1 : -1;
  25030. });
  25031. return $header;
  25032. }
  25033. }
  25034. <?php
  25035. namespace Composer\Util;
  25036. use Composer\Config;
  25037. use Composer\IO\IOInterface;
  25038. class Svn
  25039. {
  25040. const MAX_QTY_AUTH_TRIES = 5;
  25041. protected $credentials;
  25042. protected $hasAuth;
  25043. protected $io;
  25044. protected $url;
  25045. protected $cacheCredentials = true;
  25046. protected $process;
  25047. protected $qtyAuthTries = 0;
  25048. protected $config;
  25049. public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  25050. {
  25051. $this->url = $url;
  25052. $this->io = $io;
  25053. $this->config = $config;
  25054. $this->process = $process ?: new ProcessExecutor;
  25055. }
  25056. public static function cleanEnv()
  25057. {
  25058. putenv("DYLD_LIBRARY_PATH");
  25059. unset($_SERVER['DYLD_LIBRARY_PATH']);
  25060. }
  25061. public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
  25062. {
  25063. $this->config->prohibitUrlByConfig($url, $this->io);
  25064. $svnCommand = $this->getCommand($command, $url, $path);
  25065. $output = null;
  25066. $io = $this->io;
  25067. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  25068. if ($type !== 'out') {
  25069. return;
  25070. }
  25071. if ('Redirecting to URL ' === substr($buffer, 0, 19)) {
  25072. return;
  25073. }
  25074. $output .= $buffer;
  25075. if ($verbose) {
  25076. $io->writeError($buffer, false);
  25077. }
  25078. };
  25079. $status = $this->process->execute($svnCommand, $handler, $cwd);
  25080. if (0 === $status) {
  25081. return $output;
  25082. }
  25083. $errorOutput = $this->process->getErrorOutput();
  25084. $fullOutput = implode("\n", array($output, $errorOutput));
  25085. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  25086. && false === stripos($fullOutput, 'authorization failed')
  25087. && false === stripos($fullOutput, 'svn: E170001:')
  25088. && false === stripos($fullOutput, 'svn: E215004:')) {
  25089. throw new \RuntimeException($fullOutput);
  25090. }
  25091. if (!$this->hasAuth()) {
  25092. $this->doAuthDance();
  25093. }
  25094. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  25095. return $this->execute($command, $url, $cwd, $path, $verbose);
  25096. }
  25097. throw new \RuntimeException(
  25098. 'wrong credentials provided ('.$fullOutput.')'
  25099. );
  25100. }
  25101. public function setCacheCredentials($cacheCredentials)
  25102. {
  25103. $this->cacheCredentials = $cacheCredentials;
  25104. }
  25105. protected function doAuthDance()
  25106. {
  25107. if (!$this->io->isInteractive()) {
  25108. throw new \RuntimeException(
  25109. 'can not ask for authentication in non interactive mode'
  25110. );
  25111. }
  25112. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  25113. $this->hasAuth = true;
  25114. $this->credentials['username'] = $this->io->ask("Username: ");
  25115. $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
  25116. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
  25117. return $this;
  25118. }
  25119. protected function getCommand($cmd, $url, $path = null)
  25120. {
  25121. $cmd = sprintf('%s %s%s %s',
  25122. $cmd,
  25123. '--non-interactive ',
  25124. $this->getCredentialString(),
  25125. ProcessExecutor::escape($url)
  25126. );
  25127. if ($path) {
  25128. $cmd .= ' ' . ProcessExecutor::escape($path);
  25129. }
  25130. return $cmd;
  25131. }
  25132. protected function getCredentialString()
  25133. {
  25134. if (!$this->hasAuth()) {
  25135. return '';
  25136. }
  25137. return sprintf(
  25138. ' %s--username %s --password %s ',
  25139. $this->getAuthCache(),
  25140. ProcessExecutor::escape($this->getUsername()),
  25141. ProcessExecutor::escape($this->getPassword())
  25142. );
  25143. }
  25144. protected function getPassword()
  25145. {
  25146. if ($this->credentials === null) {
  25147. throw new \LogicException("No svn auth detected.");
  25148. }
  25149. return isset($this->credentials['password']) ? $this->credentials['password'] : '';
  25150. }
  25151. protected function getUsername()
  25152. {
  25153. if ($this->credentials === null) {
  25154. throw new \LogicException("No svn auth detected.");
  25155. }
  25156. return $this->credentials['username'];
  25157. }
  25158. protected function hasAuth()
  25159. {
  25160. if (null !== $this->hasAuth) {
  25161. return $this->hasAuth;
  25162. }
  25163. if (false === $this->createAuthFromConfig()) {
  25164. $this->createAuthFromUrl();
  25165. }
  25166. return $this->hasAuth;
  25167. }
  25168. protected function getAuthCache()
  25169. {
  25170. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  25171. }
  25172. private function createAuthFromConfig()
  25173. {
  25174. if (!$this->config->has('http-basic')) {
  25175. return $this->hasAuth = false;
  25176. }
  25177. $authConfig = $this->config->get('http-basic');
  25178. $host = parse_url($this->url, PHP_URL_HOST);
  25179. if (isset($authConfig[$host])) {
  25180. $this->credentials['username'] = $authConfig[$host]['username'];
  25181. $this->credentials['password'] = $authConfig[$host]['password'];
  25182. return $this->hasAuth = true;
  25183. }
  25184. return $this->hasAuth = false;
  25185. }
  25186. private function createAuthFromUrl()
  25187. {
  25188. $uri = parse_url($this->url);
  25189. if (empty($uri['user'])) {
  25190. return $this->hasAuth = false;
  25191. }
  25192. $this->credentials['username'] = $uri['user'];
  25193. if (!empty($uri['pass'])) {
  25194. $this->credentials['password'] = $uri['pass'];
  25195. }
  25196. return $this->hasAuth = true;
  25197. }
  25198. }
  25199. <?php
  25200. namespace Composer\Util;
  25201. use Symfony\Component\Process\PhpProcess;
  25202. use Composer\CaBundle\CaBundle;
  25203. final class TlsHelper
  25204. {
  25205. private static $useOpensslParse;
  25206. public static function checkCertificateHost($certificate, $hostname, &$cn = null)
  25207. {
  25208. $names = self::getCertificateNames($certificate);
  25209. if (empty($names)) {
  25210. return false;
  25211. }
  25212. $combinedNames = array_merge($names['san'], array($names['cn']));
  25213. $hostname = strtolower($hostname);
  25214. foreach ($combinedNames as $certName) {
  25215. $matcher = self::certNameMatcher($certName);
  25216. if ($matcher && $matcher($hostname)) {
  25217. $cn = $names['cn'];
  25218. return true;
  25219. }
  25220. }
  25221. return false;
  25222. }
  25223. public static function getCertificateNames($certificate)
  25224. {
  25225. if (is_array($certificate)) {
  25226. $info = $certificate;
  25227. } elseif (CaBundle::isOpensslParseSafe()) {
  25228. $info = openssl_x509_parse($certificate, false);
  25229. }
  25230. if (!isset($info['subject']['commonName'])) {
  25231. return null;
  25232. }
  25233. $commonName = strtolower($info['subject']['commonName']);
  25234. $subjectAltNames = array();
  25235. if (isset($info['extensions']['subjectAltName'])) {
  25236. $subjectAltNames = preg_split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  25237. $subjectAltNames = array_filter(array_map(function ($name) {
  25238. if (0 === strpos($name, 'DNS:')) {
  25239. return strtolower(ltrim(substr($name, 4)));
  25240. }
  25241. return null;
  25242. }, $subjectAltNames));
  25243. $subjectAltNames = array_values($subjectAltNames);
  25244. }
  25245. return array(
  25246. 'cn' => $commonName,
  25247. 'san' => $subjectAltNames,
  25248. );
  25249. }
  25250. public static function getCertificateFingerprint($certificate)
  25251. {
  25252. $pubkeydetails = openssl_pkey_get_details(openssl_get_publickey($certificate));
  25253. $pubkeypem = $pubkeydetails['key'];
  25254. $start = '-----BEGIN PUBLIC KEY-----';
  25255. $end = '-----END PUBLIC KEY-----';
  25256. $pemtrim = substr($pubkeypem, (strpos($pubkeypem, $start) + strlen($start)), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  25257. $der = base64_decode($pemtrim);
  25258. return sha1($der);
  25259. }
  25260. public static function isOpensslParseSafe()
  25261. {
  25262. return CaBundle::isOpensslParseSafe();
  25263. }
  25264. private static function certNameMatcher($certName)
  25265. {
  25266. $wildcards = substr_count($certName, '*');
  25267. if (0 === $wildcards) {
  25268. return function ($hostname) use ($certName) {
  25269. return $hostname === $certName;
  25270. };
  25271. }
  25272. if (1 === $wildcards) {
  25273. $components = explode('.', $certName);
  25274. if (3 > count($components)) {
  25275. return;
  25276. }
  25277. $firstComponent = $components[0];
  25278. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  25279. return;
  25280. }
  25281. $wildcardRegex = preg_quote($certName);
  25282. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  25283. $wildcardRegex = "{^{$wildcardRegex}$}";
  25284. return function ($hostname) use ($wildcardRegex) {
  25285. return 1 === preg_match($wildcardRegex, $hostname);
  25286. };
  25287. }
  25288. }
  25289. }
  25290. <?php
  25291. function includeIfExists($file)
  25292. {
  25293. return file_exists($file) ? include $file : false;
  25294. }
  25295. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  25296. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  25297. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  25298. exit(1);
  25299. }
  25300. return $loader;
  25301. <?php
  25302. /*
  25303. * This file is part of Composer.
  25304. *
  25305. * (c) Nils Adermann <naderman@naderman.de>
  25306. * Jordi Boggiano <j.boggiano@seld.be>
  25307. *
  25308. * For the full copyright and license information, please view the LICENSE
  25309. * file that was distributed with this source code.
  25310. */
  25311. namespace Composer\Autoload;
  25312. /**
  25313. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  25314. *
  25315. * $loader = new \Composer\Autoload\ClassLoader();
  25316. *
  25317. * // register classes with namespaces
  25318. * $loader->add('Symfony\Component', __DIR__.'/component');
  25319. * $loader->add('Symfony', __DIR__.'/framework');
  25320. *
  25321. * // activate the autoloader
  25322. * $loader->register();
  25323. *
  25324. * // to enable searching the include path (eg. for PEAR packages)
  25325. * $loader->setUseIncludePath(true);
  25326. *
  25327. * In this example, if you try to use a class in the Symfony\Component
  25328. * namespace or one of its children (Symfony\Component\Console for instance),
  25329. * the autoloader will first look for the class under the component/
  25330. * directory, and it will then fallback to the framework/ directory if not
  25331. * found before giving up.
  25332. *
  25333. * This class is loosely based on the Symfony UniversalClassLoader.
  25334. *
  25335. * @author Fabien Potencier <fabien@symfony.com>
  25336. * @author Jordi Boggiano <j.boggiano@seld.be>
  25337. * @see http://www.php-fig.org/psr/psr-0/
  25338. * @see http://www.php-fig.org/psr/psr-4/
  25339. */
  25340. class ClassLoader
  25341. {
  25342. // PSR-4
  25343. private $prefixLengthsPsr4 = array();
  25344. private $prefixDirsPsr4 = array();
  25345. private $fallbackDirsPsr4 = array();
  25346. // PSR-0
  25347. private $prefixesPsr0 = array();
  25348. private $fallbackDirsPsr0 = array();
  25349. private $useIncludePath = false;
  25350. private $classMap = array();
  25351. private $classMapAuthoritative = false;
  25352. private $missingClasses = array();
  25353. public function getPrefixes()
  25354. {
  25355. if (!empty($this->prefixesPsr0)) {
  25356. return call_user_func_array('array_merge', $this->prefixesPsr0);
  25357. }
  25358. return array();
  25359. }
  25360. public function getPrefixesPsr4()
  25361. {
  25362. return $this->prefixDirsPsr4;
  25363. }
  25364. public function getFallbackDirs()
  25365. {
  25366. return $this->fallbackDirsPsr0;
  25367. }
  25368. public function getFallbackDirsPsr4()
  25369. {
  25370. return $this->fallbackDirsPsr4;
  25371. }
  25372. public function getClassMap()
  25373. {
  25374. return $this->classMap;
  25375. }
  25376. /**
  25377. * @param array $classMap Class to filename map
  25378. */
  25379. public function addClassMap(array $classMap)
  25380. {
  25381. if ($this->classMap) {
  25382. $this->classMap = array_merge($this->classMap, $classMap);
  25383. } else {
  25384. $this->classMap = $classMap;
  25385. }
  25386. }
  25387. /**
  25388. * Registers a set of PSR-0 directories for a given prefix, either
  25389. * appending or prepending to the ones previously set for this prefix.
  25390. *
  25391. * @param string $prefix The prefix
  25392. * @param array|string $paths The PSR-0 root directories
  25393. * @param bool $prepend Whether to prepend the directories
  25394. */
  25395. public function add($prefix, $paths, $prepend = false)
  25396. {
  25397. if (!$prefix) {
  25398. if ($prepend) {
  25399. $this->fallbackDirsPsr0 = array_merge(
  25400. (array) $paths,
  25401. $this->fallbackDirsPsr0
  25402. );
  25403. } else {
  25404. $this->fallbackDirsPsr0 = array_merge(
  25405. $this->fallbackDirsPsr0,
  25406. (array) $paths
  25407. );
  25408. }
  25409. return;
  25410. }
  25411. $first = $prefix[0];
  25412. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  25413. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  25414. return;
  25415. }
  25416. if ($prepend) {
  25417. $this->prefixesPsr0[$first][$prefix] = array_merge(
  25418. (array) $paths,
  25419. $this->prefixesPsr0[$first][$prefix]
  25420. );
  25421. } else {
  25422. $this->prefixesPsr0[$first][$prefix] = array_merge(
  25423. $this->prefixesPsr0[$first][$prefix],
  25424. (array) $paths
  25425. );
  25426. }
  25427. }
  25428. /**
  25429. * Registers a set of PSR-4 directories for a given namespace, either
  25430. * appending or prepending to the ones previously set for this namespace.
  25431. *
  25432. * @param string $prefix The prefix/namespace, with trailing '\\'
  25433. * @param array|string $paths The PSR-4 base directories
  25434. * @param bool $prepend Whether to prepend the directories
  25435. *
  25436. * @throws \InvalidArgumentException
  25437. */
  25438. public function addPsr4($prefix, $paths, $prepend = false)
  25439. {
  25440. if (!$prefix) {
  25441. // Register directories for the root namespace.
  25442. if ($prepend) {
  25443. $this->fallbackDirsPsr4 = array_merge(
  25444. (array) $paths,
  25445. $this->fallbackDirsPsr4
  25446. );
  25447. } else {
  25448. $this->fallbackDirsPsr4 = array_merge(
  25449. $this->fallbackDirsPsr4,
  25450. (array) $paths
  25451. );
  25452. }
  25453. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  25454. // Register directories for a new namespace.
  25455. $length = strlen($prefix);
  25456. if ('\\' !== $prefix[$length - 1]) {
  25457. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  25458. }
  25459. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  25460. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  25461. } elseif ($prepend) {
  25462. // Prepend directories for an already registered namespace.
  25463. $this->prefixDirsPsr4[$prefix] = array_merge(
  25464. (array) $paths,
  25465. $this->prefixDirsPsr4[$prefix]
  25466. );
  25467. } else {
  25468. // Append directories for an already registered namespace.
  25469. $this->prefixDirsPsr4[$prefix] = array_merge(
  25470. $this->prefixDirsPsr4[$prefix],
  25471. (array) $paths
  25472. );
  25473. }
  25474. }
  25475. /**
  25476. * Registers a set of PSR-0 directories for a given prefix,
  25477. * replacing any others previously set for this prefix.
  25478. *
  25479. * @param string $prefix The prefix
  25480. * @param array|string $paths The PSR-0 base directories
  25481. */
  25482. public function set($prefix, $paths)
  25483. {
  25484. if (!$prefix) {
  25485. $this->fallbackDirsPsr0 = (array) $paths;
  25486. } else {
  25487. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  25488. }
  25489. }
  25490. /**
  25491. * Registers a set of PSR-4 directories for a given namespace,
  25492. * replacing any others previously set for this namespace.
  25493. *
  25494. * @param string $prefix The prefix/namespace, with trailing '\\'
  25495. * @param array|string $paths The PSR-4 base directories
  25496. *
  25497. * @throws \InvalidArgumentException
  25498. */
  25499. public function setPsr4($prefix, $paths)
  25500. {
  25501. if (!$prefix) {
  25502. $this->fallbackDirsPsr4 = (array) $paths;
  25503. } else {
  25504. $length = strlen($prefix);
  25505. if ('\\' !== $prefix[$length - 1]) {
  25506. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  25507. }
  25508. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  25509. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  25510. }
  25511. }
  25512. /**
  25513. * Turns on searching the include path for class files.
  25514. *
  25515. * @param bool $useIncludePath
  25516. */
  25517. public function setUseIncludePath($useIncludePath)
  25518. {
  25519. $this->useIncludePath = $useIncludePath;
  25520. }
  25521. /**
  25522. * Can be used to check if the autoloader uses the include path to check
  25523. * for classes.
  25524. *
  25525. * @return bool
  25526. */
  25527. public function getUseIncludePath()
  25528. {
  25529. return $this->useIncludePath;
  25530. }
  25531. /**
  25532. * Turns off searching the prefix and fallback directories for classes
  25533. * that have not been registered with the class map.
  25534. *
  25535. * @param bool $classMapAuthoritative
  25536. */
  25537. public function setClassMapAuthoritative($classMapAuthoritative)
  25538. {
  25539. $this->classMapAuthoritative = $classMapAuthoritative;
  25540. }
  25541. /**
  25542. * Should class lookup fail if not found in the current class map?
  25543. *
  25544. * @return bool
  25545. */
  25546. public function isClassMapAuthoritative()
  25547. {
  25548. return $this->classMapAuthoritative;
  25549. }
  25550. /**
  25551. * Registers this instance as an autoloader.
  25552. *
  25553. * @param bool $prepend Whether to prepend the autoloader or not
  25554. */
  25555. public function register($prepend = false)
  25556. {
  25557. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  25558. }
  25559. /**
  25560. * Unregisters this instance as an autoloader.
  25561. */
  25562. public function unregister()
  25563. {
  25564. spl_autoload_unregister(array($this, 'loadClass'));
  25565. }
  25566. /**
  25567. * Loads the given class or interface.
  25568. *
  25569. * @param string $class The name of the class
  25570. * @return bool|null True if loaded, null otherwise
  25571. */
  25572. public function loadClass($class)
  25573. {
  25574. if ($file = $this->findFile($class)) {
  25575. includeFile($file);
  25576. return true;
  25577. }
  25578. }
  25579. /**
  25580. * Finds the path to the file where the class is defined.
  25581. *
  25582. * @param string $class The name of the class
  25583. *
  25584. * @return string|false The path if found, false otherwise
  25585. */
  25586. public function findFile($class)
  25587. {
  25588. // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
  25589. if ('\\' == $class[0]) {
  25590. $class = substr($class, 1);
  25591. }
  25592. // class map lookup
  25593. if (isset($this->classMap[$class])) {
  25594. return $this->classMap[$class];
  25595. }
  25596. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  25597. return false;
  25598. }
  25599. $file = $this->findFileWithExtension($class, '.php');
  25600. // Search for Hack files if we are running on HHVM
  25601. if (false === $file && defined('HHVM_VERSION')) {
  25602. $file = $this->findFileWithExtension($class, '.hh');
  25603. }
  25604. if (false === $file) {
  25605. // Remember that this class does not exist.
  25606. $this->missingClasses[$class] = true;
  25607. }
  25608. return $file;
  25609. }
  25610. private function findFileWithExtension($class, $ext)
  25611. {
  25612. // PSR-4 lookup
  25613. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  25614. $first = $class[0];
  25615. if (isset($this->prefixLengthsPsr4[$first])) {
  25616. foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
  25617. if (0 === strpos($class, $prefix)) {
  25618. foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
  25619. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
  25620. return $file;
  25621. }
  25622. }
  25623. }
  25624. }
  25625. }
  25626. // PSR-4 fallback dirs
  25627. foreach ($this->fallbackDirsPsr4 as $dir) {
  25628. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  25629. return $file;
  25630. }
  25631. }
  25632. // PSR-0 lookup
  25633. if (false !== $pos = strrpos($class, '\\')) {
  25634. // namespaced class name
  25635. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  25636. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  25637. } else {
  25638. // PEAR-like class name
  25639. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  25640. }
  25641. if (isset($this->prefixesPsr0[$first])) {
  25642. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  25643. if (0 === strpos($class, $prefix)) {
  25644. foreach ($dirs as $dir) {
  25645. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  25646. return $file;
  25647. }
  25648. }
  25649. }
  25650. }
  25651. }
  25652. // PSR-0 fallback dirs
  25653. foreach ($this->fallbackDirsPsr0 as $dir) {
  25654. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  25655. return $file;
  25656. }
  25657. }
  25658. // PSR-0 include paths.
  25659. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  25660. return $file;
  25661. }
  25662. return false;
  25663. }
  25664. }
  25665. /**
  25666. * Scope isolated include.
  25667. *
  25668. * Prevents access to $this/self from included files.
  25669. */
  25670. function includeFile($file)
  25671. {
  25672. include $file;
  25673. }
  25674. {
  25675. "$schema": "http://json-schema.org/draft-04/schema#",
  25676. "name": "Package",
  25677. "type": "object",
  25678. "additionalProperties": false,
  25679. "required": [ "name", "description" ],
  25680. "properties": {
  25681. "name": {
  25682. "type": "string",
  25683. "description": "Package name, including 'vendor-name/' prefix."
  25684. },
  25685. "type": {
  25686. "description": "Package type, either 'library' for common packages, 'composer-plugin' for plugins, 'metapackage' for empty packages, or a custom type ([a-z0-9-]+) defined by whatever project this package applies to.",
  25687. "type": "string"
  25688. },
  25689. "target-dir": {
  25690. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  25691. "type": "string"
  25692. },
  25693. "description": {
  25694. "type": "string",
  25695. "description": "Short package description."
  25696. },
  25697. "keywords": {
  25698. "type": "array",
  25699. "items": {
  25700. "type": "string",
  25701. "description": "A tag/keyword that this package relates to."
  25702. }
  25703. },
  25704. "homepage": {
  25705. "type": "string",
  25706. "description": "Homepage URL for the project.",
  25707. "format": "uri"
  25708. },
  25709. "version": {
  25710. "type": "string",
  25711. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes."
  25712. },
  25713. "time": {
  25714. "type": "string",
  25715. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  25716. },
  25717. "license": {
  25718. "type": ["string", "array"],
  25719. "description": "License name. Or an array of license names."
  25720. },
  25721. "authors": {
  25722. "type": "array",
  25723. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  25724. "items": {
  25725. "type": "object",
  25726. "additionalProperties": false,
  25727. "required": [ "name"],
  25728. "properties": {
  25729. "name": {
  25730. "type": "string",
  25731. "description": "Full name of the author."
  25732. },
  25733. "email": {
  25734. "type": "string",
  25735. "description": "Email address of the author.",
  25736. "format": "email"
  25737. },
  25738. "homepage": {
  25739. "type": "string",
  25740. "description": "Homepage URL for the author.",
  25741. "format": "uri"
  25742. },
  25743. "role": {
  25744. "type": "string",
  25745. "description": "Author's role in the project."
  25746. }
  25747. }
  25748. }
  25749. },
  25750. "require": {
  25751. "type": "object",
  25752. "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
  25753. "additionalProperties": true
  25754. },
  25755. "replace": {
  25756. "type": "object",
  25757. "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
  25758. "additionalProperties": true
  25759. },
  25760. "conflict": {
  25761. "type": "object",
  25762. "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
  25763. "additionalProperties": true
  25764. },
  25765. "provide": {
  25766. "type": "object",
  25767. "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  25768. "additionalProperties": true
  25769. },
  25770. "require-dev": {
  25771. "type": "object",
  25772. "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  25773. "additionalProperties": true
  25774. },
  25775. "suggest": {
  25776. "type": "object",
  25777. "description": "This is a hash of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).",
  25778. "additionalProperties": true
  25779. },
  25780. "config": {
  25781. "type": "object",
  25782. "description": "Composer options.",
  25783. "properties": {
  25784. "process-timeout": {
  25785. "type": "integer",
  25786. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  25787. },
  25788. "use-include-path": {
  25789. "type": "boolean",
  25790. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  25791. },
  25792. "preferred-install": {
  25793. "type": ["string", "object"],
  25794. "description": "The install method Composer will prefer to use, defaults to auto and can be any of source, dist, auto, or a hash of {\"pattern\": \"preference\"}."
  25795. },
  25796. "notify-on-install": {
  25797. "type": "boolean",
  25798. "description": "Composer allows repositories to define a notification URL, so that they get notified whenever a package from that repository is installed. This option allows you to disable that behaviour, defaults to true."
  25799. },
  25800. "github-protocols": {
  25801. "type": "array",
  25802. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  25803. "items": {
  25804. "type": "string"
  25805. }
  25806. },
  25807. "github-oauth": {
  25808. "type": "object",
  25809. "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  25810. "additionalProperties": true
  25811. },
  25812. "gitlab-oauth": {
  25813. "type": "object",
  25814. "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  25815. "additionalProperties": true
  25816. },
  25817. "disable-tls": {
  25818. "type": "boolean",
  25819. "description": "Defaults to `false`. If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed. Enabling this is a security risk and is NOT recommended. The better way is to enable the php_openssl extension in php.ini."
  25820. },
  25821. "secure-http": {
  25822. "type": "boolean",
  25823. "description": "Defaults to `true`. If set to true only HTTPS URLs are allowed to be downloaded via Composer. If you really absolutely need HTTP access to something then you can disable it, but using \"Let's Encrypt\" to get a free SSL certificate is generally a better alternative."
  25824. },
  25825. "cafile": {
  25826. "type": "string",
  25827. "description": "A way to set the path to the openssl CA file. In PHP 5.6+ you should rather set this via openssl.cafile in php.ini, although PHP 5.6+ should be able to detect your system CA file automatically."
  25828. },
  25829. "capath": {
  25830. "type": "string",
  25831. "description": "If cafile is not specified or if the certificate is not found there, the directory pointed to by capath is searched for a suitable certificate. capath must be a correctly hashed certificate directory."
  25832. },
  25833. "http-basic": {
  25834. "type": "object",
  25835. "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  25836. "additionalProperties": true
  25837. },
  25838. "store-auths": {
  25839. "type": ["string", "boolean"],
  25840. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  25841. },
  25842. "platform": {
  25843. "type": "object",
  25844. "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  25845. "additionalProperties": true
  25846. },
  25847. "vendor-dir": {
  25848. "type": "string",
  25849. "description": "The location where all packages are installed, defaults to \"vendor\"."
  25850. },
  25851. "bin-dir": {
  25852. "type": "string",
  25853. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  25854. },
  25855. "data-dir": {
  25856. "type": "string",
  25857. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  25858. },
  25859. "cache-dir": {
  25860. "type": "string",
  25861. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  25862. },
  25863. "cache-files-dir": {
  25864. "type": "string",
  25865. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  25866. },
  25867. "cache-repo-dir": {
  25868. "type": "string",
  25869. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  25870. },
  25871. "cache-vcs-dir": {
  25872. "type": "string",
  25873. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  25874. },
  25875. "cache-ttl": {
  25876. "type": "integer",
  25877. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  25878. },
  25879. "cache-files-ttl": {
  25880. "type": "integer",
  25881. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  25882. },
  25883. "cache-files-maxsize": {
  25884. "type": ["string", "integer"],
  25885. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  25886. },
  25887. "bin-compat": {
  25888. "enum": ["auto", "full"],
  25889. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
  25890. },
  25891. "discard-changes": {
  25892. "type": ["string", "boolean"],
  25893. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  25894. },
  25895. "autoloader-suffix": {
  25896. "type": "string",
  25897. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  25898. },
  25899. "optimize-autoloader": {
  25900. "type": "boolean",
  25901. "description": "Always optimize when dumping the autoloader."
  25902. },
  25903. "prepend-autoloader": {
  25904. "type": "boolean",
  25905. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  25906. },
  25907. "classmap-authoritative": {
  25908. "type": "boolean",
  25909. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  25910. },
  25911. "github-domains": {
  25912. "type": "array",
  25913. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  25914. "items": {
  25915. "type": "string"
  25916. }
  25917. },
  25918. "github-expose-hostname": {
  25919. "type": "boolean",
  25920. "description": "Defaults to true. If set to false, the OAuth tokens created to access the github API will have a date instead of the machine hostname."
  25921. },
  25922. "gitlab-domains": {
  25923. "type": "array",
  25924. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  25925. "items": {
  25926. "type": "string"
  25927. }
  25928. },
  25929. "archive-format": {
  25930. "type": "string",
  25931. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  25932. },
  25933. "archive-dir": {
  25934. "type": "string",
  25935. "description": "The default archive path when not provided on cli, defaults to \".\"."
  25936. }
  25937. }
  25938. },
  25939. "extra": {
  25940. "type": ["object", "array"],
  25941. "description": "Arbitrary extra data that can be used by plugins, for example, package of type composer-plugin may have a 'class' key defining an installer class name.",
  25942. "additionalProperties": true
  25943. },
  25944. "autoload": {
  25945. "type": "object",
  25946. "description": "Description of how the package can be autoloaded.",
  25947. "properties": {
  25948. "psr-0": {
  25949. "type": "object",
  25950. "description": "This is a hash of namespaces (keys) and the directories they can be found in (values, can be arrays of paths) by the autoloader.",
  25951. "additionalProperties": true
  25952. },
  25953. "psr-4": {
  25954. "type": "object",
  25955. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  25956. "additionalProperties": true
  25957. },
  25958. "classmap": {
  25959. "type": "array",
  25960. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  25961. },
  25962. "files": {
  25963. "type": "array",
  25964. "description": "This is an array of files that are always required on every request."
  25965. },
  25966. "exclude-from-classmap": {
  25967. "type": "array",
  25968. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  25969. }
  25970. }
  25971. },
  25972. "autoload-dev": {
  25973. "type": "object",
  25974. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  25975. "properties": {
  25976. "psr-0": {
  25977. "type": "object",
  25978. "description": "This is a hash of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
  25979. "additionalProperties": true
  25980. },
  25981. "psr-4": {
  25982. "type": "object",
  25983. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  25984. "additionalProperties": true
  25985. },
  25986. "classmap": {
  25987. "type": "array",
  25988. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  25989. },
  25990. "files": {
  25991. "type": "array",
  25992. "description": "This is an array of files that are always required on every request."
  25993. }
  25994. }
  25995. },
  25996. "archive": {
  25997. "type": ["object"],
  25998. "description": "Options for creating package archives for distribution.",
  25999. "properties": {
  26000. "exclude": {
  26001. "type": "array",
  26002. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  26003. }
  26004. }
  26005. },
  26006. "repositories": {
  26007. "type": ["object", "array"],
  26008. "description": "A set of additional repositories where packages can be found.",
  26009. "additionalProperties": true
  26010. },
  26011. "minimum-stability": {
  26012. "type": ["string"],
  26013. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  26014. "pattern": "^dev|alpha|beta|rc|RC|stable$"
  26015. },
  26016. "prefer-stable": {
  26017. "type": ["boolean"],
  26018. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  26019. },
  26020. "bin": {
  26021. "type": ["array"],
  26022. "description": "A set of files that should be treated as binaries and symlinked into bin-dir (from config).",
  26023. "items": {
  26024. "type": "string"
  26025. }
  26026. },
  26027. "include-path": {
  26028. "type": ["array"],
  26029. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  26030. "items": {
  26031. "type": "string"
  26032. }
  26033. },
  26034. "scripts": {
  26035. "type": ["object"],
  26036. "description": "Scripts listeners that will be executed before/after some events.",
  26037. "properties": {
  26038. "pre-install-cmd": {
  26039. "type": ["array", "string"],
  26040. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  26041. },
  26042. "post-install-cmd": {
  26043. "type": ["array", "string"],
  26044. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  26045. },
  26046. "pre-update-cmd": {
  26047. "type": ["array", "string"],
  26048. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  26049. },
  26050. "post-update-cmd": {
  26051. "type": ["array", "string"],
  26052. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  26053. },
  26054. "pre-status-cmd": {
  26055. "type": ["array", "string"],
  26056. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  26057. },
  26058. "post-status-cmd": {
  26059. "type": ["array", "string"],
  26060. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  26061. },
  26062. "pre-package-install": {
  26063. "type": ["array", "string"],
  26064. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  26065. },
  26066. "post-package-install": {
  26067. "type": ["array", "string"],
  26068. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  26069. },
  26070. "pre-package-update": {
  26071. "type": ["array", "string"],
  26072. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  26073. },
  26074. "post-package-update": {
  26075. "type": ["array", "string"],
  26076. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  26077. },
  26078. "pre-package-uninstall": {
  26079. "type": ["array", "string"],
  26080. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  26081. },
  26082. "post-package-uninstall": {
  26083. "type": ["array", "string"],
  26084. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  26085. },
  26086. "pre-autoload-dump": {
  26087. "type": ["array", "string"],
  26088. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  26089. },
  26090. "post-autoload-dump": {
  26091. "type": ["array", "string"],
  26092. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  26093. },
  26094. "post-root-package-install": {
  26095. "type": ["array", "string"],
  26096. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  26097. },
  26098. "post-create-project-cmd": {
  26099. "type": ["array", "string"],
  26100. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  26101. }
  26102. }
  26103. },
  26104. "support": {
  26105. "type": "object",
  26106. "properties": {
  26107. "email": {
  26108. "type": "string",
  26109. "description": "Email address for support.",
  26110. "format": "email"
  26111. },
  26112. "issues": {
  26113. "type": "string",
  26114. "description": "URL to the issue tracker.",
  26115. "format": "uri"
  26116. },
  26117. "forum": {
  26118. "type": "string",
  26119. "description": "URL to the forum.",
  26120. "format": "uri"
  26121. },
  26122. "wiki": {
  26123. "type": "string",
  26124. "description": "URL to the wiki.",
  26125. "format": "uri"
  26126. },
  26127. "irc": {
  26128. "type": "string",
  26129. "description": "IRC channel for support, as irc://server/channel.",
  26130. "format": "uri"
  26131. },
  26132. "source": {
  26133. "type": "string",
  26134. "description": "URL to browse or download the sources.",
  26135. "format": "uri"
  26136. },
  26137. "docs": {
  26138. "type": "string",
  26139. "description": "URL to the documentation.",
  26140. "format": "uri"
  26141. },
  26142. "rss": {
  26143. "type": "string",
  26144. "description": "URL to the RSS feed.",
  26145. "format": "uri"
  26146. }
  26147. }
  26148. },
  26149. "non-feature-branches": {
  26150. "type": ["array"],
  26151. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  26152. "items": {
  26153. "type": "string"
  26154. }
  26155. },
  26156. "abandoned": {
  26157. "type": ["boolean", "string"],
  26158. "description": "Indicates whether this package has been abandoned, it can be boolean or a package name/URL pointing to a recommended alternative. Defaults to false."
  26159. },
  26160. "_comment": {
  26161. "type": ["array", "string"],
  26162. "description": "A key to store comments in"
  26163. }
  26164. }
  26165. }
  26166. {
  26167. "389-exception": [
  26168. "389 Directory Server\nException"
  26169. ],
  26170. "Autoconf-exception-2.0": [
  26171. "Autoconf exception 2.0"
  26172. ],
  26173. "Autoconf-exception-3.0": [
  26174. "Autoconf exception 3.0"
  26175. ],
  26176. "Bison-exception-2.2": [
  26177. "Bison exception 2.2"
  26178. ],
  26179. "Classpath-exception-2.0": [
  26180. "Classpath exception 2.0"
  26181. ],
  26182. "CLISP-exception-2.0": [
  26183. "CLISP exception 2.0"
  26184. ],
  26185. "DigiRule-FOSS-exception": [
  26186. "DigiRule FOSS License Exception"
  26187. ],
  26188. "eCos-exception-2.0": [
  26189. "eCos exception 2.0"
  26190. ],
  26191. "Fawkes-Runtime-exception": [
  26192. "Fawkes Runtime Exception"
  26193. ],
  26194. "FLTK-exception": [
  26195. "FLTK exception"
  26196. ],
  26197. "Font-exception-2.0": [
  26198. "Font exception 2.0"
  26199. ],
  26200. "freertos-exception-2.0": [
  26201. "FreeRTOS Exception 2.0"
  26202. ],
  26203. "GCC-exception-2.0": [
  26204. "GCC Runtime Library exception 2.0"
  26205. ],
  26206. "GCC-exception-3.1": [
  26207. "GCC Runtime Library exception 3.1"
  26208. ],
  26209. "gnu-javamail-exception": [
  26210. "GNU JavaMail exception"
  26211. ],
  26212. "i2p-gpl-java-exception": [
  26213. "i2p GPL+Java Exception"
  26214. ],
  26215. "Libtool-exception": [
  26216. "Libtool Exception"
  26217. ],
  26218. "LZMA-exception": [
  26219. "LZMA exception"
  26220. ],
  26221. "mif-exception": [
  26222. "Macros and Inline Functions Exception"
  26223. ],
  26224. "Nokia-Qt-exception-1.1": [
  26225. "Nokia Qt LGPL exception 1.1"
  26226. ],
  26227. "OCCT-exception-1.0": [
  26228. "Open CASCADE Exception 1.0"
  26229. ],
  26230. "openvpn-openssl-exception": [
  26231. "OpenVPN OpenSSL Exception"
  26232. ],
  26233. "Qwt-exception-1.0": [
  26234. "Qwt exception 1.0"
  26235. ],
  26236. "u-boot-exception-2.0": [
  26237. "U-Boot exception 2.0"
  26238. ],
  26239. "WxWindows-exception-3.1": [
  26240. "WxWindows Library Exception 3.1"
  26241. ]
  26242. }{
  26243. "0BSD": [
  26244. "BSD Zero Clause License",
  26245. true
  26246. ],
  26247. "AAL": [
  26248. "Attribution Assurance License",
  26249. true
  26250. ],
  26251. "Abstyles": [
  26252. "Abstyles License",
  26253. false
  26254. ],
  26255. "Adobe-2006": [
  26256. "Adobe Systems Incorporated Source Code License Agreement",
  26257. false
  26258. ],
  26259. "Adobe-Glyph": [
  26260. "Adobe Glyph List License",
  26261. false
  26262. ],
  26263. "ADSL": [
  26264. "Amazon Digital Services License",
  26265. false
  26266. ],
  26267. "AFL-1.1": [
  26268. "Academic Free License v1.1",
  26269. true
  26270. ],
  26271. "AFL-1.2": [
  26272. "Academic Free License v1.2",
  26273. true
  26274. ],
  26275. "AFL-2.0": [
  26276. "Academic Free License v2.0",
  26277. true
  26278. ],
  26279. "AFL-2.1": [
  26280. "Academic Free License v2.1",
  26281. true
  26282. ],
  26283. "AFL-3.0": [
  26284. "Academic Free License v3.0",
  26285. true
  26286. ],
  26287. "Afmparse": [
  26288. "Afmparse License",
  26289. false
  26290. ],
  26291. "AGPL-1.0": [
  26292. "Affero General Public License v1.0",
  26293. false
  26294. ],
  26295. "AGPL-3.0": [
  26296. "GNU Affero General Public License v3.0",
  26297. true
  26298. ],
  26299. "Aladdin": [
  26300. "Aladdin Free Public License",
  26301. false
  26302. ],
  26303. "AMDPLPA": [
  26304. "AMD's plpa_map.c License",
  26305. false
  26306. ],
  26307. "AML": [
  26308. "Apple MIT License",
  26309. false
  26310. ],
  26311. "AMPAS": [
  26312. "Academy of Motion Picture Arts and Sciences BSD",
  26313. false
  26314. ],
  26315. "ANTLR-PD": [
  26316. "ANTLR Software Rights Notice",
  26317. false
  26318. ],
  26319. "Apache-1.0": [
  26320. "Apache License 1.0",
  26321. false
  26322. ],
  26323. "Apache-1.1": [
  26324. "Apache License 1.1",
  26325. true
  26326. ],
  26327. "Apache-2.0": [
  26328. "Apache License 2.0",
  26329. true
  26330. ],
  26331. "APAFML": [
  26332. "Adobe Postscript AFM License",
  26333. false
  26334. ],
  26335. "APL-1.0": [
  26336. "Adaptive Public License 1.0",
  26337. true
  26338. ],
  26339. "APSL-1.0": [
  26340. "Apple Public Source License 1.0",
  26341. true
  26342. ],
  26343. "APSL-1.1": [
  26344. "Apple Public Source License 1.1",
  26345. true
  26346. ],
  26347. "APSL-1.2": [
  26348. "Apple Public Source License 1.2",
  26349. true
  26350. ],
  26351. "APSL-2.0": [
  26352. "Apple Public Source License 2.0",
  26353. true
  26354. ],
  26355. "Artistic-1.0": [
  26356. "Artistic License 1.0",
  26357. true
  26358. ],
  26359. "Artistic-1.0-cl8": [
  26360. "Artistic License 1.0 w/clause 8",
  26361. true
  26362. ],
  26363. "Artistic-1.0-Perl": [
  26364. "Artistic License 1.0 (Perl)",
  26365. true
  26366. ],
  26367. "Artistic-2.0": [
  26368. "Artistic License 2.0",
  26369. true
  26370. ],
  26371. "Bahyph": [
  26372. "Bahyph License",
  26373. false
  26374. ],
  26375. "Barr": [
  26376. "Barr License",
  26377. false
  26378. ],
  26379. "Beerware": [
  26380. "Beerware License",
  26381. false
  26382. ],
  26383. "BitTorrent-1.0": [
  26384. "BitTorrent Open Source License v1.0",
  26385. false
  26386. ],
  26387. "BitTorrent-1.1": [
  26388. "BitTorrent Open Source License v1.1",
  26389. false
  26390. ],
  26391. "Borceux": [
  26392. "Borceux license",
  26393. false
  26394. ],
  26395. "BSD-2-Clause": [
  26396. "BSD 2-clause \"Simplified\" License",
  26397. true
  26398. ],
  26399. "BSD-2-Clause-FreeBSD": [
  26400. "BSD 2-clause FreeBSD License",
  26401. false
  26402. ],
  26403. "BSD-2-Clause-NetBSD": [
  26404. "BSD 2-clause NetBSD License",
  26405. false
  26406. ],
  26407. "BSD-3-Clause": [
  26408. "BSD 3-clause \"New\" or \"Revised\" License",
  26409. true
  26410. ],
  26411. "BSD-3-Clause-Attribution": [
  26412. "BSD with attribution",
  26413. false
  26414. ],
  26415. "BSD-3-Clause-Clear": [
  26416. "BSD 3-clause Clear License",
  26417. false
  26418. ],
  26419. "BSD-3-Clause-LBNL": [
  26420. "Lawrence Berkeley National Labs BSD variant license",
  26421. false
  26422. ],
  26423. "BSD-4-Clause": [
  26424. "BSD 4-clause \"Original\" or \"Old\" License",
  26425. false
  26426. ],
  26427. "BSD-4-Clause-UC": [
  26428. "BSD-4-Clause (University of California-Specific)",
  26429. false
  26430. ],
  26431. "BSD-Protection": [
  26432. "BSD Protection License",
  26433. false
  26434. ],
  26435. "BSL-1.0": [
  26436. "Boost Software License 1.0",
  26437. true
  26438. ],
  26439. "bzip2-1.0.5": [
  26440. "bzip2 and libbzip2 License v1.0.5",
  26441. false
  26442. ],
  26443. "bzip2-1.0.6": [
  26444. "bzip2 and libbzip2 License v1.0.6",
  26445. false
  26446. ],
  26447. "Caldera": [
  26448. "Caldera License",
  26449. false
  26450. ],
  26451. "CATOSL-1.1": [
  26452. "Computer Associates Trusted Open Source License 1.1",
  26453. true
  26454. ],
  26455. "CC-BY-1.0": [
  26456. "Creative Commons Attribution 1.0",
  26457. false
  26458. ],
  26459. "CC-BY-2.0": [
  26460. "Creative Commons Attribution 2.0",
  26461. false
  26462. ],
  26463. "CC-BY-2.5": [
  26464. "Creative Commons Attribution 2.5",
  26465. false
  26466. ],
  26467. "CC-BY-3.0": [
  26468. "Creative Commons Attribution 3.0",
  26469. false
  26470. ],
  26471. "CC-BY-4.0": [
  26472. "Creative Commons Attribution 4.0",
  26473. false
  26474. ],
  26475. "CC-BY-NC-1.0": [
  26476. "Creative Commons Attribution Non Commercial 1.0",
  26477. false
  26478. ],
  26479. "CC-BY-NC-2.0": [
  26480. "Creative Commons Attribution Non Commercial 2.0",
  26481. false
  26482. ],
  26483. "CC-BY-NC-2.5": [
  26484. "Creative Commons Attribution Non Commercial 2.5",
  26485. false
  26486. ],
  26487. "CC-BY-NC-3.0": [
  26488. "Creative Commons Attribution Non Commercial 3.0",
  26489. false
  26490. ],
  26491. "CC-BY-NC-4.0": [
  26492. "Creative Commons Attribution Non Commercial 4.0",
  26493. false
  26494. ],
  26495. "CC-BY-NC-ND-1.0": [
  26496. "Creative Commons Attribution Non Commercial No Derivatives 1.0",
  26497. false
  26498. ],
  26499. "CC-BY-NC-ND-2.0": [
  26500. "Creative Commons Attribution Non Commercial No Derivatives 2.0",
  26501. false
  26502. ],
  26503. "CC-BY-NC-ND-2.5": [
  26504. "Creative Commons Attribution Non Commercial No Derivatives 2.5",
  26505. false
  26506. ],
  26507. "CC-BY-NC-ND-3.0": [
  26508. "Creative Commons Attribution Non Commercial No Derivatives 3.0",
  26509. false
  26510. ],
  26511. "CC-BY-NC-ND-4.0": [
  26512. "Creative Commons Attribution Non Commercial No Derivatives 4.0",
  26513. false
  26514. ],
  26515. "CC-BY-NC-SA-1.0": [
  26516. "Creative Commons Attribution Non Commercial Share Alike 1.0",
  26517. false
  26518. ],
  26519. "CC-BY-NC-SA-2.0": [
  26520. "Creative Commons Attribution Non Commercial Share Alike 2.0",
  26521. false
  26522. ],
  26523. "CC-BY-NC-SA-2.5": [
  26524. "Creative Commons Attribution Non Commercial Share Alike 2.5",
  26525. false
  26526. ],
  26527. "CC-BY-NC-SA-3.0": [
  26528. "Creative Commons Attribution Non Commercial Share Alike 3.0",
  26529. false
  26530. ],
  26531. "CC-BY-NC-SA-4.0": [
  26532. "Creative Commons Attribution Non Commercial Share Alike 4.0",
  26533. false
  26534. ],
  26535. "CC-BY-ND-1.0": [
  26536. "Creative Commons Attribution No Derivatives 1.0",
  26537. false
  26538. ],
  26539. "CC-BY-ND-2.0": [
  26540. "Creative Commons Attribution No Derivatives 2.0",
  26541. false
  26542. ],
  26543. "CC-BY-ND-2.5": [
  26544. "Creative Commons Attribution No Derivatives 2.5",
  26545. false
  26546. ],
  26547. "CC-BY-ND-3.0": [
  26548. "Creative Commons Attribution No Derivatives 3.0",
  26549. false
  26550. ],
  26551. "CC-BY-ND-4.0": [
  26552. "Creative Commons Attribution No Derivatives 4.0",
  26553. false
  26554. ],
  26555. "CC-BY-SA-1.0": [
  26556. "Creative Commons Attribution Share Alike 1.0",
  26557. false
  26558. ],
  26559. "CC-BY-SA-2.0": [
  26560. "Creative Commons Attribution Share Alike 2.0",
  26561. false
  26562. ],
  26563. "CC-BY-SA-2.5": [
  26564. "Creative Commons Attribution Share Alike 2.5",
  26565. false
  26566. ],
  26567. "CC-BY-SA-3.0": [
  26568. "Creative Commons Attribution Share Alike 3.0",
  26569. false
  26570. ],
  26571. "CC-BY-SA-4.0": [
  26572. "Creative Commons Attribution Share Alike 4.0",
  26573. false
  26574. ],
  26575. "CC0-1.0": [
  26576. "Creative Commons Zero v1.0 Universal",
  26577. false
  26578. ],
  26579. "CDDL-1.0": [
  26580. "Common Development and Distribution License 1.0",
  26581. true
  26582. ],
  26583. "CDDL-1.1": [
  26584. "Common Development and Distribution License 1.1",
  26585. false
  26586. ],
  26587. "CECILL-1.0": [
  26588. "CeCILL Free Software License Agreement v1.0",
  26589. false
  26590. ],
  26591. "CECILL-1.1": [
  26592. "CeCILL Free Software License Agreement v1.1",
  26593. false
  26594. ],
  26595. "CECILL-2.0": [
  26596. "CeCILL Free Software License Agreement v2.0",
  26597. false
  26598. ],
  26599. "CECILL-2.1": [
  26600. "CeCILL Free Software License Agreement v2.1",
  26601. true
  26602. ],
  26603. "CECILL-B": [
  26604. "CeCILL-B Free Software License Agreement",
  26605. false
  26606. ],
  26607. "CECILL-C": [
  26608. "CeCILL-C Free Software License Agreement",
  26609. false
  26610. ],
  26611. "ClArtistic": [
  26612. "Clarified Artistic License",
  26613. false
  26614. ],
  26615. "CNRI-Jython": [
  26616. "CNRI Jython License",
  26617. false
  26618. ],
  26619. "CNRI-Python": [
  26620. "CNRI Python License",
  26621. true
  26622. ],
  26623. "CNRI-Python-GPL-Compatible": [
  26624. "CNRI Python Open Source GPL Compatible License Agreement",
  26625. false
  26626. ],
  26627. "Condor-1.1": [
  26628. "Condor Public License v1.1",
  26629. false
  26630. ],
  26631. "CPAL-1.0": [
  26632. "Common Public Attribution License 1.0",
  26633. true
  26634. ],
  26635. "CPL-1.0": [
  26636. "Common Public License 1.0",
  26637. true
  26638. ],
  26639. "CPOL-1.02": [
  26640. "Code Project Open License 1.02",
  26641. false
  26642. ],
  26643. "Crossword": [
  26644. "Crossword License",
  26645. false
  26646. ],
  26647. "CrystalStacker": [
  26648. "CrystalStacker License",
  26649. false
  26650. ],
  26651. "CUA-OPL-1.0": [
  26652. "CUA Office Public License v1.0",
  26653. true
  26654. ],
  26655. "Cube": [
  26656. "Cube License",
  26657. false
  26658. ],
  26659. "curl": [
  26660. "curl License",
  26661. false
  26662. ],
  26663. "D-FSL-1.0": [
  26664. "Deutsche Freie Software Lizenz",
  26665. false
  26666. ],
  26667. "diffmark": [
  26668. "diffmark license",
  26669. false
  26670. ],
  26671. "DOC": [
  26672. "DOC License",
  26673. false
  26674. ],
  26675. "Dotseqn": [
  26676. "Dotseqn License",
  26677. false
  26678. ],
  26679. "DSDP": [
  26680. "DSDP License",
  26681. false
  26682. ],
  26683. "dvipdfm": [
  26684. "dvipdfm License",
  26685. false
  26686. ],
  26687. "ECL-1.0": [
  26688. "Educational Community License v1.0",
  26689. true
  26690. ],
  26691. "ECL-2.0": [
  26692. "Educational Community License v2.0",
  26693. true
  26694. ],
  26695. "EFL-1.0": [
  26696. "Eiffel Forum License v1.0",
  26697. true
  26698. ],
  26699. "EFL-2.0": [
  26700. "Eiffel Forum License v2.0",
  26701. true
  26702. ],
  26703. "eGenix": [
  26704. "eGenix.com Public License 1.1.0",
  26705. false
  26706. ],
  26707. "Entessa": [
  26708. "Entessa Public License v1.0",
  26709. true
  26710. ],
  26711. "EPL-1.0": [
  26712. "Eclipse Public License 1.0",
  26713. true
  26714. ],
  26715. "ErlPL-1.1": [
  26716. "Erlang Public License v1.1",
  26717. false
  26718. ],
  26719. "EUDatagrid": [
  26720. "EU DataGrid Software License",
  26721. true
  26722. ],
  26723. "EUPL-1.0": [
  26724. "European Union Public License 1.0",
  26725. false
  26726. ],
  26727. "EUPL-1.1": [
  26728. "European Union Public License 1.1",
  26729. true
  26730. ],
  26731. "Eurosym": [
  26732. "Eurosym License",
  26733. false
  26734. ],
  26735. "Fair": [
  26736. "Fair License",
  26737. true
  26738. ],
  26739. "Frameworx-1.0": [
  26740. "Frameworx Open License 1.0",
  26741. true
  26742. ],
  26743. "FreeImage": [
  26744. "FreeImage Public License v1.0",
  26745. false
  26746. ],
  26747. "FSFAP": [
  26748. "FSF All Permissive License",
  26749. false
  26750. ],
  26751. "FSFUL": [
  26752. "FSF Unlimited License",
  26753. false
  26754. ],
  26755. "FSFULLR": [
  26756. "FSF Unlimited License (with License Retention)",
  26757. false
  26758. ],
  26759. "FTL": [
  26760. "Freetype Project License",
  26761. false
  26762. ],
  26763. "GFDL-1.1": [
  26764. "GNU Free Documentation License v1.1",
  26765. false
  26766. ],
  26767. "GFDL-1.2": [
  26768. "GNU Free Documentation License v1.2",
  26769. false
  26770. ],
  26771. "GFDL-1.3": [
  26772. "GNU Free Documentation License v1.3",
  26773. false
  26774. ],
  26775. "Giftware": [
  26776. "Giftware License",
  26777. false
  26778. ],
  26779. "GL2PS": [
  26780. "GL2PS License",
  26781. false
  26782. ],
  26783. "Glide": [
  26784. "3dfx Glide License",
  26785. false
  26786. ],
  26787. "Glulxe": [
  26788. "Glulxe License",
  26789. false
  26790. ],
  26791. "gnuplot": [
  26792. "gnuplot License",
  26793. false
  26794. ],
  26795. "GPL-1.0": [
  26796. "GNU General Public License v1.0 only",
  26797. false
  26798. ],
  26799. "GPL-2.0": [
  26800. "GNU General Public License v2.0 only",
  26801. true
  26802. ],
  26803. "GPL-3.0": [
  26804. "GNU General Public License v3.0 only",
  26805. true
  26806. ],
  26807. "gSOAP-1.3b": [
  26808. "gSOAP Public License v1.3b",
  26809. false
  26810. ],
  26811. "HaskellReport": [
  26812. "Haskell Language Report License",
  26813. false
  26814. ],
  26815. "HPND": [
  26816. "Historic Permission Notice and Disclaimer",
  26817. true
  26818. ],
  26819. "IBM-pibs": [
  26820. "IBM PowerPC Initialization and Boot Software",
  26821. false
  26822. ],
  26823. "ICU": [
  26824. "ICU License",
  26825. false
  26826. ],
  26827. "IJG": [
  26828. "Independent JPEG Group License",
  26829. false
  26830. ],
  26831. "ImageMagick": [
  26832. "ImageMagick License",
  26833. false
  26834. ],
  26835. "iMatix": [
  26836. "iMatix Standard Function Library Agreement",
  26837. false
  26838. ],
  26839. "Imlib2": [
  26840. "Imlib2 License",
  26841. false
  26842. ],
  26843. "Info-ZIP": [
  26844. "Info-ZIP License",
  26845. false
  26846. ],
  26847. "Intel": [
  26848. "Intel Open Source License",
  26849. true
  26850. ],
  26851. "Intel-ACPI": [
  26852. "Intel ACPI Software License Agreement",
  26853. false
  26854. ],
  26855. "Interbase-1.0": [
  26856. "Interbase Public License v1.0",
  26857. false
  26858. ],
  26859. "IPA": [
  26860. "IPA Font License",
  26861. true
  26862. ],
  26863. "IPL-1.0": [
  26864. "IBM Public License v1.0",
  26865. true
  26866. ],
  26867. "ISC": [
  26868. "ISC License",
  26869. true
  26870. ],
  26871. "JasPer-2.0": [
  26872. "JasPer License",
  26873. false
  26874. ],
  26875. "JSON": [
  26876. "JSON License",
  26877. false
  26878. ],
  26879. "LAL-1.2": [
  26880. "Licence Art Libre 1.2",
  26881. false
  26882. ],
  26883. "LAL-1.3": [
  26884. "Licence Art Libre 1.3",
  26885. false
  26886. ],
  26887. "Latex2e": [
  26888. "Latex2e License",
  26889. false
  26890. ],
  26891. "Leptonica": [
  26892. "Leptonica License",
  26893. false
  26894. ],
  26895. "LGPL-2.0": [
  26896. "GNU Library General Public License v2 only",
  26897. true
  26898. ],
  26899. "LGPL-2.1": [
  26900. "GNU Lesser General Public License v2.1 only",
  26901. true
  26902. ],
  26903. "LGPL-3.0": [
  26904. "GNU Lesser General Public License v3.0 only",
  26905. true
  26906. ],
  26907. "LGPLLR": [
  26908. "Lesser General Public License For Linguistic Resources",
  26909. false
  26910. ],
  26911. "Libpng": [
  26912. "libpng License",
  26913. false
  26914. ],
  26915. "libtiff": [
  26916. "libtiff License",
  26917. false
  26918. ],
  26919. "LiLiQ-P-1.1": [
  26920. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  26921. true
  26922. ],
  26923. "LiLiQ-R-1.1": [
  26924. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  26925. true
  26926. ],
  26927. "LiLiQ-Rplus-1.1": [
  26928. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  26929. true
  26930. ],
  26931. "LPL-1.0": [
  26932. "Lucent Public License Version 1.0",
  26933. true
  26934. ],
  26935. "LPL-1.02": [
  26936. "Lucent Public License v1.02",
  26937. true
  26938. ],
  26939. "LPPL-1.0": [
  26940. "LaTeX Project Public License v1.0",
  26941. false
  26942. ],
  26943. "LPPL-1.1": [
  26944. "LaTeX Project Public License v1.1",
  26945. false
  26946. ],
  26947. "LPPL-1.2": [
  26948. "LaTeX Project Public License v1.2",
  26949. false
  26950. ],
  26951. "LPPL-1.3a": [
  26952. "LaTeX Project Public License v1.3a",
  26953. false
  26954. ],
  26955. "LPPL-1.3c": [
  26956. "LaTeX Project Public License v1.3c",
  26957. true
  26958. ],
  26959. "MakeIndex": [
  26960. "MakeIndex License",
  26961. false
  26962. ],
  26963. "MirOS": [
  26964. "MirOS Licence",
  26965. true
  26966. ],
  26967. "MIT": [
  26968. "MIT License",
  26969. true
  26970. ],
  26971. "MIT-advertising": [
  26972. "Enlightenment License (e16)",
  26973. false
  26974. ],
  26975. "MIT-CMU": [
  26976. "CMU License",
  26977. false
  26978. ],
  26979. "MIT-enna": [
  26980. "enna License",
  26981. false
  26982. ],
  26983. "MIT-feh": [
  26984. "feh License",
  26985. false
  26986. ],
  26987. "MITNFA": [
  26988. "MIT +no-false-attribs license",
  26989. false
  26990. ],
  26991. "Motosoto": [
  26992. "Motosoto License",
  26993. true
  26994. ],
  26995. "mpich2": [
  26996. "mpich2 License",
  26997. false
  26998. ],
  26999. "MPL-1.0": [
  27000. "Mozilla Public License 1.0",
  27001. true
  27002. ],
  27003. "MPL-1.1": [
  27004. "Mozilla Public License 1.1",
  27005. true
  27006. ],
  27007. "MPL-2.0": [
  27008. "Mozilla Public License 2.0",
  27009. true
  27010. ],
  27011. "MPL-2.0-no-copyleft-exception": [
  27012. "Mozilla Public License 2.0 (no copyleft exception)",
  27013. true
  27014. ],
  27015. "MS-PL": [
  27016. "Microsoft Public License",
  27017. true
  27018. ],
  27019. "MS-RL": [
  27020. "Microsoft Reciprocal License",
  27021. true
  27022. ],
  27023. "MTLL": [
  27024. "Matrix Template Library License",
  27025. false
  27026. ],
  27027. "Multics": [
  27028. "Multics License",
  27029. true
  27030. ],
  27031. "Mup": [
  27032. "Mup License",
  27033. false
  27034. ],
  27035. "NASA-1.3": [
  27036. "NASA Open Source Agreement 1.3",
  27037. true
  27038. ],
  27039. "Naumen": [
  27040. "Naumen Public License",
  27041. true
  27042. ],
  27043. "NBPL-1.0": [
  27044. "Net Boolean Public License v1",
  27045. false
  27046. ],
  27047. "NCSA": [
  27048. "University of Illinois/NCSA Open Source License",
  27049. true
  27050. ],
  27051. "NetCDF": [
  27052. "NetCDF license",
  27053. false
  27054. ],
  27055. "Newsletr": [
  27056. "Newsletr License",
  27057. false
  27058. ],
  27059. "NGPL": [
  27060. "Nethack General Public License",
  27061. true
  27062. ],
  27063. "NLOD-1.0": [
  27064. "Norwegian Licence for Open Government Data",
  27065. false
  27066. ],
  27067. "NLPL": [
  27068. "No Limit Public License",
  27069. false
  27070. ],
  27071. "Nokia": [
  27072. "Nokia Open Source License",
  27073. true
  27074. ],
  27075. "NOSL": [
  27076. "Netizen Open Source License",
  27077. false
  27078. ],
  27079. "Noweb": [
  27080. "Noweb License",
  27081. false
  27082. ],
  27083. "NPL-1.0": [
  27084. "Netscape Public License v1.0",
  27085. false
  27086. ],
  27087. "NPL-1.1": [
  27088. "Netscape Public License v1.1",
  27089. false
  27090. ],
  27091. "NPOSL-3.0": [
  27092. "Non-Profit Open Software License 3.0",
  27093. true
  27094. ],
  27095. "NRL": [
  27096. "NRL License",
  27097. false
  27098. ],
  27099. "NTP": [
  27100. "NTP License",
  27101. true
  27102. ],
  27103. "Nunit": [
  27104. "Nunit License",
  27105. false
  27106. ],
  27107. "OCCT-PL": [
  27108. "Open CASCADE Technology Public License",
  27109. false
  27110. ],
  27111. "OCLC-2.0": [
  27112. "OCLC Research Public License 2.0",
  27113. true
  27114. ],
  27115. "ODbL-1.0": [
  27116. "ODC Open Database License v1.0",
  27117. false
  27118. ],
  27119. "OFL-1.0": [
  27120. "SIL Open Font License 1.0",
  27121. false
  27122. ],
  27123. "OFL-1.1": [
  27124. "SIL Open Font License 1.1",
  27125. true
  27126. ],
  27127. "OGTSL": [
  27128. "Open Group Test Suite License",
  27129. true
  27130. ],
  27131. "OLDAP-1.1": [
  27132. "Open LDAP Public License v1.1",
  27133. false
  27134. ],
  27135. "OLDAP-1.2": [
  27136. "Open LDAP Public License v1.2",
  27137. false
  27138. ],
  27139. "OLDAP-1.3": [
  27140. "Open LDAP Public License v1.3",
  27141. false
  27142. ],
  27143. "OLDAP-1.4": [
  27144. "Open LDAP Public License v1.4",
  27145. false
  27146. ],
  27147. "OLDAP-2.0": [
  27148. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  27149. false
  27150. ],
  27151. "OLDAP-2.0.1": [
  27152. "Open LDAP Public License v2.0.1",
  27153. false
  27154. ],
  27155. "OLDAP-2.1": [
  27156. "Open LDAP Public License v2.1",
  27157. false
  27158. ],
  27159. "OLDAP-2.2": [
  27160. "Open LDAP Public License v2.2",
  27161. false
  27162. ],
  27163. "OLDAP-2.2.1": [
  27164. "Open LDAP Public License v2.2.1",
  27165. false
  27166. ],
  27167. "OLDAP-2.2.2": [
  27168. "Open LDAP Public License 2.2.2",
  27169. false
  27170. ],
  27171. "OLDAP-2.3": [
  27172. "Open LDAP Public License v2.3",
  27173. false
  27174. ],
  27175. "OLDAP-2.4": [
  27176. "Open LDAP Public License v2.4",
  27177. false
  27178. ],
  27179. "OLDAP-2.5": [
  27180. "Open LDAP Public License v2.5",
  27181. false
  27182. ],
  27183. "OLDAP-2.6": [
  27184. "Open LDAP Public License v2.6",
  27185. false
  27186. ],
  27187. "OLDAP-2.7": [
  27188. "Open LDAP Public License v2.7",
  27189. false
  27190. ],
  27191. "OLDAP-2.8": [
  27192. "Open LDAP Public License v2.8",
  27193. false
  27194. ],
  27195. "OML": [
  27196. "Open Market License",
  27197. false
  27198. ],
  27199. "OpenSSL": [
  27200. "OpenSSL License",
  27201. false
  27202. ],
  27203. "OPL-1.0": [
  27204. "Open Public License v1.0",
  27205. false
  27206. ],
  27207. "OSET-PL-2.1": [
  27208. "OSET Public License version 2.1",
  27209. true
  27210. ],
  27211. "OSL-1.0": [
  27212. "Open Software License 1.0",
  27213. true
  27214. ],
  27215. "OSL-1.1": [
  27216. "Open Software License 1.1",
  27217. false
  27218. ],
  27219. "OSL-2.0": [
  27220. "Open Software License 2.0",
  27221. true
  27222. ],
  27223. "OSL-2.1": [
  27224. "Open Software License 2.1",
  27225. true
  27226. ],
  27227. "OSL-3.0": [
  27228. "Open Software License 3.0",
  27229. true
  27230. ],
  27231. "PDDL-1.0": [
  27232. "ODC Public Domain Dedication & License 1.0",
  27233. false
  27234. ],
  27235. "PHP-3.0": [
  27236. "PHP License v3.0",
  27237. true
  27238. ],
  27239. "PHP-3.01": [
  27240. "PHP License v3.01",
  27241. false
  27242. ],
  27243. "Plexus": [
  27244. "Plexus Classworlds License",
  27245. false
  27246. ],
  27247. "PostgreSQL": [
  27248. "PostgreSQL License",
  27249. true
  27250. ],
  27251. "psfrag": [
  27252. "psfrag License",
  27253. false
  27254. ],
  27255. "psutils": [
  27256. "psutils License",
  27257. false
  27258. ],
  27259. "Python-2.0": [
  27260. "Python License 2.0",
  27261. true
  27262. ],
  27263. "Qhull": [
  27264. "Qhull License",
  27265. false
  27266. ],
  27267. "QPL-1.0": [
  27268. "Q Public License 1.0",
  27269. true
  27270. ],
  27271. "Rdisc": [
  27272. "Rdisc License",
  27273. false
  27274. ],
  27275. "RHeCos-1.1": [
  27276. "Red Hat eCos Public License v1.1",
  27277. false
  27278. ],
  27279. "RPL-1.1": [
  27280. "Reciprocal Public License 1.1",
  27281. true
  27282. ],
  27283. "RPL-1.5": [
  27284. "Reciprocal Public License 1.5",
  27285. true
  27286. ],
  27287. "RPSL-1.0": [
  27288. "RealNetworks Public Source License v1.0",
  27289. true
  27290. ],
  27291. "RSA-MD": [
  27292. "RSA Message-Digest License",
  27293. false
  27294. ],
  27295. "RSCPL": [
  27296. "Ricoh Source Code Public License",
  27297. true
  27298. ],
  27299. "Ruby": [
  27300. "Ruby License",
  27301. false
  27302. ],
  27303. "SAX-PD": [
  27304. "Sax Public Domain Notice",
  27305. false
  27306. ],
  27307. "Saxpath": [
  27308. "Saxpath License",
  27309. false
  27310. ],
  27311. "SCEA": [
  27312. "SCEA Shared Source License",
  27313. false
  27314. ],
  27315. "Sendmail": [
  27316. "Sendmail License",
  27317. false
  27318. ],
  27319. "SGI-B-1.0": [
  27320. "SGI Free Software License B v1.0",
  27321. false
  27322. ],
  27323. "SGI-B-1.1": [
  27324. "SGI Free Software License B v1.1",
  27325. false
  27326. ],
  27327. "SGI-B-2.0": [
  27328. "SGI Free Software License B v2.0",
  27329. false
  27330. ],
  27331. "SimPL-2.0": [
  27332. "Simple Public License 2.0",
  27333. true
  27334. ],
  27335. "SISSL": [
  27336. "Sun Industry Standards Source License v1.1",
  27337. true
  27338. ],
  27339. "SISSL-1.2": [
  27340. "Sun Industry Standards Source License v1.2",
  27341. false
  27342. ],
  27343. "Sleepycat": [
  27344. "Sleepycat License",
  27345. true
  27346. ],
  27347. "SMLNJ": [
  27348. "Standard ML of New Jersey License",
  27349. false
  27350. ],
  27351. "SMPPL": [
  27352. "Secure Messaging Protocol Public License",
  27353. false
  27354. ],
  27355. "SNIA": [
  27356. "SNIA Public License 1.1",
  27357. false
  27358. ],
  27359. "Spencer-86": [
  27360. "Spencer License 86",
  27361. false
  27362. ],
  27363. "Spencer-94": [
  27364. "Spencer License 94",
  27365. false
  27366. ],
  27367. "Spencer-99": [
  27368. "Spencer License 99",
  27369. false
  27370. ],
  27371. "SPL-1.0": [
  27372. "Sun Public License v1.0",
  27373. true
  27374. ],
  27375. "SugarCRM-1.1.3": [
  27376. "SugarCRM Public License v1.1.3",
  27377. false
  27378. ],
  27379. "SWL": [
  27380. "Scheme Widget Library (SWL) Software License Agreement",
  27381. false
  27382. ],
  27383. "TCL": [
  27384. "TCL/TK License",
  27385. false
  27386. ],
  27387. "TMate": [
  27388. "TMate Open Source License",
  27389. false
  27390. ],
  27391. "TORQUE-1.1": [
  27392. "TORQUE v2.5+ Software License v1.1",
  27393. false
  27394. ],
  27395. "TOSL": [
  27396. "Trusster Open Source License",
  27397. false
  27398. ],
  27399. "Unicode-TOU": [
  27400. "Unicode Terms of Use",
  27401. false
  27402. ],
  27403. "Unlicense": [
  27404. "The Unlicense",
  27405. false
  27406. ],
  27407. "UPL-1.0": [
  27408. "Universal Permissive License v1.0",
  27409. true
  27410. ],
  27411. "Vim": [
  27412. "Vim License",
  27413. false
  27414. ],
  27415. "VOSTROM": [
  27416. "VOSTROM Public License for Open Source",
  27417. false
  27418. ],
  27419. "VSL-1.0": [
  27420. "Vovida Software License v1.0",
  27421. true
  27422. ],
  27423. "W3C": [
  27424. "W3C Software Notice and License (2002-12-31)",
  27425. true
  27426. ],
  27427. "W3C-19980720": [
  27428. "W3C Software Notice and License (1998-07-20)",
  27429. false
  27430. ],
  27431. "Watcom-1.0": [
  27432. "Sybase Open Watcom Public License 1.0",
  27433. true
  27434. ],
  27435. "Wsuipa": [
  27436. "Wsuipa License",
  27437. false
  27438. ],
  27439. "WTFPL": [
  27440. "Do What The F*ck You Want To Public License",
  27441. false
  27442. ],
  27443. "X11": [
  27444. "X11 License",
  27445. false
  27446. ],
  27447. "Xerox": [
  27448. "Xerox License",
  27449. false
  27450. ],
  27451. "XFree86-1.1": [
  27452. "XFree86 License 1.1",
  27453. false
  27454. ],
  27455. "xinetd": [
  27456. "xinetd License",
  27457. false
  27458. ],
  27459. "Xnet": [
  27460. "X.Net License",
  27461. true
  27462. ],
  27463. "xpp": [
  27464. "XPP License",
  27465. false
  27466. ],
  27467. "XSkat": [
  27468. "XSkat License",
  27469. false
  27470. ],
  27471. "YPL-1.0": [
  27472. "Yahoo! Public License v1.0",
  27473. false
  27474. ],
  27475. "YPL-1.1": [
  27476. "Yahoo! Public License v1.1",
  27477. false
  27478. ],
  27479. "Zed": [
  27480. "Zed License",
  27481. false
  27482. ],
  27483. "Zend-2.0": [
  27484. "Zend License v2.0",
  27485. false
  27486. ],
  27487. "Zimbra-1.3": [
  27488. "Zimbra Public License v1.3",
  27489. false
  27490. ],
  27491. "Zimbra-1.4": [
  27492. "Zimbra Public License v1.4",
  27493. false
  27494. ],
  27495. "Zlib": [
  27496. "zlib License",
  27497. true
  27498. ],
  27499. "zlib-acknowledgement": [
  27500. "zlib/libpng License with Acknowledgement",
  27501. false
  27502. ],
  27503. "ZPL-1.1": [
  27504. "Zope Public License 1.1",
  27505. false
  27506. ],
  27507. "ZPL-2.0": [
  27508. "Zope Public License 2.0",
  27509. true
  27510. ],
  27511. "ZPL-2.1": [
  27512. "Zope Public License 2.1",
  27513. false
  27514. ]
  27515. }MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  27516. $�������Æ,Í;§Bž;§Bž;§Bž2ßמ:§Bž2ßÁž-§Bž2ßÆž9§Bž2ßÑž?§Bža9ž8§Bž;§Cž§Bž2ßÈž:§Bž2ßÖž:§Bž2ßÓž:§BžRich;§Bž��������PE��L�¬MoO��������à�  ��
  27517. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  27518. ����������������� ��`.rdata����� ���
  27519. �����������������@��@.data�������0��������������������@��À.rsrc��� ���@��������������������@��@.reloc��Ì���P������"��������������@��B��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������j$¸æ@�èx��jöÿ @�ƒeÐ�‹ð�EÐPVÿ� @�‹EЃàûPVÿ @��MÔÿX @�ƒeü��EÔPÿ5H @�ÿL @�YYÿ5\ @��EÔPÿ5` @�ÿD @�YY‹ÈÿP @�ƒMüÿ�MÔÿT @�3ÀèH��Ã; �0@�uóÃé¬��h€@�è£��¡l3@�Ç$40@�ÿ5h3@�£40@�h$0@�h(0@�h 0@�ÿ  @�ƒÄ£00@�…À}jè¹��YÃjh"@�è��3Û‰]üd¡���‹p‰]ä¿€3@�SVWÿ0 @�;Ãt;Æu3öF‰uäëhè��ÿ4 @�ëÚ3öF¡|3@�;Æu
  27520. jè\��Yë;¡|3@�…Àu,‰5|3@�hð @�hä @�è§��YY…ÀtÇEüþÿÿÿ¸ÿ���éÝ���‰5<0@�¡|3@�;Æuhà @�hØ @�èl��YYÇ|3@����9]äuSWÿ8 @�9Œ3@�thŒ3@�èƒ��Y…Àt
  27521. SjSÿŒ3@�¡$0@�‹ ¼ @�‰ÿ5$0@�ÿ5(0@�ÿ5 0@�èþÿÿƒÄ £80@�9,0@�u7PÿÀ @�‹Eì‹‹ ‰MàPQèŽ��YYËeè‹Eà£80@�3Û9,0@�uPÿh @�9<0@�uÿœ @�ÇEüþÿÿÿ¡80@�èû��øMZ��f9��@�t3ÀëM¡<�@��€��@��8PE��ué·H�ù ��t�ù ��uÕƒ¸„���vÌ3É9ˆø���ëƒxtv¼3É9ˆè���•Á‹Áj£,0@�ÿp @�jÿÿl @�YY£„3@�£ˆ3@�ÿÌ @�‹ t3@�‰ÿˆ @�‹ p3@�‰¡¨ @�‹�£x3@�èV��è¬��ƒ=0@��u hµ@�ÿ¬ @�Yèg��ƒ=0@�ÿu jÿÿ° @�Y3ÀÃè{��éŸýÿÿ‹ÿU‹ì�ì(��£H1@�‰ D1@�‰@1@�‰<1@�‰581@�‰=41@�fŒ`1@�fŒ T1@�fŒ01@�fŒ,1@�fŒ%(1@�fŒ-$1@�œ�X1@�‹E�£L1@�‹E£P1@��E£\1@�‹…àüÿÿǘ0@���¡P1@�£L0@�Ç@0@� �ÀÇD0@����¡�0@�‰…Øüÿÿ¡0@�‰…Üüÿÿÿ @�£�0@�jè?��Yj�ÿ @�h!@�ÿ$ @�ƒ=�0@��ujè��Yh �Àÿ( @�Pÿ, @�ÉËÿU‹ì‹E‹��8csmàu*ƒxu$‹@= “t=!“t="“t=�@™uèÐ��3À]Â�hH@�ÿ @�3ÀÃÿ%¤ @�jh("@�èb��ÿ5ˆ3@�‹5Œ @�ÿÖY‰Eäƒøÿu ÿuÿÄ @�Yëgjè’��Yƒeü�ÿ5ˆ3@�ÿÖ‰Eäÿ5„3@�ÿÖYY‰Eà�EàP�EäPÿu‹5l @�ÿÖYPèU��‰EÜÿuäÿÖ£ˆ3@�ÿuàÿփģ„3@�ÇEüþÿÿÿè ���‹EÜè��Ãjè��YËÿU‹ìÿuèNÿÿÿ÷ØÀ÷ØYH]ËÿV¸ü!@�¾ü!@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^ËÿV¸"@�¾"@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^Ãÿ%È @�ÌÌÌÌ‹ÿU‹ì‹M¸MZ��f9t3À]ËA<Á�8PE��uï3Ò¹ ��f9H”‹Â]ÃÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ì‹E‹H<È·ASV·q3ÒW�D…öv‹} ‹H ;ùr ‹XÙ;ûr
  27522. BƒÀ(;Örè3À_^[]ÃÌÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ìjþhH"@�he@�d¡����PƒìSVW¡�0@�1Eø3ÅP�Eðd£����‰eèÇEü����h��@�è*ÿÿÿƒÄ…ÀtU‹E-��@�Ph��@�èPÿÿÿƒÄ…Àt;‹@$Áè÷ЃàÇEüþÿÿÿ‹Mðd‰ ����Y_^[‹å]ËEì‹‹3Ò=��À”‹ÂËeèÇEüþÿÿÿ3À‹Mðd‰ ����Y_^[‹å]ÃÌÿ%¸ @�ÿ%´ @�ÌÌhe@�dÿ5����‹D$‰l$�l$+àSVW¡�0@�1Eü3ÅP‰eèÿuø‹EüÇEüþÿÿÿ‰Eø�Eðd£����ËMðd‰ ����Y__^[‹å]QËÿU‹ìÿuÿuÿu ÿuh‡@�h�0@�èç���ƒÄ]ËÿVh���h���3öVèÙ���ƒÄ …Àt VVVVVèÂ���ƒÄ^Ã3ÀËÿU‹ìƒì¡�0@�ƒeø�ƒeü�SW¿Næ@»»��ÿÿ;Çt …Ãt ÷У0@�ë`V�EøPÿ< @�‹uü3uøÿ @�3ðÿ @�3ðÿ @�3ð�EðPÿ @�‹Eô3Eð3ð;÷u¾Oæ@»ë …óu‹ÆÁà ð‰5�0@�÷Ö‰50@�^_[ÉÃÿ%t @�ÿ%x @�ÿ%| @�ÿ%€ @�ÿ%„ @�ÿ%� @�ÿ%” @�ÿ%˜ @�ÿ%Ð @�Pdÿ5�����D$ +d$ SVW‰(‹è¡�0@�3ÅP‰EðÿuüÇEüÿÿÿÿ�Eôd£����ËMôd‰ ����Y__^[‹å]QËMð3Íè¯÷ÿÿéÝÿÿÿ�MÔÿ%T @�‹T$�B ‹JÌ3Èè�÷ÿÿ‹Jü3Èè†÷ÿÿ¸l"@�ésÿÿÿ�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)����������–@���������W@�Š@���������������������¬MoO�������l���€!��€��@0@�˜0@�bad allocation������H������������������������������������������������������������0@�ð!@����RSDSÑŒ³´�J¨!öÌëLZ����c:\users\seld\documents\visual studio 2010\Projects\hiddeninp\Release\hiddeninp.pdb�����e��æ������������������þÿÿÿ����Ðÿÿÿ����þÿÿÿ@�@�����þÿÿÿ����Ìÿÿÿ����þÿÿÿ����:@�����þÿÿÿ����Øÿÿÿ����þÿÿÿË@�ß@�ÿÿÿÿÝ@�"“���d"@������������������������à"����������ì#��� ��$#����������ô&��D ��H#����������(��h ����������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)������•GetConsoleMode��·SetConsoleMode��;GetStdHandle��KERNEL32.dll���??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�‘?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A��J?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A�Â�??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z��_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��{??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��³?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z��MSVCP90.dll�_amsg_exit��Ÿ�__getmainargs�,_cexit��|_exit�f�_XcptFilter�Ìexit�� �__initenv�_initterm�_initterm_e�<_configthreadlocale�ã�__setusermatherr�� _adjust_fdiv��Ë�__p__commode��Ï�__p__fmode��j_encode_pointer�à�__set_app_type��K_crt_debugger_hook��C�?terminate@@YAXXZ�MSVCR90.dll�æ_unlock�–�__dllonexit�v_lock�_onexit�`_decode_pointer�s_except_handler4_common� _invoke_watson��?_controlfp_s��½InterlockedExchange�!Sleep�ºInterlockedCompareExchange��-TerminateProcess��©GetCurrentProcess�>UnhandledExceptionFilter��SetUnhandledExceptionFilter�ÑIsDebuggerPresent�TQueryPerformanceCounter�fGetTickCount��­GetCurrentThreadId��ªGetCurrentProcessId�OGetSystemTimeAsFileTime�s�__CxxFrameHandler3����������������������������������������������������Næ@»±¿Dÿÿÿÿÿÿÿÿþÿÿÿ���$!@���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ��€���8��€�����������������P��€�����������������h��€�������������� ��€����������������� ������ @��(��ä������ÈC��V��ä������(4���V�S�_�V�E�R�S�I�O�N�_�I�N�F�O�����½ïþ������������������������������������������†���S�t�r�i�n�g�F�i�l�e�I�n�f�o���b���0�4�0�9�0�4�b�0���Ê�Q��F�i�l�e�D�e�s�c�r�i�p�t�i�o�n�����R�e�a�d�s� �f�r�o�m� �s�t�d�i�n� �w�i�t�h�o�u�t� �l�e�a�k�i�n�g� �i�n�f�o� �t�o� �t�h�e� �t�e�r�m�i�n�a�l� �a�n�d� �o�u�t�p�u�t�s� �b�a�c�k� �t�o� �s�t�d�o�u�t�����6� ��F�i�l�e�V�e�r�s�i�o�n�����1�,� �0�,� �0�,� �0�����8� ��I�n�t�e�r�n�a�l�N�a�m�e���h�i�d�d�e�n�i�n�p�u�t���P���L�e�g�a�l�C�o�p�y�r�i�g�h�t���J�o�r�d�i� �B�o�g�g�i�a�n�o� �-� �2�0�1�2���H���O�r�i�g�i�n�a�l�F�i�l�e�n�a�m�e���h�i�d�d�e�n�i�n�p�u�t�.�e�x�e���:� ��P�r�o�d�u�c�t�N�a�m�e�����H�i�d�d�e�n� �I�n�p�u�t�����:� ��P�r�o�d�u�c�t�V�e�r�s�i�o�n���1�,� �0�,� �0�,� �0�����D����V�a�r�F�i�l�e�I�n�f�o�����$����T�r�a�n�s�l�a�t�i�o�n����� °<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  27523. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  27524. <security>
  27525. <requestedPrivileges>
  27526. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  27527. </requestedPrivileges>
  27528. </security>
  27529. </trustInfo>
  27530. <dependency>
  27531. <dependentAssembly>
  27532. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  27533. </dependentAssembly>
  27534. </dependency>
  27535. </assembly>PAPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDING���@��00!0/080F0L0T0^0d0n0{0‰0—0¡0¨0®0³0¸0½0Â0È0Ð0ä0ÿ01#1-1@1J1O1T1v1{1„1‰1–1§1­1´1È1Í1Ó1Û1á1ç1ô1ú12"2*23292A2M2_2j2p2¹2¿2Ç2Î2Ó2Ù2ß2ç2í2ô2û2 333%303N3T3Z3`3f3l3s3z3�3ˆ3�3–3�3¥3­3µ3Á3Ê3Ï3Õ3ß3è3ó3ÿ34444%4;4B4‹4‘4š4¡4¬4²4Æ4Û4æ4þ45!5^5c5„5‰5¨5H6M6_6}6‘6—6�77 7*7w7|7Á7ä7ñ7ý78 88=8E8P8V8\8b8h8n8t8z8€8œ8â89��� ��$���Ü0è0ì01 1t1x12 2@2\2`2h2t2�0�� ���0��������������������������������������������������������������������������������������������������������������������������������������������������<?php
  27536. namespace Symfony\Component\Console;
  27537. use Symfony\Component\Console\Descriptor\TextDescriptor;
  27538. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  27539. use Symfony\Component\Console\Exception\ExceptionInterface;
  27540. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  27541. use Symfony\Component\Console\Helper\ProcessHelper;
  27542. use Symfony\Component\Console\Helper\QuestionHelper;
  27543. use Symfony\Component\Console\Input\InputInterface;
  27544. use Symfony\Component\Console\Input\ArgvInput;
  27545. use Symfony\Component\Console\Input\ArrayInput;
  27546. use Symfony\Component\Console\Input\InputDefinition;
  27547. use Symfony\Component\Console\Input\InputOption;
  27548. use Symfony\Component\Console\Input\InputArgument;
  27549. use Symfony\Component\Console\Input\InputAwareInterface;
  27550. use Symfony\Component\Console\Output\BufferedOutput;
  27551. use Symfony\Component\Console\Output\OutputInterface;
  27552. use Symfony\Component\Console\Output\ConsoleOutput;
  27553. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  27554. use Symfony\Component\Console\Command\Command;
  27555. use Symfony\Component\Console\Command\HelpCommand;
  27556. use Symfony\Component\Console\Command\ListCommand;
  27557. use Symfony\Component\Console\Helper\HelperSet;
  27558. use Symfony\Component\Console\Helper\FormatterHelper;
  27559. use Symfony\Component\Console\Helper\DialogHelper;
  27560. use Symfony\Component\Console\Helper\ProgressHelper;
  27561. use Symfony\Component\Console\Helper\TableHelper;
  27562. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  27563. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  27564. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  27565. use Symfony\Component\Console\Exception\CommandNotFoundException;
  27566. use Symfony\Component\Console\Exception\LogicException;
  27567. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  27568. class Application
  27569. {
  27570. private $commands = array();
  27571. private $wantHelps = false;
  27572. private $runningCommand;
  27573. private $name;
  27574. private $version;
  27575. private $catchExceptions = true;
  27576. private $autoExit = true;
  27577. private $definition;
  27578. private $helperSet;
  27579. private $dispatcher;
  27580. private $terminalDimensions;
  27581. private $defaultCommand;
  27582. public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
  27583. {
  27584. $this->name = $name;
  27585. $this->version = $version;
  27586. $this->defaultCommand = 'list';
  27587. $this->helperSet = $this->getDefaultHelperSet();
  27588. $this->definition = $this->getDefaultInputDefinition();
  27589. foreach ($this->getDefaultCommands() as $command) {
  27590. $this->add($command);
  27591. }
  27592. }
  27593. public function setDispatcher(EventDispatcherInterface $dispatcher)
  27594. {
  27595. $this->dispatcher = $dispatcher;
  27596. }
  27597. public function run(InputInterface $input = null, OutputInterface $output = null)
  27598. {
  27599. if (null === $input) {
  27600. $input = new ArgvInput();
  27601. }
  27602. if (null === $output) {
  27603. $output = new ConsoleOutput();
  27604. }
  27605. $this->configureIO($input, $output);
  27606. try {
  27607. $exitCode = $this->doRun($input, $output);
  27608. } catch (\Exception $e) {
  27609. if (!$this->catchExceptions) {
  27610. throw $e;
  27611. }
  27612. if ($output instanceof ConsoleOutputInterface) {
  27613. $this->renderException($e, $output->getErrorOutput());
  27614. } else {
  27615. $this->renderException($e, $output);
  27616. }
  27617. $exitCode = $e->getCode();
  27618. if (is_numeric($exitCode)) {
  27619. $exitCode = (int) $exitCode;
  27620. if (0 === $exitCode) {
  27621. $exitCode = 1;
  27622. }
  27623. } else {
  27624. $exitCode = 1;
  27625. }
  27626. }
  27627. if ($this->autoExit) {
  27628. if ($exitCode > 255) {
  27629. $exitCode = 255;
  27630. }
  27631. exit($exitCode);
  27632. }
  27633. return $exitCode;
  27634. }
  27635. public function doRun(InputInterface $input, OutputInterface $output)
  27636. {
  27637. if (true === $input->hasParameterOption(array('--version', '-V'))) {
  27638. $output->writeln($this->getLongVersion());
  27639. return 0;
  27640. }
  27641. $name = $this->getCommandName($input);
  27642. if (true === $input->hasParameterOption(array('--help', '-h'))) {
  27643. if (!$name) {
  27644. $name = 'help';
  27645. $input = new ArrayInput(array('command' => 'help'));
  27646. } else {
  27647. $this->wantHelps = true;
  27648. }
  27649. }
  27650. if (!$name) {
  27651. $name = $this->defaultCommand;
  27652. $input = new ArrayInput(array('command' => $this->defaultCommand));
  27653. }
  27654. $command = $this->find($name);
  27655. $this->runningCommand = $command;
  27656. $exitCode = $this->doRunCommand($command, $input, $output);
  27657. $this->runningCommand = null;
  27658. return $exitCode;
  27659. }
  27660. public function setHelperSet(HelperSet $helperSet)
  27661. {
  27662. $this->helperSet = $helperSet;
  27663. }
  27664. public function getHelperSet()
  27665. {
  27666. return $this->helperSet;
  27667. }
  27668. public function setDefinition(InputDefinition $definition)
  27669. {
  27670. $this->definition = $definition;
  27671. }
  27672. public function getDefinition()
  27673. {
  27674. return $this->definition;
  27675. }
  27676. public function getHelp()
  27677. {
  27678. return $this->getLongVersion();
  27679. }
  27680. public function setCatchExceptions($boolean)
  27681. {
  27682. $this->catchExceptions = (bool) $boolean;
  27683. }
  27684. public function setAutoExit($boolean)
  27685. {
  27686. $this->autoExit = (bool) $boolean;
  27687. }
  27688. public function getName()
  27689. {
  27690. return $this->name;
  27691. }
  27692. public function setName($name)
  27693. {
  27694. $this->name = $name;
  27695. }
  27696. public function getVersion()
  27697. {
  27698. return $this->version;
  27699. }
  27700. public function setVersion($version)
  27701. {
  27702. $this->version = $version;
  27703. }
  27704. public function getLongVersion()
  27705. {
  27706. if ('UNKNOWN' !== $this->getName()) {
  27707. if ('UNKNOWN' !== $this->getVersion()) {
  27708. return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
  27709. }
  27710. return sprintf('<info>%s</info>', $this->getName());
  27711. }
  27712. return '<info>Console Tool</info>';
  27713. }
  27714. public function register($name)
  27715. {
  27716. return $this->add(new Command($name));
  27717. }
  27718. public function addCommands(array $commands)
  27719. {
  27720. foreach ($commands as $command) {
  27721. $this->add($command);
  27722. }
  27723. }
  27724. public function add(Command $command)
  27725. {
  27726. $command->setApplication($this);
  27727. if (!$command->isEnabled()) {
  27728. $command->setApplication(null);
  27729. return;
  27730. }
  27731. if (null === $command->getDefinition()) {
  27732. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($command)));
  27733. }
  27734. $this->commands[$command->getName()] = $command;
  27735. foreach ($command->getAliases() as $alias) {
  27736. $this->commands[$alias] = $command;
  27737. }
  27738. return $command;
  27739. }
  27740. public function get($name)
  27741. {
  27742. if (!isset($this->commands[$name])) {
  27743. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  27744. }
  27745. $command = $this->commands[$name];
  27746. if ($this->wantHelps) {
  27747. $this->wantHelps = false;
  27748. $helpCommand = $this->get('help');
  27749. $helpCommand->setCommand($command);
  27750. return $helpCommand;
  27751. }
  27752. return $command;
  27753. }
  27754. public function has($name)
  27755. {
  27756. return isset($this->commands[$name]);
  27757. }
  27758. public function getNamespaces()
  27759. {
  27760. $namespaces = array();
  27761. foreach ($this->all() as $command) {
  27762. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
  27763. foreach ($command->getAliases() as $alias) {
  27764. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
  27765. }
  27766. }
  27767. return array_values(array_unique(array_filter($namespaces)));
  27768. }
  27769. public function findNamespace($namespace)
  27770. {
  27771. $allNamespaces = $this->getNamespaces();
  27772. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
  27773. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  27774. if (empty($namespaces)) {
  27775. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  27776. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  27777. if (1 == count($alternatives)) {
  27778. $message .= "\n\nDid you mean this?\n ";
  27779. } else {
  27780. $message .= "\n\nDid you mean one of these?\n ";
  27781. }
  27782. $message .= implode("\n ", $alternatives);
  27783. }
  27784. throw new CommandNotFoundException($message, $alternatives);
  27785. }
  27786. $exact = in_array($namespace, $namespaces, true);
  27787. if (count($namespaces) > 1 && !$exact) {
  27788. throw new CommandNotFoundException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  27789. }
  27790. return $exact ? $namespace : reset($namespaces);
  27791. }
  27792. public function find($name)
  27793. {
  27794. $allCommands = array_keys($this->commands);
  27795. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
  27796. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  27797. if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
  27798. if (false !== $pos = strrpos($name, ':')) {
  27799. $this->findNamespace(substr($name, 0, $pos));
  27800. }
  27801. $message = sprintf('Command "%s" is not defined.', $name);
  27802. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  27803. if (1 == count($alternatives)) {
  27804. $message .= "\n\nDid you mean this?\n ";
  27805. } else {
  27806. $message .= "\n\nDid you mean one of these?\n ";
  27807. }
  27808. $message .= implode("\n ", $alternatives);
  27809. }
  27810. throw new CommandNotFoundException($message, $alternatives);
  27811. }
  27812. if (count($commands) > 1) {
  27813. $commandList = $this->commands;
  27814. $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands) {
  27815. $commandName = $commandList[$nameOrAlias]->getName();
  27816. return $commandName === $nameOrAlias || !in_array($commandName, $commands);
  27817. });
  27818. }
  27819. $exact = in_array($name, $commands, true);
  27820. if (count($commands) > 1 && !$exact) {
  27821. $suggestions = $this->getAbbreviationSuggestions(array_values($commands));
  27822. throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));
  27823. }
  27824. return $this->get($exact ? $name : reset($commands));
  27825. }
  27826. public function all($namespace = null)
  27827. {
  27828. if (null === $namespace) {
  27829. return $this->commands;
  27830. }
  27831. $commands = array();
  27832. foreach ($this->commands as $name => $command) {
  27833. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  27834. $commands[$name] = $command;
  27835. }
  27836. }
  27837. return $commands;
  27838. }
  27839. public static function getAbbreviations($names)
  27840. {
  27841. $abbrevs = array();
  27842. foreach ($names as $name) {
  27843. for ($len = strlen($name); $len > 0; --$len) {
  27844. $abbrev = substr($name, 0, $len);
  27845. $abbrevs[$abbrev][] = $name;
  27846. }
  27847. }
  27848. return $abbrevs;
  27849. }
  27850. public function asText($namespace = null, $raw = false)
  27851. {
  27852. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  27853. $descriptor = new TextDescriptor();
  27854. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
  27855. $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
  27856. return $output->fetch();
  27857. }
  27858. public function asXml($namespace = null, $asDom = false)
  27859. {
  27860. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  27861. $descriptor = new XmlDescriptor();
  27862. if ($asDom) {
  27863. return $descriptor->getApplicationDocument($this, $namespace);
  27864. }
  27865. $output = new BufferedOutput();
  27866. $descriptor->describe($output, $this, array('namespace' => $namespace));
  27867. return $output->fetch();
  27868. }
  27869. public function renderException($e, $output)
  27870. {
  27871. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  27872. do {
  27873. $title = sprintf(' [%s] ', get_class($e));
  27874. $len = $this->stringWidth($title);
  27875. $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
  27876. if (defined('HHVM_VERSION') && $width > 1 << 31) {
  27877. $width = 1 << 31;
  27878. }
  27879. $formatter = $output->getFormatter();
  27880. $lines = array();
  27881. foreach (preg_split('/\r?\n/', $e->getMessage()) as $line) {
  27882. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  27883. $lineLength = $this->stringWidth(preg_replace('/\[[^m]*m/', '', $formatter->format($line))) + 4;
  27884. $lines[] = array($line, $lineLength);
  27885. $len = max($lineLength, $len);
  27886. }
  27887. }
  27888. $messages = array();
  27889. $messages[] = $emptyLine = $formatter->format(sprintf('<error>%s</error>', str_repeat(' ', $len)));
  27890. $messages[] = $formatter->format(sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - $this->stringWidth($title)))));
  27891. foreach ($lines as $line) {
  27892. $messages[] = $formatter->format(sprintf('<error> %s %s</error>', $line[0], str_repeat(' ', $len - $line[1])));
  27893. }
  27894. $messages[] = $emptyLine;
  27895. $messages[] = '';
  27896. $output->writeln($messages, OutputInterface::OUTPUT_RAW | OutputInterface::VERBOSITY_QUIET);
  27897. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  27898. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  27899. $trace = $e->getTrace();
  27900. array_unshift($trace, array(
  27901. 'function' => '',
  27902. 'file' => $e->getFile() !== null ? $e->getFile() : 'n/a',
  27903. 'line' => $e->getLine() !== null ? $e->getLine() : 'n/a',
  27904. 'args' => array(),
  27905. ));
  27906. for ($i = 0, $count = count($trace); $i < $count; ++$i) {
  27907. $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
  27908. $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
  27909. $function = $trace[$i]['function'];
  27910. $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
  27911. $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
  27912. $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
  27913. }
  27914. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  27915. }
  27916. } while ($e = $e->getPrevious());
  27917. if (null !== $this->runningCommand) {
  27918. $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
  27919. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  27920. }
  27921. }
  27922. protected function getTerminalWidth()
  27923. {
  27924. $dimensions = $this->getTerminalDimensions();
  27925. return $dimensions[0];
  27926. }
  27927. protected function getTerminalHeight()
  27928. {
  27929. $dimensions = $this->getTerminalDimensions();
  27930. return $dimensions[1];
  27931. }
  27932. public function getTerminalDimensions()
  27933. {
  27934. if ($this->terminalDimensions) {
  27935. return $this->terminalDimensions;
  27936. }
  27937. if ('\\' === DIRECTORY_SEPARATOR) {
  27938. if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
  27939. return array((int) $matches[1], (int) $matches[2]);
  27940. }
  27941. if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
  27942. return array((int) $matches[1], (int) $matches[2]);
  27943. }
  27944. }
  27945. if ($sttyString = $this->getSttyColumns()) {
  27946. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  27947. return array((int) $matches[2], (int) $matches[1]);
  27948. }
  27949. if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  27950. return array((int) $matches[2], (int) $matches[1]);
  27951. }
  27952. }
  27953. return array(null, null);
  27954. }
  27955. public function setTerminalDimensions($width, $height)
  27956. {
  27957. $this->terminalDimensions = array($width, $height);
  27958. return $this;
  27959. }
  27960. protected function configureIO(InputInterface $input, OutputInterface $output)
  27961. {
  27962. if (true === $input->hasParameterOption(array('--ansi'))) {
  27963. $output->setDecorated(true);
  27964. } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
  27965. $output->setDecorated(false);
  27966. }
  27967. if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
  27968. $input->setInteractive(false);
  27969. } elseif (function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
  27970. $inputStream = $this->getHelperSet()->get('question')->getInputStream();
  27971. if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  27972. $input->setInteractive(false);
  27973. }
  27974. }
  27975. if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
  27976. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  27977. } else {
  27978. if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || $input->getParameterOption('--verbose') === 3) {
  27979. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  27980. } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || $input->getParameterOption('--verbose') === 2) {
  27981. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  27982. } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
  27983. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  27984. }
  27985. }
  27986. }
  27987. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  27988. {
  27989. foreach ($command->getHelperSet() as $helper) {
  27990. if ($helper instanceof InputAwareInterface) {
  27991. $helper->setInput($input);
  27992. }
  27993. }
  27994. if (null === $this->dispatcher) {
  27995. return $command->run($input, $output);
  27996. }
  27997. try {
  27998. $command->mergeApplicationDefinition();
  27999. $input->bind($command->getDefinition());
  28000. } catch (ExceptionInterface $e) {
  28001. }
  28002. $event = new ConsoleCommandEvent($command, $input, $output);
  28003. $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
  28004. if ($event->commandShouldRun()) {
  28005. try {
  28006. $exitCode = $command->run($input, $output);
  28007. } catch (\Exception $e) {
  28008. $event = new ConsoleExceptionEvent($command, $input, $output, $e, $e->getCode());
  28009. $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
  28010. $e = $event->getException();
  28011. $event = new ConsoleTerminateEvent($command, $input, $output, $e->getCode());
  28012. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  28013. throw $e;
  28014. }
  28015. } else {
  28016. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  28017. }
  28018. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  28019. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  28020. return $event->getExitCode();
  28021. }
  28022. protected function getCommandName(InputInterface $input)
  28023. {
  28024. return $input->getFirstArgument();
  28025. }
  28026. protected function getDefaultInputDefinition()
  28027. {
  28028. return new InputDefinition(array(
  28029. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  28030. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
  28031. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  28032. new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'),
  28033. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  28034. new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
  28035. new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
  28036. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  28037. ));
  28038. }
  28039. protected function getDefaultCommands()
  28040. {
  28041. return array(new HelpCommand(), new ListCommand());
  28042. }
  28043. protected function getDefaultHelperSet()
  28044. {
  28045. return new HelperSet(array(
  28046. new FormatterHelper(),
  28047. new DialogHelper(false),
  28048. new ProgressHelper(false),
  28049. new TableHelper(false),
  28050. new DebugFormatterHelper(),
  28051. new ProcessHelper(),
  28052. new QuestionHelper(),
  28053. ));
  28054. }
  28055. private function getSttyColumns()
  28056. {
  28057. if (!function_exists('proc_open')) {
  28058. return;
  28059. }
  28060. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  28061. $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  28062. if (is_resource($process)) {
  28063. $info = stream_get_contents($pipes[1]);
  28064. fclose($pipes[1]);
  28065. fclose($pipes[2]);
  28066. proc_close($process);
  28067. return $info;
  28068. }
  28069. }
  28070. private function getConsoleMode()
  28071. {
  28072. if (!function_exists('proc_open')) {
  28073. return;
  28074. }
  28075. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  28076. $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  28077. if (is_resource($process)) {
  28078. $info = stream_get_contents($pipes[1]);
  28079. fclose($pipes[1]);
  28080. fclose($pipes[2]);
  28081. proc_close($process);
  28082. if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  28083. return $matches[2].'x'.$matches[1];
  28084. }
  28085. }
  28086. }
  28087. private function getAbbreviationSuggestions($abbrevs)
  28088. {
  28089. return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], count($abbrevs) > 2 ? sprintf(' and %d more', count($abbrevs) - 2) : '');
  28090. }
  28091. public function extractNamespace($name, $limit = null)
  28092. {
  28093. $parts = explode(':', $name);
  28094. array_pop($parts);
  28095. return implode(':', null === $limit ? $parts : array_slice($parts, 0, $limit));
  28096. }
  28097. private function findAlternatives($name, $collection)
  28098. {
  28099. $threshold = 1e3;
  28100. $alternatives = array();
  28101. $collectionParts = array();
  28102. foreach ($collection as $item) {
  28103. $collectionParts[$item] = explode(':', $item);
  28104. }
  28105. foreach (explode(':', $name) as $i => $subname) {
  28106. foreach ($collectionParts as $collectionName => $parts) {
  28107. $exists = isset($alternatives[$collectionName]);
  28108. if (!isset($parts[$i]) && $exists) {
  28109. $alternatives[$collectionName] += $threshold;
  28110. continue;
  28111. } elseif (!isset($parts[$i])) {
  28112. continue;
  28113. }
  28114. $lev = levenshtein($subname, $parts[$i]);
  28115. if ($lev <= strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
  28116. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  28117. } elseif ($exists) {
  28118. $alternatives[$collectionName] += $threshold;
  28119. }
  28120. }
  28121. }
  28122. foreach ($collection as $item) {
  28123. $lev = levenshtein($name, $item);
  28124. if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) {
  28125. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  28126. }
  28127. }
  28128. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  28129. asort($alternatives);
  28130. return array_keys($alternatives);
  28131. }
  28132. public function setDefaultCommand($commandName)
  28133. {
  28134. $this->defaultCommand = $commandName;
  28135. }
  28136. private function stringWidth($string)
  28137. {
  28138. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  28139. return strlen($string);
  28140. }
  28141. return mb_strwidth($string, $encoding);
  28142. }
  28143. private function splitStringByWidth($string, $width)
  28144. {
  28145. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  28146. return str_split($string, $width);
  28147. }
  28148. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  28149. $lines = array();
  28150. $line = '';
  28151. foreach (preg_split('//u', $utf8String) as $char) {
  28152. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  28153. $line .= $char;
  28154. continue;
  28155. }
  28156. $lines[] = str_pad($line, $width);
  28157. $line = $char;
  28158. }
  28159. if ('' !== $line) {
  28160. $lines[] = count($lines) ? str_pad($line, $width) : $line;
  28161. }
  28162. mb_convert_variables($encoding, 'utf8', $lines);
  28163. return $lines;
  28164. }
  28165. private function extractAllNamespaces($name)
  28166. {
  28167. $parts = explode(':', $name, -1);
  28168. $namespaces = array();
  28169. foreach ($parts as $part) {
  28170. if (count($namespaces)) {
  28171. $namespaces[] = end($namespaces).':'.$part;
  28172. } else {
  28173. $namespaces[] = $part;
  28174. }
  28175. }
  28176. return $namespaces;
  28177. }
  28178. }
  28179. <?php
  28180. namespace Symfony\Component\Console\Command;
  28181. use Symfony\Component\Console\Descriptor\TextDescriptor;
  28182. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  28183. use Symfony\Component\Console\Exception\ExceptionInterface;
  28184. use Symfony\Component\Console\Input\InputDefinition;
  28185. use Symfony\Component\Console\Input\InputOption;
  28186. use Symfony\Component\Console\Input\InputArgument;
  28187. use Symfony\Component\Console\Input\InputInterface;
  28188. use Symfony\Component\Console\Output\BufferedOutput;
  28189. use Symfony\Component\Console\Output\OutputInterface;
  28190. use Symfony\Component\Console\Application;
  28191. use Symfony\Component\Console\Helper\HelperSet;
  28192. use Symfony\Component\Console\Exception\InvalidArgumentException;
  28193. use Symfony\Component\Console\Exception\LogicException;
  28194. class Command
  28195. {
  28196. private $application;
  28197. private $name;
  28198. private $processTitle;
  28199. private $aliases = array();
  28200. private $definition;
  28201. private $help;
  28202. private $description;
  28203. private $ignoreValidationErrors = false;
  28204. private $applicationDefinitionMerged = false;
  28205. private $applicationDefinitionMergedWithArgs = false;
  28206. private $code;
  28207. private $synopsis = array();
  28208. private $usages = array();
  28209. private $helperSet;
  28210. public function __construct($name = null)
  28211. {
  28212. $this->definition = new InputDefinition();
  28213. if (null !== $name) {
  28214. $this->setName($name);
  28215. }
  28216. $this->configure();
  28217. if (!$this->name) {
  28218. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_class($this)));
  28219. }
  28220. }
  28221. public function ignoreValidationErrors()
  28222. {
  28223. $this->ignoreValidationErrors = true;
  28224. }
  28225. public function setApplication(Application $application = null)
  28226. {
  28227. $this->application = $application;
  28228. if ($application) {
  28229. $this->setHelperSet($application->getHelperSet());
  28230. } else {
  28231. $this->helperSet = null;
  28232. }
  28233. }
  28234. public function setHelperSet(HelperSet $helperSet)
  28235. {
  28236. $this->helperSet = $helperSet;
  28237. }
  28238. public function getHelperSet()
  28239. {
  28240. return $this->helperSet;
  28241. }
  28242. public function getApplication()
  28243. {
  28244. return $this->application;
  28245. }
  28246. public function isEnabled()
  28247. {
  28248. return true;
  28249. }
  28250. protected function configure()
  28251. {
  28252. }
  28253. protected function execute(InputInterface $input, OutputInterface $output)
  28254. {
  28255. throw new LogicException('You must override the execute() method in the concrete command class.');
  28256. }
  28257. protected function interact(InputInterface $input, OutputInterface $output)
  28258. {
  28259. }
  28260. protected function initialize(InputInterface $input, OutputInterface $output)
  28261. {
  28262. }
  28263. public function run(InputInterface $input, OutputInterface $output)
  28264. {
  28265. $this->getSynopsis(true);
  28266. $this->getSynopsis(false);
  28267. $this->mergeApplicationDefinition();
  28268. try {
  28269. $input->bind($this->definition);
  28270. } catch (ExceptionInterface $e) {
  28271. if (!$this->ignoreValidationErrors) {
  28272. throw $e;
  28273. }
  28274. }
  28275. $this->initialize($input, $output);
  28276. if (null !== $this->processTitle) {
  28277. if (function_exists('cli_set_process_title')) {
  28278. cli_set_process_title($this->processTitle);
  28279. } elseif (function_exists('setproctitle')) {
  28280. setproctitle($this->processTitle);
  28281. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  28282. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  28283. }
  28284. }
  28285. if ($input->isInteractive()) {
  28286. $this->interact($input, $output);
  28287. }
  28288. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  28289. $input->setArgument('command', $this->getName());
  28290. }
  28291. $input->validate();
  28292. if ($this->code) {
  28293. $statusCode = call_user_func($this->code, $input, $output);
  28294. } else {
  28295. $statusCode = $this->execute($input, $output);
  28296. }
  28297. return is_numeric($statusCode) ? (int) $statusCode : 0;
  28298. }
  28299. public function setCode($code)
  28300. {
  28301. if (!is_callable($code)) {
  28302. throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
  28303. }
  28304. if (PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
  28305. $r = new \ReflectionFunction($code);
  28306. if (null === $r->getClosureThis()) {
  28307. $code = \Closure::bind($code, $this);
  28308. }
  28309. }
  28310. $this->code = $code;
  28311. return $this;
  28312. }
  28313. public function mergeApplicationDefinition($mergeArgs = true)
  28314. {
  28315. if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
  28316. return;
  28317. }
  28318. $this->definition->addOptions($this->application->getDefinition()->getOptions());
  28319. if ($mergeArgs) {
  28320. $currentArguments = $this->definition->getArguments();
  28321. $this->definition->setArguments($this->application->getDefinition()->getArguments());
  28322. $this->definition->addArguments($currentArguments);
  28323. }
  28324. $this->applicationDefinitionMerged = true;
  28325. if ($mergeArgs) {
  28326. $this->applicationDefinitionMergedWithArgs = true;
  28327. }
  28328. }
  28329. public function setDefinition($definition)
  28330. {
  28331. if ($definition instanceof InputDefinition) {
  28332. $this->definition = $definition;
  28333. } else {
  28334. $this->definition->setDefinition($definition);
  28335. }
  28336. $this->applicationDefinitionMerged = false;
  28337. return $this;
  28338. }
  28339. public function getDefinition()
  28340. {
  28341. return $this->definition;
  28342. }
  28343. public function getNativeDefinition()
  28344. {
  28345. return $this->getDefinition();
  28346. }
  28347. public function addArgument($name, $mode = null, $description = '', $default = null)
  28348. {
  28349. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  28350. return $this;
  28351. }
  28352. public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
  28353. {
  28354. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  28355. return $this;
  28356. }
  28357. public function setName($name)
  28358. {
  28359. $this->validateName($name);
  28360. $this->name = $name;
  28361. return $this;
  28362. }
  28363. public function setProcessTitle($title)
  28364. {
  28365. $this->processTitle = $title;
  28366. return $this;
  28367. }
  28368. public function getName()
  28369. {
  28370. return $this->name;
  28371. }
  28372. public function setDescription($description)
  28373. {
  28374. $this->description = $description;
  28375. return $this;
  28376. }
  28377. public function getDescription()
  28378. {
  28379. return $this->description;
  28380. }
  28381. public function setHelp($help)
  28382. {
  28383. $this->help = $help;
  28384. return $this;
  28385. }
  28386. public function getHelp()
  28387. {
  28388. return $this->help;
  28389. }
  28390. public function getProcessedHelp()
  28391. {
  28392. $name = $this->name;
  28393. $placeholders = array(
  28394. '%command.name%',
  28395. '%command.full_name%',
  28396. );
  28397. $replacements = array(
  28398. $name,
  28399. $_SERVER['PHP_SELF'].' '.$name,
  28400. );
  28401. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  28402. }
  28403. public function setAliases($aliases)
  28404. {
  28405. if (!is_array($aliases) && !$aliases instanceof \Traversable) {
  28406. throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
  28407. }
  28408. foreach ($aliases as $alias) {
  28409. $this->validateName($alias);
  28410. }
  28411. $this->aliases = $aliases;
  28412. return $this;
  28413. }
  28414. public function getAliases()
  28415. {
  28416. return $this->aliases;
  28417. }
  28418. public function getSynopsis($short = false)
  28419. {
  28420. $key = $short ? 'short' : 'long';
  28421. if (!isset($this->synopsis[$key])) {
  28422. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  28423. }
  28424. return $this->synopsis[$key];
  28425. }
  28426. public function addUsage($usage)
  28427. {
  28428. if (0 !== strpos($usage, $this->name)) {
  28429. $usage = sprintf('%s %s', $this->name, $usage);
  28430. }
  28431. $this->usages[] = $usage;
  28432. return $this;
  28433. }
  28434. public function getUsages()
  28435. {
  28436. return $this->usages;
  28437. }
  28438. public function getHelper($name)
  28439. {
  28440. if (null === $this->helperSet) {
  28441. throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
  28442. }
  28443. return $this->helperSet->get($name);
  28444. }
  28445. public function asText()
  28446. {
  28447. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  28448. $descriptor = new TextDescriptor();
  28449. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  28450. $descriptor->describe($output, $this, array('raw_output' => true));
  28451. return $output->fetch();
  28452. }
  28453. public function asXml($asDom = false)
  28454. {
  28455. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  28456. $descriptor = new XmlDescriptor();
  28457. if ($asDom) {
  28458. return $descriptor->getCommandDocument($this);
  28459. }
  28460. $output = new BufferedOutput();
  28461. $descriptor->describe($output, $this);
  28462. return $output->fetch();
  28463. }
  28464. private function validateName($name)
  28465. {
  28466. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  28467. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  28468. }
  28469. }
  28470. }
  28471. <?php
  28472. namespace Symfony\Component\Console\Command;
  28473. use Symfony\Component\Console\Helper\DescriptorHelper;
  28474. use Symfony\Component\Console\Input\InputArgument;
  28475. use Symfony\Component\Console\Input\InputOption;
  28476. use Symfony\Component\Console\Input\InputInterface;
  28477. use Symfony\Component\Console\Output\OutputInterface;
  28478. class HelpCommand extends Command
  28479. {
  28480. private $command;
  28481. protected function configure()
  28482. {
  28483. $this->ignoreValidationErrors();
  28484. $this
  28485. ->setName('help')
  28486. ->setDefinition(array(
  28487. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  28488. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
  28489. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  28490. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  28491. ))
  28492. ->setDescription('Displays help for a command')
  28493. ->setHelp(<<<'EOF'
  28494. The <info>%command.name%</info> command displays help for a given command:
  28495. <info>php %command.full_name% list</info>
  28496. You can also output the help in other formats by using the <comment>--format</comment> option:
  28497. <info>php %command.full_name% --format=xml list</info>
  28498. To display the list of available commands, please use the <info>list</info> command.
  28499. EOF
  28500. )
  28501. ;
  28502. }
  28503. public function setCommand(Command $command)
  28504. {
  28505. $this->command = $command;
  28506. }
  28507. protected function execute(InputInterface $input, OutputInterface $output)
  28508. {
  28509. if (null === $this->command) {
  28510. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  28511. }
  28512. if ($input->getOption('xml')) {
  28513. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  28514. $input->setOption('format', 'xml');
  28515. }
  28516. $helper = new DescriptorHelper();
  28517. $helper->describe($output, $this->command, array(
  28518. 'format' => $input->getOption('format'),
  28519. 'raw_text' => $input->getOption('raw'),
  28520. ));
  28521. $this->command = null;
  28522. }
  28523. }
  28524. <?php
  28525. namespace Symfony\Component\Console\Command;
  28526. use Symfony\Component\Console\Helper\DescriptorHelper;
  28527. use Symfony\Component\Console\Input\InputArgument;
  28528. use Symfony\Component\Console\Input\InputOption;
  28529. use Symfony\Component\Console\Input\InputInterface;
  28530. use Symfony\Component\Console\Output\OutputInterface;
  28531. use Symfony\Component\Console\Input\InputDefinition;
  28532. class ListCommand extends Command
  28533. {
  28534. protected function configure()
  28535. {
  28536. $this
  28537. ->setName('list')
  28538. ->setDefinition($this->createDefinition())
  28539. ->setDescription('Lists commands')
  28540. ->setHelp(<<<'EOF'
  28541. The <info>%command.name%</info> command lists all commands:
  28542. <info>php %command.full_name%</info>
  28543. You can also display the commands for a specific namespace:
  28544. <info>php %command.full_name% test</info>
  28545. You can also output the information in other formats by using the <comment>--format</comment> option:
  28546. <info>php %command.full_name% --format=xml</info>
  28547. It's also possible to get raw list of commands (useful for embedding command runner):
  28548. <info>php %command.full_name% --raw</info>
  28549. EOF
  28550. )
  28551. ;
  28552. }
  28553. public function getNativeDefinition()
  28554. {
  28555. return $this->createDefinition();
  28556. }
  28557. protected function execute(InputInterface $input, OutputInterface $output)
  28558. {
  28559. if ($input->getOption('xml')) {
  28560. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  28561. $input->setOption('format', 'xml');
  28562. }
  28563. $helper = new DescriptorHelper();
  28564. $helper->describe($output, $this->getApplication(), array(
  28565. 'format' => $input->getOption('format'),
  28566. 'raw_text' => $input->getOption('raw'),
  28567. 'namespace' => $input->getArgument('namespace'),
  28568. ));
  28569. }
  28570. private function createDefinition()
  28571. {
  28572. return new InputDefinition(array(
  28573. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  28574. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
  28575. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  28576. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  28577. ));
  28578. }
  28579. }
  28580. <?php
  28581. namespace Symfony\Component\Console;
  28582. final class ConsoleEvents
  28583. {
  28584. const COMMAND = 'console.command';
  28585. const TERMINATE = 'console.terminate';
  28586. const EXCEPTION = 'console.exception';
  28587. }
  28588. <?php
  28589. namespace Symfony\Component\Console\Descriptor;
  28590. use Symfony\Component\Console\Application;
  28591. use Symfony\Component\Console\Command\Command;
  28592. use Symfony\Component\Console\Exception\CommandNotFoundException;
  28593. class ApplicationDescription
  28594. {
  28595. const GLOBAL_NAMESPACE = '_global';
  28596. private $application;
  28597. private $namespace;
  28598. private $namespaces;
  28599. private $commands;
  28600. private $aliases;
  28601. public function __construct(Application $application, $namespace = null)
  28602. {
  28603. $this->application = $application;
  28604. $this->namespace = $namespace;
  28605. }
  28606. public function getNamespaces()
  28607. {
  28608. if (null === $this->namespaces) {
  28609. $this->inspectApplication();
  28610. }
  28611. return $this->namespaces;
  28612. }
  28613. public function getCommands()
  28614. {
  28615. if (null === $this->commands) {
  28616. $this->inspectApplication();
  28617. }
  28618. return $this->commands;
  28619. }
  28620. public function getCommand($name)
  28621. {
  28622. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  28623. throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
  28624. }
  28625. return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
  28626. }
  28627. private function inspectApplication()
  28628. {
  28629. $this->commands = array();
  28630. $this->namespaces = array();
  28631. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  28632. foreach ($this->sortCommands($all) as $namespace => $commands) {
  28633. $names = array();
  28634. foreach ($commands as $name => $command) {
  28635. if (!$command->getName()) {
  28636. continue;
  28637. }
  28638. if ($command->getName() === $name) {
  28639. $this->commands[$name] = $command;
  28640. } else {
  28641. $this->aliases[$name] = $command;
  28642. }
  28643. $names[] = $name;
  28644. }
  28645. $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
  28646. }
  28647. }
  28648. private function sortCommands(array $commands)
  28649. {
  28650. $namespacedCommands = array();
  28651. $globalCommands = array();
  28652. foreach ($commands as $name => $command) {
  28653. $key = $this->application->extractNamespace($name, 1);
  28654. if (!$key) {
  28655. $globalCommands['_global'][$name] = $command;
  28656. } else {
  28657. $namespacedCommands[$key][$name] = $command;
  28658. }
  28659. }
  28660. ksort($namespacedCommands);
  28661. $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
  28662. foreach ($namespacedCommands as &$commandsSet) {
  28663. ksort($commandsSet);
  28664. }
  28665. unset($commandsSet);
  28666. return $namespacedCommands;
  28667. }
  28668. }
  28669. <?php
  28670. namespace Symfony\Component\Console\Descriptor;
  28671. use Symfony\Component\Console\Application;
  28672. use Symfony\Component\Console\Command\Command;
  28673. use Symfony\Component\Console\Input\InputArgument;
  28674. use Symfony\Component\Console\Input\InputDefinition;
  28675. use Symfony\Component\Console\Input\InputOption;
  28676. use Symfony\Component\Console\Output\OutputInterface;
  28677. use Symfony\Component\Console\Exception\InvalidArgumentException;
  28678. abstract class Descriptor implements DescriptorInterface
  28679. {
  28680. private $output;
  28681. public function describe(OutputInterface $output, $object, array $options = array())
  28682. {
  28683. $this->output = $output;
  28684. switch (true) {
  28685. case $object instanceof InputArgument:
  28686. $this->describeInputArgument($object, $options);
  28687. break;
  28688. case $object instanceof InputOption:
  28689. $this->describeInputOption($object, $options);
  28690. break;
  28691. case $object instanceof InputDefinition:
  28692. $this->describeInputDefinition($object, $options);
  28693. break;
  28694. case $object instanceof Command:
  28695. $this->describeCommand($object, $options);
  28696. break;
  28697. case $object instanceof Application:
  28698. $this->describeApplication($object, $options);
  28699. break;
  28700. default:
  28701. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_class($object)));
  28702. }
  28703. }
  28704. protected function write($content, $decorated = false)
  28705. {
  28706. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  28707. }
  28708. abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
  28709. abstract protected function describeInputOption(InputOption $option, array $options = array());
  28710. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
  28711. abstract protected function describeCommand(Command $command, array $options = array());
  28712. abstract protected function describeApplication(Application $application, array $options = array());
  28713. }
  28714. <?php
  28715. namespace Symfony\Component\Console\Descriptor;
  28716. use Symfony\Component\Console\Output\OutputInterface;
  28717. interface DescriptorInterface
  28718. {
  28719. public function describe(OutputInterface $output, $object, array $options = array());
  28720. }
  28721. <?php
  28722. namespace Symfony\Component\Console\Descriptor;
  28723. use Symfony\Component\Console\Application;
  28724. use Symfony\Component\Console\Command\Command;
  28725. use Symfony\Component\Console\Input\InputArgument;
  28726. use Symfony\Component\Console\Input\InputDefinition;
  28727. use Symfony\Component\Console\Input\InputOption;
  28728. class JsonDescriptor extends Descriptor
  28729. {
  28730. protected function describeInputArgument(InputArgument $argument, array $options = array())
  28731. {
  28732. $this->writeData($this->getInputArgumentData($argument), $options);
  28733. }
  28734. protected function describeInputOption(InputOption $option, array $options = array())
  28735. {
  28736. $this->writeData($this->getInputOptionData($option), $options);
  28737. }
  28738. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  28739. {
  28740. $this->writeData($this->getInputDefinitionData($definition), $options);
  28741. }
  28742. protected function describeCommand(Command $command, array $options = array())
  28743. {
  28744. $this->writeData($this->getCommandData($command), $options);
  28745. }
  28746. protected function describeApplication(Application $application, array $options = array())
  28747. {
  28748. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  28749. $description = new ApplicationDescription($application, $describedNamespace);
  28750. $commands = array();
  28751. foreach ($description->getCommands() as $command) {
  28752. $commands[] = $this->getCommandData($command);
  28753. }
  28754. $data = $describedNamespace
  28755. ? array('commands' => $commands, 'namespace' => $describedNamespace)
  28756. : array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
  28757. $this->writeData($data, $options);
  28758. }
  28759. private function writeData(array $data, array $options)
  28760. {
  28761. $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
  28762. }
  28763. private function getInputArgumentData(InputArgument $argument)
  28764. {
  28765. return array(
  28766. 'name' => $argument->getName(),
  28767. 'is_required' => $argument->isRequired(),
  28768. 'is_array' => $argument->isArray(),
  28769. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  28770. 'default' => $argument->getDefault(),
  28771. );
  28772. }
  28773. private function getInputOptionData(InputOption $option)
  28774. {
  28775. return array(
  28776. 'name' => '--'.$option->getName(),
  28777. 'shortcut' => $option->getShortcut() ? '-'.implode('|-', explode('|', $option->getShortcut())) : '',
  28778. 'accept_value' => $option->acceptValue(),
  28779. 'is_value_required' => $option->isValueRequired(),
  28780. 'is_multiple' => $option->isArray(),
  28781. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  28782. 'default' => $option->getDefault(),
  28783. );
  28784. }
  28785. private function getInputDefinitionData(InputDefinition $definition)
  28786. {
  28787. $inputArguments = array();
  28788. foreach ($definition->getArguments() as $name => $argument) {
  28789. $inputArguments[$name] = $this->getInputArgumentData($argument);
  28790. }
  28791. $inputOptions = array();
  28792. foreach ($definition->getOptions() as $name => $option) {
  28793. $inputOptions[$name] = $this->getInputOptionData($option);
  28794. }
  28795. return array('arguments' => $inputArguments, 'options' => $inputOptions);
  28796. }
  28797. private function getCommandData(Command $command)
  28798. {
  28799. $command->getSynopsis();
  28800. $command->mergeApplicationDefinition(false);
  28801. return array(
  28802. 'name' => $command->getName(),
  28803. 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
  28804. 'description' => $command->getDescription(),
  28805. 'help' => $command->getProcessedHelp(),
  28806. 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
  28807. );
  28808. }
  28809. }
  28810. <?php
  28811. namespace Symfony\Component\Console\Descriptor;
  28812. use Symfony\Component\Console\Application;
  28813. use Symfony\Component\Console\Command\Command;
  28814. use Symfony\Component\Console\Input\InputArgument;
  28815. use Symfony\Component\Console\Input\InputDefinition;
  28816. use Symfony\Component\Console\Input\InputOption;
  28817. class MarkdownDescriptor extends Descriptor
  28818. {
  28819. protected function describeInputArgument(InputArgument $argument, array $options = array())
  28820. {
  28821. $this->write(
  28822. '**'.$argument->getName().':**'."\n\n"
  28823. .'* Name: '.($argument->getName() ?: '<none>')."\n"
  28824. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  28825. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  28826. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
  28827. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  28828. );
  28829. }
  28830. protected function describeInputOption(InputOption $option, array $options = array())
  28831. {
  28832. $this->write(
  28833. '**'.$option->getName().':**'."\n\n"
  28834. .'* Name: `--'.$option->getName().'`'."\n"
  28835. .'* Shortcut: '.($option->getShortcut() ? '`-'.implode('|-', explode('|', $option->getShortcut())).'`' : '<none>')."\n"
  28836. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  28837. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  28838. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  28839. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
  28840. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  28841. );
  28842. }
  28843. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  28844. {
  28845. if ($showArguments = count($definition->getArguments()) > 0) {
  28846. $this->write('### Arguments:');
  28847. foreach ($definition->getArguments() as $argument) {
  28848. $this->write("\n\n");
  28849. $this->write($this->describeInputArgument($argument));
  28850. }
  28851. }
  28852. if (count($definition->getOptions()) > 0) {
  28853. if ($showArguments) {
  28854. $this->write("\n\n");
  28855. }
  28856. $this->write('### Options:');
  28857. foreach ($definition->getOptions() as $option) {
  28858. $this->write("\n\n");
  28859. $this->write($this->describeInputOption($option));
  28860. }
  28861. }
  28862. }
  28863. protected function describeCommand(Command $command, array $options = array())
  28864. {
  28865. $command->getSynopsis();
  28866. $command->mergeApplicationDefinition(false);
  28867. $this->write(
  28868. $command->getName()."\n"
  28869. .str_repeat('-', strlen($command->getName()))."\n\n"
  28870. .'* Description: '.($command->getDescription() ?: '<none>')."\n"
  28871. .'* Usage:'."\n\n"
  28872. .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  28873. return $carry .= ' * `'.$usage.'`'."\n";
  28874. })
  28875. );
  28876. if ($help = $command->getProcessedHelp()) {
  28877. $this->write("\n");
  28878. $this->write($help);
  28879. }
  28880. if ($command->getNativeDefinition()) {
  28881. $this->write("\n\n");
  28882. $this->describeInputDefinition($command->getNativeDefinition());
  28883. }
  28884. }
  28885. protected function describeApplication(Application $application, array $options = array())
  28886. {
  28887. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  28888. $description = new ApplicationDescription($application, $describedNamespace);
  28889. $this->write($application->getName()."\n".str_repeat('=', strlen($application->getName())));
  28890. foreach ($description->getNamespaces() as $namespace) {
  28891. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  28892. $this->write("\n\n");
  28893. $this->write('**'.$namespace['id'].':**');
  28894. }
  28895. $this->write("\n\n");
  28896. $this->write(implode("\n", array_map(function ($commandName) {
  28897. return '* '.$commandName;
  28898. }, $namespace['commands'])));
  28899. }
  28900. foreach ($description->getCommands() as $command) {
  28901. $this->write("\n\n");
  28902. $this->write($this->describeCommand($command));
  28903. }
  28904. }
  28905. }
  28906. <?php
  28907. namespace Symfony\Component\Console\Descriptor;
  28908. use Symfony\Component\Console\Application;
  28909. use Symfony\Component\Console\Command\Command;
  28910. use Symfony\Component\Console\Input\InputArgument;
  28911. use Symfony\Component\Console\Input\InputDefinition;
  28912. use Symfony\Component\Console\Input\InputOption;
  28913. class TextDescriptor extends Descriptor
  28914. {
  28915. protected function describeInputArgument(InputArgument $argument, array $options = array())
  28916. {
  28917. if (null !== $argument->getDefault() && (!is_array($argument->getDefault()) || count($argument->getDefault()))) {
  28918. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  28919. } else {
  28920. $default = '';
  28921. }
  28922. $totalWidth = isset($options['total_width']) ? $options['total_width'] : strlen($argument->getName());
  28923. $spacingWidth = $totalWidth - strlen($argument->getName()) + 2;
  28924. $this->writeText(sprintf(' <info>%s</info>%s%s%s',
  28925. $argument->getName(),
  28926. str_repeat(' ', $spacingWidth),
  28927. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 17), $argument->getDescription()),
  28928. $default
  28929. ), $options);
  28930. }
  28931. protected function describeInputOption(InputOption $option, array $options = array())
  28932. {
  28933. if ($option->acceptValue() && null !== $option->getDefault() && (!is_array($option->getDefault()) || count($option->getDefault()))) {
  28934. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  28935. } else {
  28936. $default = '';
  28937. }
  28938. $value = '';
  28939. if ($option->acceptValue()) {
  28940. $value = '='.strtoupper($option->getName());
  28941. if ($option->isValueOptional()) {
  28942. $value = '['.$value.']';
  28943. }
  28944. }
  28945. $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
  28946. $synopsis = sprintf('%s%s',
  28947. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  28948. sprintf('--%s%s', $option->getName(), $value)
  28949. );
  28950. $spacingWidth = $totalWidth - strlen($synopsis) + 2;
  28951. $this->writeText(sprintf(' <info>%s</info>%s%s%s%s',
  28952. $synopsis,
  28953. str_repeat(' ', $spacingWidth),
  28954. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 17), $option->getDescription()),
  28955. $default,
  28956. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  28957. ), $options);
  28958. }
  28959. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  28960. {
  28961. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  28962. foreach ($definition->getArguments() as $argument) {
  28963. $totalWidth = max($totalWidth, strlen($argument->getName()));
  28964. }
  28965. if ($definition->getArguments()) {
  28966. $this->writeText('<comment>Arguments:</comment>', $options);
  28967. $this->writeText("\n");
  28968. foreach ($definition->getArguments() as $argument) {
  28969. $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
  28970. $this->writeText("\n");
  28971. }
  28972. }
  28973. if ($definition->getArguments() && $definition->getOptions()) {
  28974. $this->writeText("\n");
  28975. }
  28976. if ($definition->getOptions()) {
  28977. $laterOptions = array();
  28978. $this->writeText('<comment>Options:</comment>', $options);
  28979. foreach ($definition->getOptions() as $option) {
  28980. if (strlen($option->getShortcut()) > 1) {
  28981. $laterOptions[] = $option;
  28982. continue;
  28983. }
  28984. $this->writeText("\n");
  28985. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  28986. }
  28987. foreach ($laterOptions as $option) {
  28988. $this->writeText("\n");
  28989. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  28990. }
  28991. }
  28992. }
  28993. protected function describeCommand(Command $command, array $options = array())
  28994. {
  28995. $command->getSynopsis(true);
  28996. $command->getSynopsis(false);
  28997. $command->mergeApplicationDefinition(false);
  28998. $this->writeText('<comment>Usage:</comment>', $options);
  28999. foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
  29000. $this->writeText("\n");
  29001. $this->writeText(' '.$usage, $options);
  29002. }
  29003. $this->writeText("\n");
  29004. $definition = $command->getNativeDefinition();
  29005. if ($definition->getOptions() || $definition->getArguments()) {
  29006. $this->writeText("\n");
  29007. $this->describeInputDefinition($definition, $options);
  29008. $this->writeText("\n");
  29009. }
  29010. if ($help = $command->getProcessedHelp()) {
  29011. $this->writeText("\n");
  29012. $this->writeText('<comment>Help:</comment>', $options);
  29013. $this->writeText("\n");
  29014. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  29015. $this->writeText("\n");
  29016. }
  29017. }
  29018. protected function describeApplication(Application $application, array $options = array())
  29019. {
  29020. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  29021. $description = new ApplicationDescription($application, $describedNamespace);
  29022. if (isset($options['raw_text']) && $options['raw_text']) {
  29023. $width = $this->getColumnWidth($description->getCommands());
  29024. foreach ($description->getCommands() as $command) {
  29025. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  29026. $this->writeText("\n");
  29027. }
  29028. } else {
  29029. if ('' != $help = $application->getHelp()) {
  29030. $this->writeText("$help\n\n", $options);
  29031. }
  29032. $this->writeText("<comment>Usage:</comment>\n", $options);
  29033. $this->writeText(" command [options] [arguments]\n\n", $options);
  29034. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  29035. $this->writeText("\n");
  29036. $this->writeText("\n");
  29037. $width = $this->getColumnWidth($description->getCommands());
  29038. if ($describedNamespace) {
  29039. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  29040. } else {
  29041. $this->writeText('<comment>Available commands:</comment>', $options);
  29042. }
  29043. foreach ($description->getNamespaces() as $namespace) {
  29044. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  29045. $this->writeText("\n");
  29046. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  29047. }
  29048. foreach ($namespace['commands'] as $name) {
  29049. $this->writeText("\n");
  29050. $spacingWidth = $width - strlen($name);
  29051. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
  29052. }
  29053. }
  29054. $this->writeText("\n");
  29055. }
  29056. }
  29057. private function writeText($content, array $options = array())
  29058. {
  29059. $this->write(
  29060. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  29061. isset($options['raw_output']) ? !$options['raw_output'] : true
  29062. );
  29063. }
  29064. private function formatDefaultValue($default)
  29065. {
  29066. if (PHP_VERSION_ID < 50400) {
  29067. return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
  29068. }
  29069. return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  29070. }
  29071. private function getColumnWidth(array $commands)
  29072. {
  29073. $widths = array();
  29074. foreach ($commands as $command) {
  29075. $widths[] = strlen($command->getName());
  29076. foreach ($command->getAliases() as $alias) {
  29077. $widths[] = strlen($alias);
  29078. }
  29079. }
  29080. return max($widths) + 2;
  29081. }
  29082. private function calculateTotalWidthForOptions($options)
  29083. {
  29084. $totalWidth = 0;
  29085. foreach ($options as $option) {
  29086. $nameLength = 1 + max(strlen($option->getShortcut()), 1) + 4 + strlen($option->getName());
  29087. if ($option->acceptValue()) {
  29088. $valueLength = 1 + strlen($option->getName());
  29089. $valueLength += $option->isValueOptional() ? 2 : 0;
  29090. $nameLength += $valueLength;
  29091. }
  29092. $totalWidth = max($totalWidth, $nameLength);
  29093. }
  29094. return $totalWidth;
  29095. }
  29096. }
  29097. <?php
  29098. namespace Symfony\Component\Console\Descriptor;
  29099. use Symfony\Component\Console\Application;
  29100. use Symfony\Component\Console\Command\Command;
  29101. use Symfony\Component\Console\Input\InputArgument;
  29102. use Symfony\Component\Console\Input\InputDefinition;
  29103. use Symfony\Component\Console\Input\InputOption;
  29104. class XmlDescriptor extends Descriptor
  29105. {
  29106. public function getInputDefinitionDocument(InputDefinition $definition)
  29107. {
  29108. $dom = new \DOMDocument('1.0', 'UTF-8');
  29109. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  29110. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  29111. foreach ($definition->getArguments() as $argument) {
  29112. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  29113. }
  29114. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  29115. foreach ($definition->getOptions() as $option) {
  29116. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  29117. }
  29118. return $dom;
  29119. }
  29120. public function getCommandDocument(Command $command)
  29121. {
  29122. $dom = new \DOMDocument('1.0', 'UTF-8');
  29123. $dom->appendChild($commandXML = $dom->createElement('command'));
  29124. $command->getSynopsis();
  29125. $command->mergeApplicationDefinition(false);
  29126. $commandXML->setAttribute('id', $command->getName());
  29127. $commandXML->setAttribute('name', $command->getName());
  29128. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  29129. foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
  29130. $usagesXML->appendChild($dom->createElement('usage', $usage));
  29131. }
  29132. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  29133. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  29134. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  29135. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  29136. $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
  29137. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  29138. return $dom;
  29139. }
  29140. public function getApplicationDocument(Application $application, $namespace = null)
  29141. {
  29142. $dom = new \DOMDocument('1.0', 'UTF-8');
  29143. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  29144. if ($application->getName() !== 'UNKNOWN') {
  29145. $rootXml->setAttribute('name', $application->getName());
  29146. if ($application->getVersion() !== 'UNKNOWN') {
  29147. $rootXml->setAttribute('version', $application->getVersion());
  29148. }
  29149. }
  29150. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  29151. $description = new ApplicationDescription($application, $namespace);
  29152. if ($namespace) {
  29153. $commandsXML->setAttribute('namespace', $namespace);
  29154. }
  29155. foreach ($description->getCommands() as $command) {
  29156. $this->appendDocument($commandsXML, $this->getCommandDocument($command));
  29157. }
  29158. if (!$namespace) {
  29159. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  29160. foreach ($description->getNamespaces() as $namespaceDescription) {
  29161. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  29162. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  29163. foreach ($namespaceDescription['commands'] as $name) {
  29164. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  29165. $commandXML->appendChild($dom->createTextNode($name));
  29166. }
  29167. }
  29168. }
  29169. return $dom;
  29170. }
  29171. protected function describeInputArgument(InputArgument $argument, array $options = array())
  29172. {
  29173. $this->writeDocument($this->getInputArgumentDocument($argument));
  29174. }
  29175. protected function describeInputOption(InputOption $option, array $options = array())
  29176. {
  29177. $this->writeDocument($this->getInputOptionDocument($option));
  29178. }
  29179. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  29180. {
  29181. $this->writeDocument($this->getInputDefinitionDocument($definition));
  29182. }
  29183. protected function describeCommand(Command $command, array $options = array())
  29184. {
  29185. $this->writeDocument($this->getCommandDocument($command));
  29186. }
  29187. protected function describeApplication(Application $application, array $options = array())
  29188. {
  29189. $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
  29190. }
  29191. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  29192. {
  29193. foreach ($importedParent->childNodes as $childNode) {
  29194. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  29195. }
  29196. }
  29197. private function writeDocument(\DOMDocument $dom)
  29198. {
  29199. $dom->formatOutput = true;
  29200. $this->write($dom->saveXML());
  29201. }
  29202. private function getInputArgumentDocument(InputArgument $argument)
  29203. {
  29204. $dom = new \DOMDocument('1.0', 'UTF-8');
  29205. $dom->appendChild($objectXML = $dom->createElement('argument'));
  29206. $objectXML->setAttribute('name', $argument->getName());
  29207. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  29208. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  29209. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  29210. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  29211. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  29212. $defaults = is_array($argument->getDefault()) ? $argument->getDefault() : (is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
  29213. foreach ($defaults as $default) {
  29214. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  29215. $defaultXML->appendChild($dom->createTextNode($default));
  29216. }
  29217. return $dom;
  29218. }
  29219. private function getInputOptionDocument(InputOption $option)
  29220. {
  29221. $dom = new \DOMDocument('1.0', 'UTF-8');
  29222. $dom->appendChild($objectXML = $dom->createElement('option'));
  29223. $objectXML->setAttribute('name', '--'.$option->getName());
  29224. $pos = strpos($option->getShortcut(), '|');
  29225. if (false !== $pos) {
  29226. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  29227. $objectXML->setAttribute('shortcuts', '-'.implode('|-', explode('|', $option->getShortcut())));
  29228. } else {
  29229. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  29230. }
  29231. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  29232. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  29233. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  29234. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  29235. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  29236. if ($option->acceptValue()) {
  29237. $defaults = is_array($option->getDefault()) ? $option->getDefault() : (is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
  29238. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  29239. if (!empty($defaults)) {
  29240. foreach ($defaults as $default) {
  29241. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  29242. $defaultXML->appendChild($dom->createTextNode($default));
  29243. }
  29244. }
  29245. }
  29246. return $dom;
  29247. }
  29248. }
  29249. <?php
  29250. namespace Symfony\Component\Console\Event;
  29251. class ConsoleCommandEvent extends ConsoleEvent
  29252. {
  29253. const RETURN_CODE_DISABLED = 113;
  29254. private $commandShouldRun = true;
  29255. public function disableCommand()
  29256. {
  29257. return $this->commandShouldRun = false;
  29258. }
  29259. public function enableCommand()
  29260. {
  29261. return $this->commandShouldRun = true;
  29262. }
  29263. public function commandShouldRun()
  29264. {
  29265. return $this->commandShouldRun;
  29266. }
  29267. }
  29268. <?php
  29269. namespace Symfony\Component\Console\Event;
  29270. use Symfony\Component\Console\Command\Command;
  29271. use Symfony\Component\Console\Input\InputInterface;
  29272. use Symfony\Component\Console\Output\OutputInterface;
  29273. use Symfony\Component\EventDispatcher\Event;
  29274. class ConsoleEvent extends Event
  29275. {
  29276. protected $command;
  29277. private $input;
  29278. private $output;
  29279. public function __construct(Command $command, InputInterface $input, OutputInterface $output)
  29280. {
  29281. $this->command = $command;
  29282. $this->input = $input;
  29283. $this->output = $output;
  29284. }
  29285. public function getCommand()
  29286. {
  29287. return $this->command;
  29288. }
  29289. public function getInput()
  29290. {
  29291. return $this->input;
  29292. }
  29293. public function getOutput()
  29294. {
  29295. return $this->output;
  29296. }
  29297. }
  29298. <?php
  29299. namespace Symfony\Component\Console\Event;
  29300. use Symfony\Component\Console\Command\Command;
  29301. use Symfony\Component\Console\Input\InputInterface;
  29302. use Symfony\Component\Console\Output\OutputInterface;
  29303. class ConsoleExceptionEvent extends ConsoleEvent
  29304. {
  29305. private $exception;
  29306. private $exitCode;
  29307. public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  29308. {
  29309. parent::__construct($command, $input, $output);
  29310. $this->setException($exception);
  29311. $this->exitCode = (int) $exitCode;
  29312. }
  29313. public function getException()
  29314. {
  29315. return $this->exception;
  29316. }
  29317. public function setException(\Exception $exception)
  29318. {
  29319. $this->exception = $exception;
  29320. }
  29321. public function getExitCode()
  29322. {
  29323. return $this->exitCode;
  29324. }
  29325. }
  29326. <?php
  29327. namespace Symfony\Component\Console\Event;
  29328. use Symfony\Component\Console\Command\Command;
  29329. use Symfony\Component\Console\Input\InputInterface;
  29330. use Symfony\Component\Console\Output\OutputInterface;
  29331. class ConsoleTerminateEvent extends ConsoleEvent
  29332. {
  29333. private $exitCode;
  29334. public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
  29335. {
  29336. parent::__construct($command, $input, $output);
  29337. $this->setExitCode($exitCode);
  29338. }
  29339. public function setExitCode($exitCode)
  29340. {
  29341. $this->exitCode = (int) $exitCode;
  29342. }
  29343. public function getExitCode()
  29344. {
  29345. return $this->exitCode;
  29346. }
  29347. }
  29348. <?php
  29349. namespace Symfony\Component\Console\Exception;
  29350. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  29351. {
  29352. private $alternatives;
  29353. public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
  29354. {
  29355. parent::__construct($message, $code, $previous);
  29356. $this->alternatives = $alternatives;
  29357. }
  29358. public function getAlternatives()
  29359. {
  29360. return $this->alternatives;
  29361. }
  29362. }
  29363. <?php
  29364. namespace Symfony\Component\Console\Exception;
  29365. interface ExceptionInterface
  29366. {
  29367. }
  29368. <?php
  29369. namespace Symfony\Component\Console\Exception;
  29370. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  29371. {
  29372. }
  29373. <?php
  29374. namespace Symfony\Component\Console\Exception;
  29375. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  29376. {
  29377. }
  29378. <?php
  29379. namespace Symfony\Component\Console\Exception;
  29380. class LogicException extends \LogicException implements ExceptionInterface
  29381. {
  29382. }
  29383. <?php
  29384. namespace Symfony\Component\Console\Exception;
  29385. class RuntimeException extends \RuntimeException implements ExceptionInterface
  29386. {
  29387. }
  29388. <?php
  29389. namespace Symfony\Component\Console\Formatter;
  29390. use Symfony\Component\Console\Exception\InvalidArgumentException;
  29391. class OutputFormatter implements OutputFormatterInterface
  29392. {
  29393. private $decorated;
  29394. private $styles = array();
  29395. private $styleStack;
  29396. public static function escape($text)
  29397. {
  29398. $text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
  29399. if ('\\' === substr($text, -1)) {
  29400. $len = strlen($text);
  29401. $text = rtrim($text, '\\');
  29402. $text .= str_repeat('<<', $len - strlen($text));
  29403. }
  29404. return $text;
  29405. }
  29406. public function __construct($decorated = false, array $styles = array())
  29407. {
  29408. $this->decorated = (bool) $decorated;
  29409. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  29410. $this->setStyle('info', new OutputFormatterStyle('green'));
  29411. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  29412. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  29413. foreach ($styles as $name => $style) {
  29414. $this->setStyle($name, $style);
  29415. }
  29416. $this->styleStack = new OutputFormatterStyleStack();
  29417. }
  29418. public function setDecorated($decorated)
  29419. {
  29420. $this->decorated = (bool) $decorated;
  29421. }
  29422. public function isDecorated()
  29423. {
  29424. return $this->decorated;
  29425. }
  29426. public function setStyle($name, OutputFormatterStyleInterface $style)
  29427. {
  29428. $this->styles[strtolower($name)] = $style;
  29429. }
  29430. public function hasStyle($name)
  29431. {
  29432. return isset($this->styles[strtolower($name)]);
  29433. }
  29434. public function getStyle($name)
  29435. {
  29436. if (!$this->hasStyle($name)) {
  29437. throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
  29438. }
  29439. return $this->styles[strtolower($name)];
  29440. }
  29441. public function format($message)
  29442. {
  29443. $message = (string) $message;
  29444. $offset = 0;
  29445. $output = '';
  29446. $tagRegex = '[a-z][a-z0-9_=;-]*+';
  29447. preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
  29448. foreach ($matches[0] as $i => $match) {
  29449. $pos = $match[1];
  29450. $text = $match[0];
  29451. if (0 != $pos && '\\' == $message[$pos - 1]) {
  29452. continue;
  29453. }
  29454. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
  29455. $offset = $pos + strlen($text);
  29456. if ($open = '/' != $text[1]) {
  29457. $tag = $matches[1][$i][0];
  29458. } else {
  29459. $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
  29460. }
  29461. if (!$open && !$tag) {
  29462. $this->styleStack->pop();
  29463. } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
  29464. $output .= $this->applyCurrentStyle($text);
  29465. } elseif ($open) {
  29466. $this->styleStack->push($style);
  29467. } else {
  29468. $this->styleStack->pop($style);
  29469. }
  29470. }
  29471. $output .= $this->applyCurrentStyle(substr($message, $offset));
  29472. if (false !== strpos($output, '<<')) {
  29473. return strtr($output, array('\\<' => '<', '<<' => '\\'));
  29474. }
  29475. return str_replace('\\<', '<', $output);
  29476. }
  29477. public function getStyleStack()
  29478. {
  29479. return $this->styleStack;
  29480. }
  29481. private function createStyleFromString($string)
  29482. {
  29483. if (isset($this->styles[$string])) {
  29484. return $this->styles[$string];
  29485. }
  29486. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
  29487. return false;
  29488. }
  29489. $style = new OutputFormatterStyle();
  29490. foreach ($matches as $match) {
  29491. array_shift($match);
  29492. if ('fg' == $match[0]) {
  29493. $style->setForeground($match[1]);
  29494. } elseif ('bg' == $match[0]) {
  29495. $style->setBackground($match[1]);
  29496. } else {
  29497. try {
  29498. $style->setOption($match[1]);
  29499. } catch (\InvalidArgumentException $e) {
  29500. return false;
  29501. }
  29502. }
  29503. }
  29504. return $style;
  29505. }
  29506. private function applyCurrentStyle($text)
  29507. {
  29508. return $this->isDecorated() && strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
  29509. }
  29510. }
  29511. <?php
  29512. namespace Symfony\Component\Console\Formatter;
  29513. interface OutputFormatterInterface
  29514. {
  29515. public function setDecorated($decorated);
  29516. public function isDecorated();
  29517. public function setStyle($name, OutputFormatterStyleInterface $style);
  29518. public function hasStyle($name);
  29519. public function getStyle($name);
  29520. public function format($message);
  29521. }
  29522. <?php
  29523. namespace Symfony\Component\Console\Formatter;
  29524. use Symfony\Component\Console\Exception\InvalidArgumentException;
  29525. class OutputFormatterStyle implements OutputFormatterStyleInterface
  29526. {
  29527. private static $availableForegroundColors = array(
  29528. 'black' => array('set' => 30, 'unset' => 39),
  29529. 'red' => array('set' => 31, 'unset' => 39),
  29530. 'green' => array('set' => 32, 'unset' => 39),
  29531. 'yellow' => array('set' => 33, 'unset' => 39),
  29532. 'blue' => array('set' => 34, 'unset' => 39),
  29533. 'magenta' => array('set' => 35, 'unset' => 39),
  29534. 'cyan' => array('set' => 36, 'unset' => 39),
  29535. 'white' => array('set' => 37, 'unset' => 39),
  29536. 'default' => array('set' => 39, 'unset' => 39),
  29537. );
  29538. private static $availableBackgroundColors = array(
  29539. 'black' => array('set' => 40, 'unset' => 49),
  29540. 'red' => array('set' => 41, 'unset' => 49),
  29541. 'green' => array('set' => 42, 'unset' => 49),
  29542. 'yellow' => array('set' => 43, 'unset' => 49),
  29543. 'blue' => array('set' => 44, 'unset' => 49),
  29544. 'magenta' => array('set' => 45, 'unset' => 49),
  29545. 'cyan' => array('set' => 46, 'unset' => 49),
  29546. 'white' => array('set' => 47, 'unset' => 49),
  29547. 'default' => array('set' => 49, 'unset' => 49),
  29548. );
  29549. private static $availableOptions = array(
  29550. 'bold' => array('set' => 1, 'unset' => 22),
  29551. 'underscore' => array('set' => 4, 'unset' => 24),
  29552. 'blink' => array('set' => 5, 'unset' => 25),
  29553. 'reverse' => array('set' => 7, 'unset' => 27),
  29554. 'conceal' => array('set' => 8, 'unset' => 28),
  29555. );
  29556. private $foreground;
  29557. private $background;
  29558. private $options = array();
  29559. public function __construct($foreground = null, $background = null, array $options = array())
  29560. {
  29561. if (null !== $foreground) {
  29562. $this->setForeground($foreground);
  29563. }
  29564. if (null !== $background) {
  29565. $this->setBackground($background);
  29566. }
  29567. if (count($options)) {
  29568. $this->setOptions($options);
  29569. }
  29570. }
  29571. public function setForeground($color = null)
  29572. {
  29573. if (null === $color) {
  29574. $this->foreground = null;
  29575. return;
  29576. }
  29577. if (!isset(static::$availableForegroundColors[$color])) {
  29578. throw new InvalidArgumentException(sprintf(
  29579. 'Invalid foreground color specified: "%s". Expected one of (%s)',
  29580. $color,
  29581. implode(', ', array_keys(static::$availableForegroundColors))
  29582. ));
  29583. }
  29584. $this->foreground = static::$availableForegroundColors[$color];
  29585. }
  29586. public function setBackground($color = null)
  29587. {
  29588. if (null === $color) {
  29589. $this->background = null;
  29590. return;
  29591. }
  29592. if (!isset(static::$availableBackgroundColors[$color])) {
  29593. throw new InvalidArgumentException(sprintf(
  29594. 'Invalid background color specified: "%s". Expected one of (%s)',
  29595. $color,
  29596. implode(', ', array_keys(static::$availableBackgroundColors))
  29597. ));
  29598. }
  29599. $this->background = static::$availableBackgroundColors[$color];
  29600. }
  29601. public function setOption($option)
  29602. {
  29603. if (!isset(static::$availableOptions[$option])) {
  29604. throw new InvalidArgumentException(sprintf(
  29605. 'Invalid option specified: "%s". Expected one of (%s)',
  29606. $option,
  29607. implode(', ', array_keys(static::$availableOptions))
  29608. ));
  29609. }
  29610. if (!in_array(static::$availableOptions[$option], $this->options)) {
  29611. $this->options[] = static::$availableOptions[$option];
  29612. }
  29613. }
  29614. public function unsetOption($option)
  29615. {
  29616. if (!isset(static::$availableOptions[$option])) {
  29617. throw new InvalidArgumentException(sprintf(
  29618. 'Invalid option specified: "%s". Expected one of (%s)',
  29619. $option,
  29620. implode(', ', array_keys(static::$availableOptions))
  29621. ));
  29622. }
  29623. $pos = array_search(static::$availableOptions[$option], $this->options);
  29624. if (false !== $pos) {
  29625. unset($this->options[$pos]);
  29626. }
  29627. }
  29628. public function setOptions(array $options)
  29629. {
  29630. $this->options = array();
  29631. foreach ($options as $option) {
  29632. $this->setOption($option);
  29633. }
  29634. }
  29635. public function apply($text)
  29636. {
  29637. $setCodes = array();
  29638. $unsetCodes = array();
  29639. if (null !== $this->foreground) {
  29640. $setCodes[] = $this->foreground['set'];
  29641. $unsetCodes[] = $this->foreground['unset'];
  29642. }
  29643. if (null !== $this->background) {
  29644. $setCodes[] = $this->background['set'];
  29645. $unsetCodes[] = $this->background['unset'];
  29646. }
  29647. if (count($this->options)) {
  29648. foreach ($this->options as $option) {
  29649. $setCodes[] = $option['set'];
  29650. $unsetCodes[] = $option['unset'];
  29651. }
  29652. }
  29653. if (0 === count($setCodes)) {
  29654. return $text;
  29655. }
  29656. return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
  29657. }
  29658. }
  29659. <?php
  29660. namespace Symfony\Component\Console\Formatter;
  29661. interface OutputFormatterStyleInterface
  29662. {
  29663. public function setForeground($color = null);
  29664. public function setBackground($color = null);
  29665. public function setOption($option);
  29666. public function unsetOption($option);
  29667. public function setOptions(array $options);
  29668. public function apply($text);
  29669. }
  29670. <?php
  29671. namespace Symfony\Component\Console\Formatter;
  29672. use Symfony\Component\Console\Exception\InvalidArgumentException;
  29673. class OutputFormatterStyleStack
  29674. {
  29675. private $styles;
  29676. private $emptyStyle;
  29677. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  29678. {
  29679. $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
  29680. $this->reset();
  29681. }
  29682. public function reset()
  29683. {
  29684. $this->styles = array();
  29685. }
  29686. public function push(OutputFormatterStyleInterface $style)
  29687. {
  29688. $this->styles[] = $style;
  29689. }
  29690. public function pop(OutputFormatterStyleInterface $style = null)
  29691. {
  29692. if (empty($this->styles)) {
  29693. return $this->emptyStyle;
  29694. }
  29695. if (null === $style) {
  29696. return array_pop($this->styles);
  29697. }
  29698. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  29699. if ($style->apply('') === $stackedStyle->apply('')) {
  29700. $this->styles = array_slice($this->styles, 0, $index);
  29701. return $stackedStyle;
  29702. }
  29703. }
  29704. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  29705. }
  29706. public function getCurrent()
  29707. {
  29708. if (empty($this->styles)) {
  29709. return $this->emptyStyle;
  29710. }
  29711. return $this->styles[count($this->styles) - 1];
  29712. }
  29713. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  29714. {
  29715. $this->emptyStyle = $emptyStyle;
  29716. return $this;
  29717. }
  29718. public function getEmptyStyle()
  29719. {
  29720. return $this->emptyStyle;
  29721. }
  29722. }
  29723. <?php
  29724. namespace Symfony\Component\Console\Helper;
  29725. class DebugFormatterHelper extends Helper
  29726. {
  29727. private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
  29728. private $started = array();
  29729. private $count = -1;
  29730. public function start($id, $message, $prefix = 'RUN')
  29731. {
  29732. $this->started[$id] = array('border' => ++$this->count % count($this->colors));
  29733. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  29734. }
  29735. public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
  29736. {
  29737. $message = '';
  29738. if ($error) {
  29739. if (isset($this->started[$id]['out'])) {
  29740. $message .= "\n";
  29741. unset($this->started[$id]['out']);
  29742. }
  29743. if (!isset($this->started[$id]['err'])) {
  29744. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  29745. $this->started[$id]['err'] = true;
  29746. }
  29747. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  29748. } else {
  29749. if (isset($this->started[$id]['err'])) {
  29750. $message .= "\n";
  29751. unset($this->started[$id]['err']);
  29752. }
  29753. if (!isset($this->started[$id]['out'])) {
  29754. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  29755. $this->started[$id]['out'] = true;
  29756. }
  29757. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  29758. }
  29759. return $message;
  29760. }
  29761. public function stop($id, $message, $successful, $prefix = 'RES')
  29762. {
  29763. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  29764. if ($successful) {
  29765. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  29766. }
  29767. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  29768. unset($this->started[$id]['out'], $this->started[$id]['err']);
  29769. return $message;
  29770. }
  29771. private function getBorder($id)
  29772. {
  29773. return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
  29774. }
  29775. public function getName()
  29776. {
  29777. return 'debug_formatter';
  29778. }
  29779. }
  29780. <?php
  29781. namespace Symfony\Component\Console\Helper;
  29782. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  29783. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  29784. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  29785. use Symfony\Component\Console\Descriptor\TextDescriptor;
  29786. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  29787. use Symfony\Component\Console\Output\OutputInterface;
  29788. use Symfony\Component\Console\Exception\InvalidArgumentException;
  29789. class DescriptorHelper extends Helper
  29790. {
  29791. private $descriptors = array();
  29792. public function __construct()
  29793. {
  29794. $this
  29795. ->register('txt', new TextDescriptor())
  29796. ->register('xml', new XmlDescriptor())
  29797. ->register('json', new JsonDescriptor())
  29798. ->register('md', new MarkdownDescriptor())
  29799. ;
  29800. }
  29801. public function describe(OutputInterface $output, $object, array $options = array())
  29802. {
  29803. $options = array_merge(array(
  29804. 'raw_text' => false,
  29805. 'format' => 'txt',
  29806. ), $options);
  29807. if (!isset($this->descriptors[$options['format']])) {
  29808. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  29809. }
  29810. $descriptor = $this->descriptors[$options['format']];
  29811. $descriptor->describe($output, $object, $options);
  29812. }
  29813. public function register($format, DescriptorInterface $descriptor)
  29814. {
  29815. $this->descriptors[$format] = $descriptor;
  29816. return $this;
  29817. }
  29818. public function getName()
  29819. {
  29820. return 'descriptor';
  29821. }
  29822. }
  29823. <?php
  29824. namespace Symfony\Component\Console\Helper;
  29825. use Symfony\Component\Console\Exception\InvalidArgumentException;
  29826. use Symfony\Component\Console\Exception\RuntimeException;
  29827. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  29828. use Symfony\Component\Console\Output\OutputInterface;
  29829. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  29830. class DialogHelper extends InputAwareHelper
  29831. {
  29832. private $inputStream;
  29833. private static $shell;
  29834. private static $stty;
  29835. public function __construct($triggerDeprecationError = true)
  29836. {
  29837. if ($triggerDeprecationError) {
  29838. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  29839. }
  29840. }
  29841. public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  29842. {
  29843. if ($output instanceof ConsoleOutputInterface) {
  29844. $output = $output->getErrorOutput();
  29845. }
  29846. $width = max(array_map('strlen', array_keys($choices)));
  29847. $messages = (array) $question;
  29848. foreach ($choices as $key => $value) {
  29849. $messages[] = sprintf(" [<info>%-{$width}s</info>] %s", $key, $value);
  29850. }
  29851. $output->writeln($messages);
  29852. $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
  29853. $selectedChoices = str_replace(' ', '', $picked);
  29854. if ($multiselect) {
  29855. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  29856. throw new InvalidArgumentException(sprintf($errorMessage, $picked));
  29857. }
  29858. $selectedChoices = explode(',', $selectedChoices);
  29859. } else {
  29860. $selectedChoices = array($picked);
  29861. }
  29862. $multiselectChoices = array();
  29863. foreach ($selectedChoices as $value) {
  29864. if (empty($choices[$value])) {
  29865. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  29866. }
  29867. $multiselectChoices[] = $value;
  29868. }
  29869. if ($multiselect) {
  29870. return $multiselectChoices;
  29871. }
  29872. return $picked;
  29873. }, $attempts, $default);
  29874. return $result;
  29875. }
  29876. public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
  29877. {
  29878. if ($this->input && !$this->input->isInteractive()) {
  29879. return $default;
  29880. }
  29881. if ($output instanceof ConsoleOutputInterface) {
  29882. $output = $output->getErrorOutput();
  29883. }
  29884. $output->write($question);
  29885. $inputStream = $this->inputStream ?: STDIN;
  29886. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  29887. $ret = fgets($inputStream, 4096);
  29888. if (false === $ret) {
  29889. throw new RuntimeException('Aborted');
  29890. }
  29891. $ret = trim($ret);
  29892. } else {
  29893. $ret = '';
  29894. $i = 0;
  29895. $ofs = -1;
  29896. $matches = $autocomplete;
  29897. $numMatches = count($matches);
  29898. $sttyMode = shell_exec('stty -g');
  29899. shell_exec('stty -icanon -echo');
  29900. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  29901. while (!feof($inputStream)) {
  29902. $c = fread($inputStream, 1);
  29903. if ("\177" === $c) {
  29904. if (0 === $numMatches && 0 !== $i) {
  29905. --$i;
  29906. $output->write("\033[1D");
  29907. }
  29908. if ($i === 0) {
  29909. $ofs = -1;
  29910. $matches = $autocomplete;
  29911. $numMatches = count($matches);
  29912. } else {
  29913. $numMatches = 0;
  29914. }
  29915. $ret = substr($ret, 0, $i);
  29916. } elseif ("\033" === $c) {
  29917. $c .= fread($inputStream, 2);
  29918. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  29919. if ('A' === $c[2] && -1 === $ofs) {
  29920. $ofs = 0;
  29921. }
  29922. if (0 === $numMatches) {
  29923. continue;
  29924. }
  29925. $ofs += ('A' === $c[2]) ? -1 : 1;
  29926. $ofs = ($numMatches + $ofs) % $numMatches;
  29927. }
  29928. } elseif (ord($c) < 32) {
  29929. if ("\t" === $c || "\n" === $c) {
  29930. if ($numMatches > 0 && -1 !== $ofs) {
  29931. $ret = $matches[$ofs];
  29932. $output->write(substr($ret, $i));
  29933. $i = strlen($ret);
  29934. }
  29935. if ("\n" === $c) {
  29936. $output->write($c);
  29937. break;
  29938. }
  29939. $numMatches = 0;
  29940. }
  29941. continue;
  29942. } else {
  29943. $output->write($c);
  29944. $ret .= $c;
  29945. ++$i;
  29946. $numMatches = 0;
  29947. $ofs = 0;
  29948. foreach ($autocomplete as $value) {
  29949. if (0 === strpos($value, $ret) && $i !== strlen($value)) {
  29950. $matches[$numMatches++] = $value;
  29951. }
  29952. }
  29953. }
  29954. $output->write("\033[K");
  29955. if ($numMatches > 0 && -1 !== $ofs) {
  29956. $output->write("\0337");
  29957. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  29958. $output->write("\0338");
  29959. }
  29960. }
  29961. shell_exec(sprintf('stty %s', $sttyMode));
  29962. }
  29963. return strlen($ret) > 0 ? $ret : $default;
  29964. }
  29965. public function askConfirmation(OutputInterface $output, $question, $default = true)
  29966. {
  29967. $answer = 'z';
  29968. while ($answer && !in_array(strtolower($answer[0]), array('y', 'n'))) {
  29969. $answer = $this->ask($output, $question);
  29970. }
  29971. if (false === $default) {
  29972. return $answer && 'y' == strtolower($answer[0]);
  29973. }
  29974. return !$answer || 'y' == strtolower($answer[0]);
  29975. }
  29976. public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
  29977. {
  29978. if ($output instanceof ConsoleOutputInterface) {
  29979. $output = $output->getErrorOutput();
  29980. }
  29981. if ('\\' === DIRECTORY_SEPARATOR) {
  29982. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  29983. if ('phar:' === substr(__FILE__, 0, 5)) {
  29984. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  29985. copy($exe, $tmpExe);
  29986. $exe = $tmpExe;
  29987. }
  29988. $output->write($question);
  29989. $value = rtrim(shell_exec($exe));
  29990. $output->writeln('');
  29991. if (isset($tmpExe)) {
  29992. unlink($tmpExe);
  29993. }
  29994. return $value;
  29995. }
  29996. if ($this->hasSttyAvailable()) {
  29997. $output->write($question);
  29998. $sttyMode = shell_exec('stty -g');
  29999. shell_exec('stty -echo');
  30000. $value = fgets($this->inputStream ?: STDIN, 4096);
  30001. shell_exec(sprintf('stty %s', $sttyMode));
  30002. if (false === $value) {
  30003. throw new RuntimeException('Aborted');
  30004. }
  30005. $value = trim($value);
  30006. $output->writeln('');
  30007. return $value;
  30008. }
  30009. if (false !== $shell = $this->getShell()) {
  30010. $output->write($question);
  30011. $readCmd = $shell === 'csh' ? 'set mypassword = $<' : 'read -r mypassword';
  30012. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  30013. $value = rtrim(shell_exec($command));
  30014. $output->writeln('');
  30015. return $value;
  30016. }
  30017. if ($fallback) {
  30018. return $this->ask($output, $question);
  30019. }
  30020. throw new RuntimeException('Unable to hide the response');
  30021. }
  30022. public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
  30023. {
  30024. $that = $this;
  30025. $interviewer = function () use ($output, $question, $default, $autocomplete, $that) {
  30026. return $that->ask($output, $question, $default, $autocomplete);
  30027. };
  30028. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  30029. }
  30030. public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
  30031. {
  30032. $that = $this;
  30033. $interviewer = function () use ($output, $question, $fallback, $that) {
  30034. return $that->askHiddenResponse($output, $question, $fallback);
  30035. };
  30036. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  30037. }
  30038. public function setInputStream($stream)
  30039. {
  30040. $this->inputStream = $stream;
  30041. }
  30042. public function getInputStream()
  30043. {
  30044. return $this->inputStream;
  30045. }
  30046. public function getName()
  30047. {
  30048. return 'dialog';
  30049. }
  30050. private function getShell()
  30051. {
  30052. if (null !== self::$shell) {
  30053. return self::$shell;
  30054. }
  30055. self::$shell = false;
  30056. if (file_exists('/usr/bin/env')) {
  30057. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  30058. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  30059. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  30060. self::$shell = $sh;
  30061. break;
  30062. }
  30063. }
  30064. }
  30065. return self::$shell;
  30066. }
  30067. private function hasSttyAvailable()
  30068. {
  30069. if (null !== self::$stty) {
  30070. return self::$stty;
  30071. }
  30072. exec('stty 2>&1', $output, $exitcode);
  30073. return self::$stty = $exitcode === 0;
  30074. }
  30075. private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
  30076. {
  30077. if ($output instanceof ConsoleOutputInterface) {
  30078. $output = $output->getErrorOutput();
  30079. }
  30080. $e = null;
  30081. while (false === $attempts || $attempts--) {
  30082. if (null !== $e) {
  30083. $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
  30084. }
  30085. try {
  30086. return call_user_func($validator, $interviewer());
  30087. } catch (\Exception $e) {
  30088. }
  30089. }
  30090. throw $e;
  30091. }
  30092. }
  30093. <?php
  30094. namespace Symfony\Component\Console\Helper;
  30095. use Symfony\Component\Console\Formatter\OutputFormatter;
  30096. class FormatterHelper extends Helper
  30097. {
  30098. public function formatSection($section, $message, $style = 'info')
  30099. {
  30100. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  30101. }
  30102. public function formatBlock($messages, $style, $large = false)
  30103. {
  30104. if (!is_array($messages)) {
  30105. $messages = array($messages);
  30106. }
  30107. $len = 0;
  30108. $lines = array();
  30109. foreach ($messages as $message) {
  30110. $message = OutputFormatter::escape($message);
  30111. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  30112. $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
  30113. }
  30114. $messages = $large ? array(str_repeat(' ', $len)) : array();
  30115. for ($i = 0; isset($lines[$i]); ++$i) {
  30116. $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
  30117. }
  30118. if ($large) {
  30119. $messages[] = str_repeat(' ', $len);
  30120. }
  30121. for ($i = 0; isset($messages[$i]); ++$i) {
  30122. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  30123. }
  30124. return implode("\n", $messages);
  30125. }
  30126. public function getName()
  30127. {
  30128. return 'formatter';
  30129. }
  30130. }
  30131. <?php
  30132. namespace Symfony\Component\Console\Helper;
  30133. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  30134. abstract class Helper implements HelperInterface
  30135. {
  30136. protected $helperSet = null;
  30137. public function setHelperSet(HelperSet $helperSet = null)
  30138. {
  30139. $this->helperSet = $helperSet;
  30140. }
  30141. public function getHelperSet()
  30142. {
  30143. return $this->helperSet;
  30144. }
  30145. public static function strlen($string)
  30146. {
  30147. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  30148. return strlen($string);
  30149. }
  30150. return mb_strwidth($string, $encoding);
  30151. }
  30152. public static function formatTime($secs)
  30153. {
  30154. static $timeFormats = array(
  30155. array(0, '< 1 sec'),
  30156. array(1, '1 sec'),
  30157. array(2, 'secs', 1),
  30158. array(60, '1 min'),
  30159. array(120, 'mins', 60),
  30160. array(3600, '1 hr'),
  30161. array(7200, 'hrs', 3600),
  30162. array(86400, '1 day'),
  30163. array(172800, 'days', 86400),
  30164. );
  30165. foreach ($timeFormats as $index => $format) {
  30166. if ($secs >= $format[0]) {
  30167. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  30168. || $index == count($timeFormats) - 1
  30169. ) {
  30170. if (2 == count($format)) {
  30171. return $format[1];
  30172. }
  30173. return floor($secs / $format[2]).' '.$format[1];
  30174. }
  30175. }
  30176. }
  30177. }
  30178. public static function formatMemory($memory)
  30179. {
  30180. if ($memory >= 1024 * 1024 * 1024) {
  30181. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  30182. }
  30183. if ($memory >= 1024 * 1024) {
  30184. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  30185. }
  30186. if ($memory >= 1024) {
  30187. return sprintf('%d KiB', $memory / 1024);
  30188. }
  30189. return sprintf('%d B', $memory);
  30190. }
  30191. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
  30192. {
  30193. $isDecorated = $formatter->isDecorated();
  30194. $formatter->setDecorated(false);
  30195. $string = $formatter->format($string);
  30196. $string = preg_replace("/\033\[[^m]*m/", '', $string);
  30197. $formatter->setDecorated($isDecorated);
  30198. return self::strlen($string);
  30199. }
  30200. }
  30201. <?php
  30202. namespace Symfony\Component\Console\Helper;
  30203. interface HelperInterface
  30204. {
  30205. public function setHelperSet(HelperSet $helperSet = null);
  30206. public function getHelperSet();
  30207. public function getName();
  30208. }
  30209. <?php
  30210. namespace Symfony\Component\Console\Helper;
  30211. use Symfony\Component\Console\Command\Command;
  30212. use Symfony\Component\Console\Exception\InvalidArgumentException;
  30213. class HelperSet implements \IteratorAggregate
  30214. {
  30215. private $helpers = array();
  30216. private $command;
  30217. public function __construct(array $helpers = array())
  30218. {
  30219. foreach ($helpers as $alias => $helper) {
  30220. $this->set($helper, is_int($alias) ? null : $alias);
  30221. }
  30222. }
  30223. public function set(HelperInterface $helper, $alias = null)
  30224. {
  30225. $this->helpers[$helper->getName()] = $helper;
  30226. if (null !== $alias) {
  30227. $this->helpers[$alias] = $helper;
  30228. }
  30229. $helper->setHelperSet($this);
  30230. }
  30231. public function has($name)
  30232. {
  30233. return isset($this->helpers[$name]);
  30234. }
  30235. public function get($name)
  30236. {
  30237. if (!$this->has($name)) {
  30238. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  30239. }
  30240. if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
  30241. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  30242. } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
  30243. @trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED);
  30244. } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
  30245. @trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED);
  30246. }
  30247. return $this->helpers[$name];
  30248. }
  30249. public function setCommand(Command $command = null)
  30250. {
  30251. $this->command = $command;
  30252. }
  30253. public function getCommand()
  30254. {
  30255. return $this->command;
  30256. }
  30257. public function getIterator()
  30258. {
  30259. return new \ArrayIterator($this->helpers);
  30260. }
  30261. }
  30262. <?php
  30263. namespace Symfony\Component\Console\Helper;
  30264. use Symfony\Component\Console\Input\InputInterface;
  30265. use Symfony\Component\Console\Input\InputAwareInterface;
  30266. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  30267. {
  30268. protected $input;
  30269. public function setInput(InputInterface $input)
  30270. {
  30271. $this->input = $input;
  30272. }
  30273. }
  30274. <?php
  30275. namespace Symfony\Component\Console\Helper;
  30276. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  30277. use Symfony\Component\Console\Output\OutputInterface;
  30278. use Symfony\Component\Process\Exception\ProcessFailedException;
  30279. use Symfony\Component\Process\Process;
  30280. use Symfony\Component\Process\ProcessBuilder;
  30281. class ProcessHelper extends Helper
  30282. {
  30283. public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
  30284. {
  30285. if ($output instanceof ConsoleOutputInterface) {
  30286. $output = $output->getErrorOutput();
  30287. }
  30288. $formatter = $this->getHelperSet()->get('debug_formatter');
  30289. if (is_array($cmd)) {
  30290. $process = ProcessBuilder::create($cmd)->getProcess();
  30291. } elseif ($cmd instanceof Process) {
  30292. $process = $cmd;
  30293. } else {
  30294. $process = new Process($cmd);
  30295. }
  30296. if ($verbosity <= $output->getVerbosity()) {
  30297. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  30298. }
  30299. if ($output->isDebug()) {
  30300. $callback = $this->wrapCallback($output, $process, $callback);
  30301. }
  30302. $process->run($callback);
  30303. if ($verbosity <= $output->getVerbosity()) {
  30304. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  30305. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  30306. }
  30307. if (!$process->isSuccessful() && null !== $error) {
  30308. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  30309. }
  30310. return $process;
  30311. }
  30312. public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
  30313. {
  30314. $process = $this->run($output, $cmd, $error, $callback);
  30315. if (!$process->isSuccessful()) {
  30316. throw new ProcessFailedException($process);
  30317. }
  30318. return $process;
  30319. }
  30320. public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
  30321. {
  30322. if ($output instanceof ConsoleOutputInterface) {
  30323. $output = $output->getErrorOutput();
  30324. }
  30325. $formatter = $this->getHelperSet()->get('debug_formatter');
  30326. $that = $this;
  30327. return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
  30328. $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
  30329. if (null !== $callback) {
  30330. call_user_func($callback, $type, $buffer);
  30331. }
  30332. };
  30333. }
  30334. public function escapeString($str)
  30335. {
  30336. return str_replace('<', '\\<', $str);
  30337. }
  30338. public function getName()
  30339. {
  30340. return 'process';
  30341. }
  30342. }
  30343. <?php
  30344. namespace Symfony\Component\Console\Helper;
  30345. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  30346. use Symfony\Component\Console\Output\OutputInterface;
  30347. use Symfony\Component\Console\Exception\LogicException;
  30348. class ProgressBar
  30349. {
  30350. private $barWidth = 28;
  30351. private $barChar;
  30352. private $emptyBarChar = '-';
  30353. private $progressChar = '>';
  30354. private $format;
  30355. private $internalFormat;
  30356. private $redrawFreq = 1;
  30357. private $output;
  30358. private $step = 0;
  30359. private $max;
  30360. private $startTime;
  30361. private $stepWidth;
  30362. private $percent = 0.0;
  30363. private $formatLineCount;
  30364. private $messages = array();
  30365. private $overwrite = true;
  30366. private $firstRun = true;
  30367. private static $formatters;
  30368. private static $formats;
  30369. public function __construct(OutputInterface $output, $max = 0)
  30370. {
  30371. if ($output instanceof ConsoleOutputInterface) {
  30372. $output = $output->getErrorOutput();
  30373. }
  30374. $this->output = $output;
  30375. $this->setMaxSteps($max);
  30376. if (!$this->output->isDecorated()) {
  30377. $this->overwrite = false;
  30378. $this->setRedrawFrequency($max / 10);
  30379. }
  30380. $this->startTime = time();
  30381. }
  30382. public static function setPlaceholderFormatterDefinition($name, $callable)
  30383. {
  30384. if (!self::$formatters) {
  30385. self::$formatters = self::initPlaceholderFormatters();
  30386. }
  30387. self::$formatters[$name] = $callable;
  30388. }
  30389. public static function getPlaceholderFormatterDefinition($name)
  30390. {
  30391. if (!self::$formatters) {
  30392. self::$formatters = self::initPlaceholderFormatters();
  30393. }
  30394. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  30395. }
  30396. public static function setFormatDefinition($name, $format)
  30397. {
  30398. if (!self::$formats) {
  30399. self::$formats = self::initFormats();
  30400. }
  30401. self::$formats[$name] = $format;
  30402. }
  30403. public static function getFormatDefinition($name)
  30404. {
  30405. if (!self::$formats) {
  30406. self::$formats = self::initFormats();
  30407. }
  30408. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  30409. }
  30410. public function setMessage($message, $name = 'message')
  30411. {
  30412. $this->messages[$name] = $message;
  30413. }
  30414. public function getMessage($name = 'message')
  30415. {
  30416. return $this->messages[$name];
  30417. }
  30418. public function getStartTime()
  30419. {
  30420. return $this->startTime;
  30421. }
  30422. public function getMaxSteps()
  30423. {
  30424. return $this->max;
  30425. }
  30426. public function getStep()
  30427. {
  30428. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);
  30429. return $this->getProgress();
  30430. }
  30431. public function getProgress()
  30432. {
  30433. return $this->step;
  30434. }
  30435. public function getStepWidth()
  30436. {
  30437. return $this->stepWidth;
  30438. }
  30439. public function getProgressPercent()
  30440. {
  30441. return $this->percent;
  30442. }
  30443. public function setBarWidth($size)
  30444. {
  30445. $this->barWidth = (int) $size;
  30446. }
  30447. public function getBarWidth()
  30448. {
  30449. return $this->barWidth;
  30450. }
  30451. public function setBarCharacter($char)
  30452. {
  30453. $this->barChar = $char;
  30454. }
  30455. public function getBarCharacter()
  30456. {
  30457. if (null === $this->barChar) {
  30458. return $this->max ? '=' : $this->emptyBarChar;
  30459. }
  30460. return $this->barChar;
  30461. }
  30462. public function setEmptyBarCharacter($char)
  30463. {
  30464. $this->emptyBarChar = $char;
  30465. }
  30466. public function getEmptyBarCharacter()
  30467. {
  30468. return $this->emptyBarChar;
  30469. }
  30470. public function setProgressCharacter($char)
  30471. {
  30472. $this->progressChar = $char;
  30473. }
  30474. public function getProgressCharacter()
  30475. {
  30476. return $this->progressChar;
  30477. }
  30478. public function setFormat($format)
  30479. {
  30480. $this->format = null;
  30481. $this->internalFormat = $format;
  30482. }
  30483. public function setRedrawFrequency($freq)
  30484. {
  30485. $this->redrawFreq = max((int) $freq, 1);
  30486. }
  30487. public function start($max = null)
  30488. {
  30489. $this->startTime = time();
  30490. $this->step = 0;
  30491. $this->percent = 0.0;
  30492. if (null !== $max) {
  30493. $this->setMaxSteps($max);
  30494. }
  30495. $this->display();
  30496. }
  30497. public function advance($step = 1)
  30498. {
  30499. $this->setProgress($this->step + $step);
  30500. }
  30501. public function setCurrent($step)
  30502. {
  30503. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);
  30504. $this->setProgress($step);
  30505. }
  30506. public function setOverwrite($overwrite)
  30507. {
  30508. $this->overwrite = (bool) $overwrite;
  30509. }
  30510. public function setProgress($step)
  30511. {
  30512. $step = (int) $step;
  30513. if ($step < $this->step) {
  30514. throw new LogicException('You can\'t regress the progress bar.');
  30515. }
  30516. if ($this->max && $step > $this->max) {
  30517. $this->max = $step;
  30518. }
  30519. $prevPeriod = (int) ($this->step / $this->redrawFreq);
  30520. $currPeriod = (int) ($step / $this->redrawFreq);
  30521. $this->step = $step;
  30522. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  30523. if ($prevPeriod !== $currPeriod || $this->max === $step) {
  30524. $this->display();
  30525. }
  30526. }
  30527. public function finish()
  30528. {
  30529. if (!$this->max) {
  30530. $this->max = $this->step;
  30531. }
  30532. if ($this->step === $this->max && !$this->overwrite) {
  30533. return;
  30534. }
  30535. $this->setProgress($this->max);
  30536. }
  30537. public function display()
  30538. {
  30539. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  30540. return;
  30541. }
  30542. if (null === $this->format) {
  30543. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  30544. }
  30545. $self = $this;
  30546. $output = $this->output;
  30547. $messages = $this->messages;
  30548. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
  30549. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  30550. $text = call_user_func($formatter, $self, $output);
  30551. } elseif (isset($messages[$matches[1]])) {
  30552. $text = $messages[$matches[1]];
  30553. } else {
  30554. return $matches[0];
  30555. }
  30556. if (isset($matches[2])) {
  30557. $text = sprintf('%'.$matches[2], $text);
  30558. }
  30559. return $text;
  30560. }, $this->format));
  30561. }
  30562. public function clear()
  30563. {
  30564. if (!$this->overwrite) {
  30565. return;
  30566. }
  30567. if (null === $this->format) {
  30568. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  30569. }
  30570. $this->overwrite('');
  30571. }
  30572. private function setRealFormat($format)
  30573. {
  30574. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  30575. $this->format = self::getFormatDefinition($format.'_nomax');
  30576. } elseif (null !== self::getFormatDefinition($format)) {
  30577. $this->format = self::getFormatDefinition($format);
  30578. } else {
  30579. $this->format = $format;
  30580. }
  30581. $this->formatLineCount = substr_count($this->format, "\n");
  30582. }
  30583. private function setMaxSteps($max)
  30584. {
  30585. $this->max = max(0, (int) $max);
  30586. $this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
  30587. }
  30588. private function overwrite($message)
  30589. {
  30590. if ($this->overwrite) {
  30591. if (!$this->firstRun) {
  30592. $this->output->write("\x0D");
  30593. $this->output->write("\x1B[2K");
  30594. if ($this->formatLineCount > 0) {
  30595. $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
  30596. }
  30597. }
  30598. } elseif ($this->step > 0) {
  30599. $this->output->writeln('');
  30600. }
  30601. $this->firstRun = false;
  30602. $this->output->write($message);
  30603. }
  30604. private function determineBestFormat()
  30605. {
  30606. switch ($this->output->getVerbosity()) {
  30607. case OutputInterface::VERBOSITY_VERBOSE:
  30608. return $this->max ? 'verbose' : 'verbose_nomax';
  30609. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  30610. return $this->max ? 'very_verbose' : 'very_verbose_nomax';
  30611. case OutputInterface::VERBOSITY_DEBUG:
  30612. return $this->max ? 'debug' : 'debug_nomax';
  30613. default:
  30614. return $this->max ? 'normal' : 'normal_nomax';
  30615. }
  30616. }
  30617. private static function initPlaceholderFormatters()
  30618. {
  30619. return array(
  30620. 'bar' => function (ProgressBar $bar, OutputInterface $output) {
  30621. $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
  30622. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  30623. if ($completeBars < $bar->getBarWidth()) {
  30624. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
  30625. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  30626. }
  30627. return $display;
  30628. },
  30629. 'elapsed' => function (ProgressBar $bar) {
  30630. return Helper::formatTime(time() - $bar->getStartTime());
  30631. },
  30632. 'remaining' => function (ProgressBar $bar) {
  30633. if (!$bar->getMaxSteps()) {
  30634. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  30635. }
  30636. if (!$bar->getProgress()) {
  30637. $remaining = 0;
  30638. } else {
  30639. $remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
  30640. }
  30641. return Helper::formatTime($remaining);
  30642. },
  30643. 'estimated' => function (ProgressBar $bar) {
  30644. if (!$bar->getMaxSteps()) {
  30645. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  30646. }
  30647. if (!$bar->getProgress()) {
  30648. $estimated = 0;
  30649. } else {
  30650. $estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
  30651. }
  30652. return Helper::formatTime($estimated);
  30653. },
  30654. 'memory' => function (ProgressBar $bar) {
  30655. return Helper::formatMemory(memory_get_usage(true));
  30656. },
  30657. 'current' => function (ProgressBar $bar) {
  30658. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
  30659. },
  30660. 'max' => function (ProgressBar $bar) {
  30661. return $bar->getMaxSteps();
  30662. },
  30663. 'percent' => function (ProgressBar $bar) {
  30664. return floor($bar->getProgressPercent() * 100);
  30665. },
  30666. );
  30667. }
  30668. private static function initFormats()
  30669. {
  30670. return array(
  30671. 'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
  30672. 'normal_nomax' => ' %current% [%bar%]',
  30673. 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  30674. 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  30675. 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  30676. 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  30677. 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  30678. 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  30679. );
  30680. }
  30681. }
  30682. <?php
  30683. namespace Symfony\Component\Console\Helper;
  30684. use Symfony\Component\Console\Output\NullOutput;
  30685. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  30686. use Symfony\Component\Console\Output\OutputInterface;
  30687. use Symfony\Component\Console\Exception\LogicException;
  30688. class ProgressHelper extends Helper
  30689. {
  30690. const FORMAT_QUIET = ' %percent%%';
  30691. const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
  30692. const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
  30693. const FORMAT_QUIET_NOMAX = ' %current%';
  30694. const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
  30695. const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
  30696. private $barWidth = 28;
  30697. private $barChar = '=';
  30698. private $emptyBarChar = '-';
  30699. private $progressChar = '>';
  30700. private $format = null;
  30701. private $redrawFreq = 1;
  30702. private $lastMessagesLength;
  30703. private $barCharOriginal;
  30704. private $output;
  30705. private $current;
  30706. private $max;
  30707. private $startTime;
  30708. private $defaultFormatVars = array(
  30709. 'current',
  30710. 'max',
  30711. 'bar',
  30712. 'percent',
  30713. 'elapsed',
  30714. );
  30715. private $formatVars;
  30716. private $widths = array(
  30717. 'current' => 4,
  30718. 'max' => 4,
  30719. 'percent' => 3,
  30720. 'elapsed' => 6,
  30721. );
  30722. private $timeFormats = array(
  30723. array(0, '???'),
  30724. array(2, '1 sec'),
  30725. array(59, 'secs', 1),
  30726. array(60, '1 min'),
  30727. array(3600, 'mins', 60),
  30728. array(5400, '1 hr'),
  30729. array(86400, 'hrs', 3600),
  30730. array(129600, '1 day'),
  30731. array(604800, 'days', 86400),
  30732. );
  30733. public function __construct($triggerDeprecationError = true)
  30734. {
  30735. if ($triggerDeprecationError) {
  30736. @trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED);
  30737. }
  30738. }
  30739. public function setBarWidth($size)
  30740. {
  30741. $this->barWidth = (int) $size;
  30742. }
  30743. public function setBarCharacter($char)
  30744. {
  30745. $this->barChar = $char;
  30746. }
  30747. public function setEmptyBarCharacter($char)
  30748. {
  30749. $this->emptyBarChar = $char;
  30750. }
  30751. public function setProgressCharacter($char)
  30752. {
  30753. $this->progressChar = $char;
  30754. }
  30755. public function setFormat($format)
  30756. {
  30757. $this->format = $format;
  30758. }
  30759. public function setRedrawFrequency($freq)
  30760. {
  30761. $this->redrawFreq = (int) $freq;
  30762. }
  30763. public function start(OutputInterface $output, $max = null)
  30764. {
  30765. if ($output instanceof ConsoleOutputInterface) {
  30766. $output = $output->getErrorOutput();
  30767. }
  30768. $this->startTime = time();
  30769. $this->current = 0;
  30770. $this->max = (int) $max;
  30771. $this->output = $output->isDecorated() ? $output : new NullOutput();
  30772. $this->lastMessagesLength = 0;
  30773. $this->barCharOriginal = '';
  30774. if (null === $this->format) {
  30775. switch ($output->getVerbosity()) {
  30776. case OutputInterface::VERBOSITY_QUIET:
  30777. $this->format = self::FORMAT_QUIET_NOMAX;
  30778. if ($this->max > 0) {
  30779. $this->format = self::FORMAT_QUIET;
  30780. }
  30781. break;
  30782. case OutputInterface::VERBOSITY_VERBOSE:
  30783. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  30784. case OutputInterface::VERBOSITY_DEBUG:
  30785. $this->format = self::FORMAT_VERBOSE_NOMAX;
  30786. if ($this->max > 0) {
  30787. $this->format = self::FORMAT_VERBOSE;
  30788. }
  30789. break;
  30790. default:
  30791. $this->format = self::FORMAT_NORMAL_NOMAX;
  30792. if ($this->max > 0) {
  30793. $this->format = self::FORMAT_NORMAL;
  30794. }
  30795. break;
  30796. }
  30797. }
  30798. $this->initialize();
  30799. }
  30800. public function advance($step = 1, $redraw = false)
  30801. {
  30802. $this->setCurrent($this->current + $step, $redraw);
  30803. }
  30804. public function setCurrent($current, $redraw = false)
  30805. {
  30806. if (null === $this->startTime) {
  30807. throw new LogicException('You must start the progress bar before calling setCurrent().');
  30808. }
  30809. $current = (int) $current;
  30810. if ($current < $this->current) {
  30811. throw new LogicException('You can\'t regress the progress bar');
  30812. }
  30813. if (0 === $this->current) {
  30814. $redraw = true;
  30815. }
  30816. $prevPeriod = (int) ($this->current / $this->redrawFreq);
  30817. $this->current = $current;
  30818. $currPeriod = (int) ($this->current / $this->redrawFreq);
  30819. if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
  30820. $this->display();
  30821. }
  30822. }
  30823. public function display($finish = false)
  30824. {
  30825. if (null === $this->startTime) {
  30826. throw new LogicException('You must start the progress bar before calling display().');
  30827. }
  30828. $message = $this->format;
  30829. foreach ($this->generate($finish) as $name => $value) {
  30830. $message = str_replace("%{$name}%", $value, $message);
  30831. }
  30832. $this->overwrite($this->output, $message);
  30833. }
  30834. public function clear()
  30835. {
  30836. $this->overwrite($this->output, '');
  30837. }
  30838. public function finish()
  30839. {
  30840. if (null === $this->startTime) {
  30841. throw new LogicException('You must start the progress bar before calling finish().');
  30842. }
  30843. if (null !== $this->startTime) {
  30844. if (!$this->max) {
  30845. $this->barChar = $this->barCharOriginal;
  30846. $this->display(true);
  30847. }
  30848. $this->startTime = null;
  30849. $this->output->writeln('');
  30850. $this->output = null;
  30851. }
  30852. }
  30853. private function initialize()
  30854. {
  30855. $this->formatVars = array();
  30856. foreach ($this->defaultFormatVars as $var) {
  30857. if (false !== strpos($this->format, "%{$var}%")) {
  30858. $this->formatVars[$var] = true;
  30859. }
  30860. }
  30861. if ($this->max > 0) {
  30862. $this->widths['max'] = $this->strlen($this->max);
  30863. $this->widths['current'] = $this->widths['max'];
  30864. } else {
  30865. $this->barCharOriginal = $this->barChar;
  30866. $this->barChar = $this->emptyBarChar;
  30867. }
  30868. }
  30869. private function generate($finish = false)
  30870. {
  30871. $vars = array();
  30872. $percent = 0;
  30873. if ($this->max > 0) {
  30874. $percent = (float) $this->current / $this->max;
  30875. }
  30876. if (isset($this->formatVars['bar'])) {
  30877. $completeBars = 0;
  30878. if ($this->max > 0) {
  30879. $completeBars = floor($percent * $this->barWidth);
  30880. } else {
  30881. if (!$finish) {
  30882. $completeBars = floor($this->current % $this->barWidth);
  30883. } else {
  30884. $completeBars = $this->barWidth;
  30885. }
  30886. }
  30887. $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar);
  30888. $bar = str_repeat($this->barChar, $completeBars);
  30889. if ($completeBars < $this->barWidth) {
  30890. $bar .= $this->progressChar;
  30891. $bar .= str_repeat($this->emptyBarChar, $emptyBars);
  30892. }
  30893. $vars['bar'] = $bar;
  30894. }
  30895. if (isset($this->formatVars['elapsed'])) {
  30896. $elapsed = time() - $this->startTime;
  30897. $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
  30898. }
  30899. if (isset($this->formatVars['current'])) {
  30900. $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
  30901. }
  30902. if (isset($this->formatVars['max'])) {
  30903. $vars['max'] = $this->max;
  30904. }
  30905. if (isset($this->formatVars['percent'])) {
  30906. $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT);
  30907. }
  30908. return $vars;
  30909. }
  30910. private function humaneTime($secs)
  30911. {
  30912. $text = '';
  30913. foreach ($this->timeFormats as $format) {
  30914. if ($secs < $format[0]) {
  30915. if (count($format) == 2) {
  30916. $text = $format[1];
  30917. break;
  30918. } else {
  30919. $text = ceil($secs / $format[2]).' '.$format[1];
  30920. break;
  30921. }
  30922. }
  30923. }
  30924. return $text;
  30925. }
  30926. private function overwrite(OutputInterface $output, $message)
  30927. {
  30928. $length = $this->strlen($message);
  30929. if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
  30930. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  30931. }
  30932. $output->write("\x0D");
  30933. $output->write($message);
  30934. $this->lastMessagesLength = $this->strlen($message);
  30935. }
  30936. public function getName()
  30937. {
  30938. return 'progress';
  30939. }
  30940. }
  30941. <?php
  30942. namespace Symfony\Component\Console\Helper;
  30943. use Symfony\Component\Console\Exception\InvalidArgumentException;
  30944. use Symfony\Component\Console\Exception\LogicException;
  30945. use Symfony\Component\Console\Output\OutputInterface;
  30946. class ProgressIndicator
  30947. {
  30948. private $output;
  30949. private $startTime;
  30950. private $format;
  30951. private $message;
  30952. private $indicatorValues;
  30953. private $indicatorCurrent;
  30954. private $indicatorChangeInterval;
  30955. private $indicatorUpdateTime;
  30956. private $lastMessagesLength;
  30957. private $started = false;
  30958. private static $formatters;
  30959. private static $formats;
  30960. public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
  30961. {
  30962. $this->output = $output;
  30963. if (null === $format) {
  30964. $format = $this->determineBestFormat();
  30965. }
  30966. if (null === $indicatorValues) {
  30967. $indicatorValues = array('-', '\\', '|', '/');
  30968. }
  30969. $indicatorValues = array_values($indicatorValues);
  30970. if (2 > count($indicatorValues)) {
  30971. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  30972. }
  30973. $this->format = self::getFormatDefinition($format);
  30974. $this->indicatorChangeInterval = $indicatorChangeInterval;
  30975. $this->indicatorValues = $indicatorValues;
  30976. $this->startTime = time();
  30977. }
  30978. public function setMessage($message)
  30979. {
  30980. $this->message = $message;
  30981. $this->display();
  30982. }
  30983. public function getMessage()
  30984. {
  30985. return $this->message;
  30986. }
  30987. public function getStartTime()
  30988. {
  30989. return $this->startTime;
  30990. }
  30991. public function getCurrentValue()
  30992. {
  30993. return $this->indicatorValues[$this->indicatorCurrent % count($this->indicatorValues)];
  30994. }
  30995. public function start($message)
  30996. {
  30997. if ($this->started) {
  30998. throw new LogicException('Progress indicator already started.');
  30999. }
  31000. $this->message = $message;
  31001. $this->started = true;
  31002. $this->lastMessagesLength = 0;
  31003. $this->startTime = time();
  31004. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  31005. $this->indicatorCurrent = 0;
  31006. $this->display();
  31007. }
  31008. public function advance()
  31009. {
  31010. if (!$this->started) {
  31011. throw new LogicException('Progress indicator has not yet been started.');
  31012. }
  31013. if (!$this->output->isDecorated()) {
  31014. return;
  31015. }
  31016. $currentTime = $this->getCurrentTimeInMilliseconds();
  31017. if ($currentTime < $this->indicatorUpdateTime) {
  31018. return;
  31019. }
  31020. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  31021. ++$this->indicatorCurrent;
  31022. $this->display();
  31023. }
  31024. public function finish($message)
  31025. {
  31026. if (!$this->started) {
  31027. throw new LogicException('Progress indicator has not yet been started.');
  31028. }
  31029. $this->message = $message;
  31030. $this->display();
  31031. $this->output->writeln('');
  31032. $this->started = false;
  31033. }
  31034. public static function getFormatDefinition($name)
  31035. {
  31036. if (!self::$formats) {
  31037. self::$formats = self::initFormats();
  31038. }
  31039. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  31040. }
  31041. public static function setPlaceholderFormatterDefinition($name, $callable)
  31042. {
  31043. if (!self::$formatters) {
  31044. self::$formatters = self::initPlaceholderFormatters();
  31045. }
  31046. self::$formatters[$name] = $callable;
  31047. }
  31048. public static function getPlaceholderFormatterDefinition($name)
  31049. {
  31050. if (!self::$formatters) {
  31051. self::$formatters = self::initPlaceholderFormatters();
  31052. }
  31053. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  31054. }
  31055. private function display()
  31056. {
  31057. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  31058. return;
  31059. }
  31060. $self = $this;
  31061. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
  31062. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  31063. return call_user_func($formatter, $self);
  31064. }
  31065. return $matches[0];
  31066. }, $this->format));
  31067. }
  31068. private function determineBestFormat()
  31069. {
  31070. switch ($this->output->getVerbosity()) {
  31071. case OutputInterface::VERBOSITY_VERBOSE:
  31072. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  31073. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  31074. case OutputInterface::VERBOSITY_DEBUG:
  31075. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  31076. default:
  31077. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  31078. }
  31079. }
  31080. private function overwrite($message)
  31081. {
  31082. if (null !== $this->lastMessagesLength) {
  31083. if ($this->lastMessagesLength > Helper::strlenWithoutDecoration($this->output->getFormatter(), $message)) {
  31084. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  31085. }
  31086. }
  31087. if ($this->output->isDecorated()) {
  31088. $this->output->write("\x0D");
  31089. $this->output->write($message);
  31090. } else {
  31091. $this->output->writeln($message);
  31092. }
  31093. $this->lastMessagesLength = 0;
  31094. $len = Helper::strlenWithoutDecoration($this->output->getFormatter(), $message);
  31095. if ($len > $this->lastMessagesLength) {
  31096. $this->lastMessagesLength = $len;
  31097. }
  31098. }
  31099. private function getCurrentTimeInMilliseconds()
  31100. {
  31101. return round(microtime(true) * 1000);
  31102. }
  31103. private static function initPlaceholderFormatters()
  31104. {
  31105. return array(
  31106. 'indicator' => function (ProgressIndicator $indicator) {
  31107. return $indicator->getCurrentValue();
  31108. },
  31109. 'message' => function (ProgressIndicator $indicator) {
  31110. return $indicator->getMessage();
  31111. },
  31112. 'elapsed' => function (ProgressIndicator $indicator) {
  31113. return Helper::formatTime(time() - $indicator->getStartTime());
  31114. },
  31115. 'memory' => function () {
  31116. return Helper::formatMemory(memory_get_usage(true));
  31117. },
  31118. );
  31119. }
  31120. private static function initFormats()
  31121. {
  31122. return array(
  31123. 'normal' => ' %indicator% %message%',
  31124. 'normal_no_ansi' => ' %message%',
  31125. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  31126. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  31127. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  31128. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  31129. );
  31130. }
  31131. }
  31132. <?php
  31133. namespace Symfony\Component\Console\Helper;
  31134. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31135. use Symfony\Component\Console\Exception\RuntimeException;
  31136. use Symfony\Component\Console\Input\InputInterface;
  31137. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  31138. use Symfony\Component\Console\Output\OutputInterface;
  31139. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  31140. use Symfony\Component\Console\Question\Question;
  31141. use Symfony\Component\Console\Question\ChoiceQuestion;
  31142. class QuestionHelper extends Helper
  31143. {
  31144. private $inputStream;
  31145. private static $shell;
  31146. private static $stty;
  31147. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  31148. {
  31149. if ($output instanceof ConsoleOutputInterface) {
  31150. $output = $output->getErrorOutput();
  31151. }
  31152. if (!$input->isInteractive()) {
  31153. return $question->getDefault();
  31154. }
  31155. if (!$question->getValidator()) {
  31156. return $this->doAsk($output, $question);
  31157. }
  31158. $that = $this;
  31159. $interviewer = function () use ($output, $question, $that) {
  31160. return $that->doAsk($output, $question);
  31161. };
  31162. return $this->validateAttempts($interviewer, $output, $question);
  31163. }
  31164. public function setInputStream($stream)
  31165. {
  31166. if (!is_resource($stream)) {
  31167. throw new InvalidArgumentException('Input stream must be a valid resource.');
  31168. }
  31169. $this->inputStream = $stream;
  31170. }
  31171. public function getInputStream()
  31172. {
  31173. return $this->inputStream;
  31174. }
  31175. public function getName()
  31176. {
  31177. return 'question';
  31178. }
  31179. public function doAsk(OutputInterface $output, Question $question)
  31180. {
  31181. $this->writePrompt($output, $question);
  31182. $inputStream = $this->inputStream ?: STDIN;
  31183. $autocomplete = $question->getAutocompleterValues();
  31184. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  31185. $ret = false;
  31186. if ($question->isHidden()) {
  31187. try {
  31188. $ret = trim($this->getHiddenResponse($output, $inputStream));
  31189. } catch (\RuntimeException $e) {
  31190. if (!$question->isHiddenFallback()) {
  31191. throw $e;
  31192. }
  31193. }
  31194. }
  31195. if (false === $ret) {
  31196. $ret = fgets($inputStream, 4096);
  31197. if (false === $ret) {
  31198. throw new \RuntimeException('Aborted');
  31199. }
  31200. $ret = trim($ret);
  31201. }
  31202. } else {
  31203. $ret = trim($this->autocomplete($output, $question, $inputStream));
  31204. }
  31205. $ret = strlen($ret) > 0 ? $ret : $question->getDefault();
  31206. if ($normalizer = $question->getNormalizer()) {
  31207. return $normalizer($ret);
  31208. }
  31209. return $ret;
  31210. }
  31211. protected function writePrompt(OutputInterface $output, Question $question)
  31212. {
  31213. $message = $question->getQuestion();
  31214. if ($question instanceof ChoiceQuestion) {
  31215. $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
  31216. $messages = (array) $question->getQuestion();
  31217. foreach ($question->getChoices() as $key => $value) {
  31218. $width = $maxWidth - $this->strlen($key);
  31219. $messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
  31220. }
  31221. $output->writeln($messages);
  31222. $message = $question->getPrompt();
  31223. }
  31224. $output->write($message);
  31225. }
  31226. protected function writeError(OutputInterface $output, \Exception $error)
  31227. {
  31228. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  31229. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  31230. } else {
  31231. $message = '<error>'.$error->getMessage().'</error>';
  31232. }
  31233. $output->writeln($message);
  31234. }
  31235. private function autocomplete(OutputInterface $output, Question $question, $inputStream)
  31236. {
  31237. $autocomplete = $question->getAutocompleterValues();
  31238. $ret = '';
  31239. $i = 0;
  31240. $ofs = -1;
  31241. $matches = $autocomplete;
  31242. $numMatches = count($matches);
  31243. $sttyMode = shell_exec('stty -g');
  31244. shell_exec('stty -icanon -echo');
  31245. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  31246. while (!feof($inputStream)) {
  31247. $c = fread($inputStream, 1);
  31248. if ("\177" === $c) {
  31249. if (0 === $numMatches && 0 !== $i) {
  31250. --$i;
  31251. $output->write("\033[1D");
  31252. }
  31253. if ($i === 0) {
  31254. $ofs = -1;
  31255. $matches = $autocomplete;
  31256. $numMatches = count($matches);
  31257. } else {
  31258. $numMatches = 0;
  31259. }
  31260. $ret = substr($ret, 0, $i);
  31261. } elseif ("\033" === $c) {
  31262. $c .= fread($inputStream, 2);
  31263. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  31264. if ('A' === $c[2] && -1 === $ofs) {
  31265. $ofs = 0;
  31266. }
  31267. if (0 === $numMatches) {
  31268. continue;
  31269. }
  31270. $ofs += ('A' === $c[2]) ? -1 : 1;
  31271. $ofs = ($numMatches + $ofs) % $numMatches;
  31272. }
  31273. } elseif (ord($c) < 32) {
  31274. if ("\t" === $c || "\n" === $c) {
  31275. if ($numMatches > 0 && -1 !== $ofs) {
  31276. $ret = $matches[$ofs];
  31277. $output->write(substr($ret, $i));
  31278. $i = strlen($ret);
  31279. }
  31280. if ("\n" === $c) {
  31281. $output->write($c);
  31282. break;
  31283. }
  31284. $numMatches = 0;
  31285. }
  31286. continue;
  31287. } else {
  31288. $output->write($c);
  31289. $ret .= $c;
  31290. ++$i;
  31291. $numMatches = 0;
  31292. $ofs = 0;
  31293. foreach ($autocomplete as $value) {
  31294. if (0 === strpos($value, $ret) && $i !== strlen($value)) {
  31295. $matches[$numMatches++] = $value;
  31296. }
  31297. }
  31298. }
  31299. $output->write("\033[K");
  31300. if ($numMatches > 0 && -1 !== $ofs) {
  31301. $output->write("\0337");
  31302. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  31303. $output->write("\0338");
  31304. }
  31305. }
  31306. shell_exec(sprintf('stty %s', $sttyMode));
  31307. return $ret;
  31308. }
  31309. private function getHiddenResponse(OutputInterface $output, $inputStream)
  31310. {
  31311. if ('\\' === DIRECTORY_SEPARATOR) {
  31312. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  31313. if ('phar:' === substr(__FILE__, 0, 5)) {
  31314. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  31315. copy($exe, $tmpExe);
  31316. $exe = $tmpExe;
  31317. }
  31318. $value = rtrim(shell_exec($exe));
  31319. $output->writeln('');
  31320. if (isset($tmpExe)) {
  31321. unlink($tmpExe);
  31322. }
  31323. return $value;
  31324. }
  31325. if ($this->hasSttyAvailable()) {
  31326. $sttyMode = shell_exec('stty -g');
  31327. shell_exec('stty -echo');
  31328. $value = fgets($inputStream, 4096);
  31329. shell_exec(sprintf('stty %s', $sttyMode));
  31330. if (false === $value) {
  31331. throw new RuntimeException('Aborted');
  31332. }
  31333. $value = trim($value);
  31334. $output->writeln('');
  31335. return $value;
  31336. }
  31337. if (false !== $shell = $this->getShell()) {
  31338. $readCmd = $shell === 'csh' ? 'set mypassword = $<' : 'read -r mypassword';
  31339. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  31340. $value = rtrim(shell_exec($command));
  31341. $output->writeln('');
  31342. return $value;
  31343. }
  31344. throw new RuntimeException('Unable to hide the response.');
  31345. }
  31346. private function validateAttempts($interviewer, OutputInterface $output, Question $question)
  31347. {
  31348. $error = null;
  31349. $attempts = $question->getMaxAttempts();
  31350. while (null === $attempts || $attempts--) {
  31351. if (null !== $error) {
  31352. $this->writeError($output, $error);
  31353. }
  31354. try {
  31355. return call_user_func($question->getValidator(), $interviewer());
  31356. } catch (\Exception $error) {
  31357. }
  31358. }
  31359. throw $error;
  31360. }
  31361. private function getShell()
  31362. {
  31363. if (null !== self::$shell) {
  31364. return self::$shell;
  31365. }
  31366. self::$shell = false;
  31367. if (file_exists('/usr/bin/env')) {
  31368. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  31369. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  31370. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  31371. self::$shell = $sh;
  31372. break;
  31373. }
  31374. }
  31375. }
  31376. return self::$shell;
  31377. }
  31378. private function hasSttyAvailable()
  31379. {
  31380. if (null !== self::$stty) {
  31381. return self::$stty;
  31382. }
  31383. exec('stty 2>&1', $output, $exitcode);
  31384. return self::$stty = $exitcode === 0;
  31385. }
  31386. }
  31387. <?php
  31388. namespace Symfony\Component\Console\Helper;
  31389. use Symfony\Component\Console\Exception\LogicException;
  31390. use Symfony\Component\Console\Input\InputInterface;
  31391. use Symfony\Component\Console\Output\OutputInterface;
  31392. use Symfony\Component\Console\Question\ChoiceQuestion;
  31393. use Symfony\Component\Console\Question\ConfirmationQuestion;
  31394. use Symfony\Component\Console\Question\Question;
  31395. use Symfony\Component\Console\Style\SymfonyStyle;
  31396. class SymfonyQuestionHelper extends QuestionHelper
  31397. {
  31398. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  31399. {
  31400. $validator = $question->getValidator();
  31401. $question->setValidator(function ($value) use ($validator) {
  31402. if (null !== $validator) {
  31403. $value = $validator($value);
  31404. }
  31405. if (!is_array($value) && !is_bool($value) && 0 === strlen($value)) {
  31406. throw new LogicException('A value is required.');
  31407. }
  31408. return $value;
  31409. });
  31410. return parent::ask($input, $output, $question);
  31411. }
  31412. protected function writePrompt(OutputInterface $output, Question $question)
  31413. {
  31414. $text = $question->getQuestion();
  31415. $default = $question->getDefault();
  31416. switch (true) {
  31417. case null === $default:
  31418. $text = sprintf(' <info>%s</info>:', $text);
  31419. break;
  31420. case $question instanceof ConfirmationQuestion:
  31421. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  31422. break;
  31423. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  31424. $choices = $question->getChoices();
  31425. $default = explode(',', $default);
  31426. foreach ($default as $key => $value) {
  31427. $default[$key] = $choices[trim($value)];
  31428. }
  31429. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, implode(', ', $default));
  31430. break;
  31431. case $question instanceof ChoiceQuestion:
  31432. $choices = $question->getChoices();
  31433. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, $choices[$default]);
  31434. break;
  31435. default:
  31436. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, $default);
  31437. }
  31438. $output->writeln($text);
  31439. if ($question instanceof ChoiceQuestion) {
  31440. $width = max(array_map('strlen', array_keys($question->getChoices())));
  31441. foreach ($question->getChoices() as $key => $value) {
  31442. $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
  31443. }
  31444. }
  31445. $output->write(' > ');
  31446. }
  31447. protected function writeError(OutputInterface $output, \Exception $error)
  31448. {
  31449. if ($output instanceof SymfonyStyle) {
  31450. $output->newLine();
  31451. $output->error($error->getMessage());
  31452. return;
  31453. }
  31454. parent::writeError($output, $error);
  31455. }
  31456. }
  31457. <?php
  31458. namespace Symfony\Component\Console\Helper;
  31459. use Symfony\Component\Console\Output\OutputInterface;
  31460. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31461. class Table
  31462. {
  31463. private $headers = array();
  31464. private $rows = array();
  31465. private $columnWidths = array();
  31466. private $numberOfColumns;
  31467. private $output;
  31468. private $style;
  31469. private $columnStyles = array();
  31470. private static $styles;
  31471. public function __construct(OutputInterface $output)
  31472. {
  31473. $this->output = $output;
  31474. if (!self::$styles) {
  31475. self::$styles = self::initStyles();
  31476. }
  31477. $this->setStyle('default');
  31478. }
  31479. public static function setStyleDefinition($name, TableStyle $style)
  31480. {
  31481. if (!self::$styles) {
  31482. self::$styles = self::initStyles();
  31483. }
  31484. self::$styles[$name] = $style;
  31485. }
  31486. public static function getStyleDefinition($name)
  31487. {
  31488. if (!self::$styles) {
  31489. self::$styles = self::initStyles();
  31490. }
  31491. if (isset(self::$styles[$name])) {
  31492. return self::$styles[$name];
  31493. }
  31494. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  31495. }
  31496. public function setStyle($name)
  31497. {
  31498. $this->style = $this->resolveStyle($name);
  31499. return $this;
  31500. }
  31501. public function getStyle()
  31502. {
  31503. return $this->style;
  31504. }
  31505. public function setColumnStyle($columnIndex, $name)
  31506. {
  31507. $columnIndex = intval($columnIndex);
  31508. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  31509. return $this;
  31510. }
  31511. public function getColumnStyle($columnIndex)
  31512. {
  31513. if (isset($this->columnStyles[$columnIndex])) {
  31514. return $this->columnStyles[$columnIndex];
  31515. }
  31516. return $this->getStyle();
  31517. }
  31518. public function setHeaders(array $headers)
  31519. {
  31520. $headers = array_values($headers);
  31521. if (!empty($headers) && !is_array($headers[0])) {
  31522. $headers = array($headers);
  31523. }
  31524. $this->headers = $headers;
  31525. return $this;
  31526. }
  31527. public function setRows(array $rows)
  31528. {
  31529. $this->rows = array();
  31530. return $this->addRows($rows);
  31531. }
  31532. public function addRows(array $rows)
  31533. {
  31534. foreach ($rows as $row) {
  31535. $this->addRow($row);
  31536. }
  31537. return $this;
  31538. }
  31539. public function addRow($row)
  31540. {
  31541. if ($row instanceof TableSeparator) {
  31542. $this->rows[] = $row;
  31543. return $this;
  31544. }
  31545. if (!is_array($row)) {
  31546. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  31547. }
  31548. $this->rows[] = array_values($row);
  31549. return $this;
  31550. }
  31551. public function setRow($column, array $row)
  31552. {
  31553. $this->rows[$column] = $row;
  31554. return $this;
  31555. }
  31556. public function render()
  31557. {
  31558. $this->calculateNumberOfColumns();
  31559. $rows = $this->buildTableRows($this->rows);
  31560. $headers = $this->buildTableRows($this->headers);
  31561. $this->calculateColumnsWidth(array_merge($headers, $rows));
  31562. $this->renderRowSeparator();
  31563. if (!empty($headers)) {
  31564. foreach ($headers as $header) {
  31565. $this->renderRow($header, $this->style->getCellHeaderFormat());
  31566. $this->renderRowSeparator();
  31567. }
  31568. }
  31569. foreach ($rows as $row) {
  31570. if ($row instanceof TableSeparator) {
  31571. $this->renderRowSeparator();
  31572. } else {
  31573. $this->renderRow($row, $this->style->getCellRowFormat());
  31574. }
  31575. }
  31576. if (!empty($rows)) {
  31577. $this->renderRowSeparator();
  31578. }
  31579. $this->cleanup();
  31580. }
  31581. private function renderRowSeparator()
  31582. {
  31583. if (0 === $count = $this->numberOfColumns) {
  31584. return;
  31585. }
  31586. if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
  31587. return;
  31588. }
  31589. $markup = $this->style->getCrossingChar();
  31590. for ($column = 0; $column < $count; ++$column) {
  31591. $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->columnWidths[$column]).$this->style->getCrossingChar();
  31592. }
  31593. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  31594. }
  31595. private function renderColumnSeparator()
  31596. {
  31597. return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar());
  31598. }
  31599. private function renderRow(array $row, $cellFormat)
  31600. {
  31601. if (empty($row)) {
  31602. return;
  31603. }
  31604. $rowContent = $this->renderColumnSeparator();
  31605. foreach ($this->getRowColumns($row) as $column) {
  31606. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  31607. $rowContent .= $this->renderColumnSeparator();
  31608. }
  31609. $this->output->writeln($rowContent);
  31610. }
  31611. private function renderCell(array $row, $column, $cellFormat)
  31612. {
  31613. $cell = isset($row[$column]) ? $row[$column] : '';
  31614. $width = $this->columnWidths[$column];
  31615. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  31616. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  31617. $width += $this->getColumnSeparatorWidth() + $this->columnWidths[$nextColumn];
  31618. }
  31619. }
  31620. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  31621. $width += strlen($cell) - mb_strwidth($cell, $encoding);
  31622. }
  31623. $style = $this->getColumnStyle($column);
  31624. if ($cell instanceof TableSeparator) {
  31625. return sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width));
  31626. }
  31627. $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  31628. $content = sprintf($style->getCellRowContentFormat(), $cell);
  31629. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType()));
  31630. }
  31631. private function calculateNumberOfColumns()
  31632. {
  31633. if (null !== $this->numberOfColumns) {
  31634. return;
  31635. }
  31636. $columns = array(0);
  31637. foreach (array_merge($this->headers, $this->rows) as $row) {
  31638. if ($row instanceof TableSeparator) {
  31639. continue;
  31640. }
  31641. $columns[] = $this->getNumberOfColumns($row);
  31642. }
  31643. $this->numberOfColumns = max($columns);
  31644. }
  31645. private function buildTableRows($rows)
  31646. {
  31647. $unmergedRows = array();
  31648. for ($rowKey = 0; $rowKey < count($rows); ++$rowKey) {
  31649. $rows = $this->fillNextRows($rows, $rowKey);
  31650. foreach ($rows[$rowKey] as $column => $cell) {
  31651. if (!strstr($cell, "\n")) {
  31652. continue;
  31653. }
  31654. $lines = explode("\n", $cell);
  31655. foreach ($lines as $lineKey => $line) {
  31656. if ($cell instanceof TableCell) {
  31657. $line = new TableCell($line, array('colspan' => $cell->getColspan()));
  31658. }
  31659. if (0 === $lineKey) {
  31660. $rows[$rowKey][$column] = $line;
  31661. } else {
  31662. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  31663. }
  31664. }
  31665. }
  31666. }
  31667. $tableRows = array();
  31668. foreach ($rows as $rowKey => $row) {
  31669. $tableRows[] = $this->fillCells($row);
  31670. if (isset($unmergedRows[$rowKey])) {
  31671. $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
  31672. }
  31673. }
  31674. return $tableRows;
  31675. }
  31676. private function fillNextRows($rows, $line)
  31677. {
  31678. $unmergedRows = array();
  31679. foreach ($rows[$line] as $column => $cell) {
  31680. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  31681. $nbLines = $cell->getRowspan() - 1;
  31682. $lines = array($cell);
  31683. if (strstr($cell, "\n")) {
  31684. $lines = explode("\n", $cell);
  31685. $nbLines = count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  31686. $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan()));
  31687. unset($lines[0]);
  31688. }
  31689. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
  31690. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  31691. $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
  31692. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
  31693. }
  31694. }
  31695. }
  31696. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  31697. if (isset($rows[$unmergedRowKey]) && is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  31698. foreach ($unmergedRow as $cellKey => $cell) {
  31699. array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
  31700. }
  31701. } else {
  31702. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  31703. foreach ($unmergedRow as $column => $cell) {
  31704. if (!empty($cell)) {
  31705. $row[$column] = $unmergedRow[$column];
  31706. }
  31707. }
  31708. array_splice($rows, $unmergedRowKey, 0, array($row));
  31709. }
  31710. }
  31711. return $rows;
  31712. }
  31713. private function fillCells($row)
  31714. {
  31715. $newRow = array();
  31716. foreach ($row as $column => $cell) {
  31717. $newRow[] = $cell;
  31718. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  31719. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  31720. $newRow[] = '';
  31721. }
  31722. }
  31723. }
  31724. return $newRow ?: $row;
  31725. }
  31726. private function copyRow($rows, $line)
  31727. {
  31728. $row = $rows[$line];
  31729. foreach ($row as $cellKey => $cellValue) {
  31730. $row[$cellKey] = '';
  31731. if ($cellValue instanceof TableCell) {
  31732. $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
  31733. }
  31734. }
  31735. return $row;
  31736. }
  31737. private function getNumberOfColumns(array $row)
  31738. {
  31739. $columns = count($row);
  31740. foreach ($row as $column) {
  31741. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  31742. }
  31743. return $columns;
  31744. }
  31745. private function getRowColumns($row)
  31746. {
  31747. $columns = range(0, $this->numberOfColumns - 1);
  31748. foreach ($row as $cellKey => $cell) {
  31749. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  31750. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  31751. }
  31752. }
  31753. return $columns;
  31754. }
  31755. private function calculateColumnsWidth($rows)
  31756. {
  31757. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  31758. $lengths = array();
  31759. foreach ($rows as $row) {
  31760. if ($row instanceof TableSeparator) {
  31761. continue;
  31762. }
  31763. foreach ($row as $i => $cell) {
  31764. if ($cell instanceof TableCell) {
  31765. $textLength = strlen($cell);
  31766. if ($textLength > 0) {
  31767. $contentColumns = str_split($cell, ceil($textLength / $cell->getColspan()));
  31768. foreach ($contentColumns as $position => $content) {
  31769. $row[$i + $position] = $content;
  31770. }
  31771. }
  31772. }
  31773. }
  31774. $lengths[] = $this->getCellWidth($row, $column);
  31775. }
  31776. $this->columnWidths[$column] = max($lengths) + strlen($this->style->getCellRowContentFormat()) - 2;
  31777. }
  31778. }
  31779. private function getColumnSeparatorWidth()
  31780. {
  31781. return strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  31782. }
  31783. private function getCellWidth(array $row, $column)
  31784. {
  31785. if (isset($row[$column])) {
  31786. $cell = $row[$column];
  31787. $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  31788. return $cellWidth;
  31789. }
  31790. return 0;
  31791. }
  31792. private function cleanup()
  31793. {
  31794. $this->columnWidths = array();
  31795. $this->numberOfColumns = null;
  31796. }
  31797. private static function initStyles()
  31798. {
  31799. $borderless = new TableStyle();
  31800. $borderless
  31801. ->setHorizontalBorderChar('=')
  31802. ->setVerticalBorderChar(' ')
  31803. ->setCrossingChar(' ')
  31804. ;
  31805. $compact = new TableStyle();
  31806. $compact
  31807. ->setHorizontalBorderChar('')
  31808. ->setVerticalBorderChar(' ')
  31809. ->setCrossingChar('')
  31810. ->setCellRowContentFormat('%s')
  31811. ;
  31812. $styleGuide = new TableStyle();
  31813. $styleGuide
  31814. ->setHorizontalBorderChar('-')
  31815. ->setVerticalBorderChar(' ')
  31816. ->setCrossingChar(' ')
  31817. ->setCellHeaderFormat('%s')
  31818. ;
  31819. return array(
  31820. 'default' => new TableStyle(),
  31821. 'borderless' => $borderless,
  31822. 'compact' => $compact,
  31823. 'symfony-style-guide' => $styleGuide,
  31824. );
  31825. }
  31826. private function resolveStyle($name)
  31827. {
  31828. if ($name instanceof TableStyle) {
  31829. return $name;
  31830. }
  31831. if (isset(self::$styles[$name])) {
  31832. return self::$styles[$name];
  31833. }
  31834. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  31835. }
  31836. }
  31837. <?php
  31838. namespace Symfony\Component\Console\Helper;
  31839. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31840. class TableCell
  31841. {
  31842. private $value;
  31843. private $options = array(
  31844. 'rowspan' => 1,
  31845. 'colspan' => 1,
  31846. );
  31847. public function __construct($value = '', array $options = array())
  31848. {
  31849. $this->value = $value;
  31850. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  31851. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  31852. }
  31853. $this->options = array_merge($this->options, $options);
  31854. }
  31855. public function __toString()
  31856. {
  31857. return $this->value;
  31858. }
  31859. public function getColspan()
  31860. {
  31861. return (int) $this->options['colspan'];
  31862. }
  31863. public function getRowspan()
  31864. {
  31865. return (int) $this->options['rowspan'];
  31866. }
  31867. }
  31868. <?php
  31869. namespace Symfony\Component\Console\Helper;
  31870. use Symfony\Component\Console\Output\OutputInterface;
  31871. use Symfony\Component\Console\Output\NullOutput;
  31872. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31873. class TableHelper extends Helper
  31874. {
  31875. const LAYOUT_DEFAULT = 0;
  31876. const LAYOUT_BORDERLESS = 1;
  31877. const LAYOUT_COMPACT = 2;
  31878. private $table;
  31879. public function __construct($triggerDeprecationError = true)
  31880. {
  31881. if ($triggerDeprecationError) {
  31882. @trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
  31883. }
  31884. $this->table = new Table(new NullOutput());
  31885. }
  31886. public function setLayout($layout)
  31887. {
  31888. switch ($layout) {
  31889. case self::LAYOUT_BORDERLESS:
  31890. $this->table->setStyle('borderless');
  31891. break;
  31892. case self::LAYOUT_COMPACT:
  31893. $this->table->setStyle('compact');
  31894. break;
  31895. case self::LAYOUT_DEFAULT:
  31896. $this->table->setStyle('default');
  31897. break;
  31898. default:
  31899. throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
  31900. }
  31901. return $this;
  31902. }
  31903. public function setHeaders(array $headers)
  31904. {
  31905. $this->table->setHeaders($headers);
  31906. return $this;
  31907. }
  31908. public function setRows(array $rows)
  31909. {
  31910. $this->table->setRows($rows);
  31911. return $this;
  31912. }
  31913. public function addRows(array $rows)
  31914. {
  31915. $this->table->addRows($rows);
  31916. return $this;
  31917. }
  31918. public function addRow(array $row)
  31919. {
  31920. $this->table->addRow($row);
  31921. return $this;
  31922. }
  31923. public function setRow($column, array $row)
  31924. {
  31925. $this->table->setRow($column, $row);
  31926. return $this;
  31927. }
  31928. public function setPaddingChar($paddingChar)
  31929. {
  31930. $this->table->getStyle()->setPaddingChar($paddingChar);
  31931. return $this;
  31932. }
  31933. public function setHorizontalBorderChar($horizontalBorderChar)
  31934. {
  31935. $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
  31936. return $this;
  31937. }
  31938. public function setVerticalBorderChar($verticalBorderChar)
  31939. {
  31940. $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
  31941. return $this;
  31942. }
  31943. public function setCrossingChar($crossingChar)
  31944. {
  31945. $this->table->getStyle()->setCrossingChar($crossingChar);
  31946. return $this;
  31947. }
  31948. public function setCellHeaderFormat($cellHeaderFormat)
  31949. {
  31950. $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
  31951. return $this;
  31952. }
  31953. public function setCellRowFormat($cellRowFormat)
  31954. {
  31955. $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
  31956. return $this;
  31957. }
  31958. public function setCellRowContentFormat($cellRowContentFormat)
  31959. {
  31960. $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
  31961. return $this;
  31962. }
  31963. public function setBorderFormat($borderFormat)
  31964. {
  31965. $this->table->getStyle()->setBorderFormat($borderFormat);
  31966. return $this;
  31967. }
  31968. public function setPadType($padType)
  31969. {
  31970. $this->table->getStyle()->setPadType($padType);
  31971. return $this;
  31972. }
  31973. public function render(OutputInterface $output)
  31974. {
  31975. $p = new \ReflectionProperty($this->table, 'output');
  31976. $p->setAccessible(true);
  31977. $p->setValue($this->table, $output);
  31978. $this->table->render();
  31979. }
  31980. public function getName()
  31981. {
  31982. return 'table';
  31983. }
  31984. }
  31985. <?php
  31986. namespace Symfony\Component\Console\Helper;
  31987. class TableSeparator extends TableCell
  31988. {
  31989. public function __construct(array $options = array())
  31990. {
  31991. parent::__construct('', $options);
  31992. }
  31993. }
  31994. <?php
  31995. namespace Symfony\Component\Console\Helper;
  31996. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31997. use Symfony\Component\Console\Exception\LogicException;
  31998. class TableStyle
  31999. {
  32000. private $paddingChar = ' ';
  32001. private $horizontalBorderChar = '-';
  32002. private $verticalBorderChar = '|';
  32003. private $crossingChar = '+';
  32004. private $cellHeaderFormat = '<info>%s</info>';
  32005. private $cellRowFormat = '%s';
  32006. private $cellRowContentFormat = ' %s ';
  32007. private $borderFormat = '%s';
  32008. private $padType = STR_PAD_RIGHT;
  32009. public function setPaddingChar($paddingChar)
  32010. {
  32011. if (!$paddingChar) {
  32012. throw new LogicException('The padding char must not be empty');
  32013. }
  32014. $this->paddingChar = $paddingChar;
  32015. return $this;
  32016. }
  32017. public function getPaddingChar()
  32018. {
  32019. return $this->paddingChar;
  32020. }
  32021. public function setHorizontalBorderChar($horizontalBorderChar)
  32022. {
  32023. $this->horizontalBorderChar = $horizontalBorderChar;
  32024. return $this;
  32025. }
  32026. public function getHorizontalBorderChar()
  32027. {
  32028. return $this->horizontalBorderChar;
  32029. }
  32030. public function setVerticalBorderChar($verticalBorderChar)
  32031. {
  32032. $this->verticalBorderChar = $verticalBorderChar;
  32033. return $this;
  32034. }
  32035. public function getVerticalBorderChar()
  32036. {
  32037. return $this->verticalBorderChar;
  32038. }
  32039. public function setCrossingChar($crossingChar)
  32040. {
  32041. $this->crossingChar = $crossingChar;
  32042. return $this;
  32043. }
  32044. public function getCrossingChar()
  32045. {
  32046. return $this->crossingChar;
  32047. }
  32048. public function setCellHeaderFormat($cellHeaderFormat)
  32049. {
  32050. $this->cellHeaderFormat = $cellHeaderFormat;
  32051. return $this;
  32052. }
  32053. public function getCellHeaderFormat()
  32054. {
  32055. return $this->cellHeaderFormat;
  32056. }
  32057. public function setCellRowFormat($cellRowFormat)
  32058. {
  32059. $this->cellRowFormat = $cellRowFormat;
  32060. return $this;
  32061. }
  32062. public function getCellRowFormat()
  32063. {
  32064. return $this->cellRowFormat;
  32065. }
  32066. public function setCellRowContentFormat($cellRowContentFormat)
  32067. {
  32068. $this->cellRowContentFormat = $cellRowContentFormat;
  32069. return $this;
  32070. }
  32071. public function getCellRowContentFormat()
  32072. {
  32073. return $this->cellRowContentFormat;
  32074. }
  32075. public function setBorderFormat($borderFormat)
  32076. {
  32077. $this->borderFormat = $borderFormat;
  32078. return $this;
  32079. }
  32080. public function getBorderFormat()
  32081. {
  32082. return $this->borderFormat;
  32083. }
  32084. public function setPadType($padType)
  32085. {
  32086. if (!in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) {
  32087. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  32088. }
  32089. $this->padType = $padType;
  32090. return $this;
  32091. }
  32092. public function getPadType()
  32093. {
  32094. return $this->padType;
  32095. }
  32096. }
  32097. <?php
  32098. namespace Symfony\Component\Console\Input;
  32099. use Symfony\Component\Console\Exception\RuntimeException;
  32100. class ArgvInput extends Input
  32101. {
  32102. private $tokens;
  32103. private $parsed;
  32104. public function __construct(array $argv = null, InputDefinition $definition = null)
  32105. {
  32106. if (null === $argv) {
  32107. $argv = $_SERVER['argv'];
  32108. }
  32109. array_shift($argv);
  32110. $this->tokens = $argv;
  32111. parent::__construct($definition);
  32112. }
  32113. protected function setTokens(array $tokens)
  32114. {
  32115. $this->tokens = $tokens;
  32116. }
  32117. protected function parse()
  32118. {
  32119. $parseOptions = true;
  32120. $this->parsed = $this->tokens;
  32121. while (null !== $token = array_shift($this->parsed)) {
  32122. if ($parseOptions && '' == $token) {
  32123. $this->parseArgument($token);
  32124. } elseif ($parseOptions && '--' == $token) {
  32125. $parseOptions = false;
  32126. } elseif ($parseOptions && 0 === strpos($token, '--')) {
  32127. $this->parseLongOption($token);
  32128. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  32129. $this->parseShortOption($token);
  32130. } else {
  32131. $this->parseArgument($token);
  32132. }
  32133. }
  32134. }
  32135. private function parseShortOption($token)
  32136. {
  32137. $name = substr($token, 1);
  32138. if (strlen($name) > 1) {
  32139. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  32140. $this->addShortOption($name[0], substr($name, 1));
  32141. } else {
  32142. $this->parseShortOptionSet($name);
  32143. }
  32144. } else {
  32145. $this->addShortOption($name, null);
  32146. }
  32147. }
  32148. private function parseShortOptionSet($name)
  32149. {
  32150. $len = strlen($name);
  32151. for ($i = 0; $i < $len; ++$i) {
  32152. if (!$this->definition->hasShortcut($name[$i])) {
  32153. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
  32154. }
  32155. $option = $this->definition->getOptionForShortcut($name[$i]);
  32156. if ($option->acceptValue()) {
  32157. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  32158. break;
  32159. } else {
  32160. $this->addLongOption($option->getName(), null);
  32161. }
  32162. }
  32163. }
  32164. private function parseLongOption($token)
  32165. {
  32166. $name = substr($token, 2);
  32167. if (false !== $pos = strpos($name, '=')) {
  32168. $this->addLongOption(substr($name, 0, $pos), substr($name, $pos + 1));
  32169. } else {
  32170. $this->addLongOption($name, null);
  32171. }
  32172. }
  32173. private function parseArgument($token)
  32174. {
  32175. $c = count($this->arguments);
  32176. if ($this->definition->hasArgument($c)) {
  32177. $arg = $this->definition->getArgument($c);
  32178. $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
  32179. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  32180. $arg = $this->definition->getArgument($c - 1);
  32181. $this->arguments[$arg->getName()][] = $token;
  32182. } else {
  32183. $all = $this->definition->getArguments();
  32184. if (count($all)) {
  32185. throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
  32186. }
  32187. throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
  32188. }
  32189. }
  32190. private function addShortOption($shortcut, $value)
  32191. {
  32192. if (!$this->definition->hasShortcut($shortcut)) {
  32193. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  32194. }
  32195. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  32196. }
  32197. private function addLongOption($name, $value)
  32198. {
  32199. if (!$this->definition->hasOption($name)) {
  32200. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  32201. }
  32202. $option = $this->definition->getOption($name);
  32203. if (!isset($value[0])) {
  32204. $value = null;
  32205. }
  32206. if (null !== $value && !$option->acceptValue()) {
  32207. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  32208. }
  32209. if (null === $value && $option->acceptValue() && count($this->parsed)) {
  32210. $next = array_shift($this->parsed);
  32211. if (isset($next[0]) && '-' !== $next[0]) {
  32212. $value = $next;
  32213. } elseif (empty($next)) {
  32214. $value = '';
  32215. } else {
  32216. array_unshift($this->parsed, $next);
  32217. }
  32218. }
  32219. if (null === $value) {
  32220. if ($option->isValueRequired()) {
  32221. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  32222. }
  32223. if (!$option->isArray()) {
  32224. $value = $option->isValueOptional() ? $option->getDefault() : true;
  32225. }
  32226. }
  32227. if ($option->isArray()) {
  32228. $this->options[$name][] = $value;
  32229. } else {
  32230. $this->options[$name] = $value;
  32231. }
  32232. }
  32233. public function getFirstArgument()
  32234. {
  32235. foreach ($this->tokens as $token) {
  32236. if ($token && '-' === $token[0]) {
  32237. continue;
  32238. }
  32239. return $token;
  32240. }
  32241. }
  32242. public function hasParameterOption($values)
  32243. {
  32244. $values = (array) $values;
  32245. foreach ($this->tokens as $token) {
  32246. foreach ($values as $value) {
  32247. if ($token === $value || 0 === strpos($token, $value.'=')) {
  32248. return true;
  32249. }
  32250. }
  32251. }
  32252. return false;
  32253. }
  32254. public function getParameterOption($values, $default = false)
  32255. {
  32256. $values = (array) $values;
  32257. $tokens = $this->tokens;
  32258. while (0 < count($tokens)) {
  32259. $token = array_shift($tokens);
  32260. foreach ($values as $value) {
  32261. if ($token === $value || 0 === strpos($token, $value.'=')) {
  32262. if (false !== $pos = strpos($token, '=')) {
  32263. return substr($token, $pos + 1);
  32264. }
  32265. return array_shift($tokens);
  32266. }
  32267. }
  32268. }
  32269. return $default;
  32270. }
  32271. public function __toString()
  32272. {
  32273. $self = $this;
  32274. $tokens = array_map(function ($token) use ($self) {
  32275. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  32276. return $match[1].$self->escapeToken($match[2]);
  32277. }
  32278. if ($token && $token[0] !== '-') {
  32279. return $self->escapeToken($token);
  32280. }
  32281. return $token;
  32282. }, $this->tokens);
  32283. return implode(' ', $tokens);
  32284. }
  32285. }
  32286. <?php
  32287. namespace Symfony\Component\Console\Input;
  32288. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32289. use Symfony\Component\Console\Exception\InvalidOptionException;
  32290. class ArrayInput extends Input
  32291. {
  32292. private $parameters;
  32293. public function __construct(array $parameters, InputDefinition $definition = null)
  32294. {
  32295. $this->parameters = $parameters;
  32296. parent::__construct($definition);
  32297. }
  32298. public function getFirstArgument()
  32299. {
  32300. foreach ($this->parameters as $key => $value) {
  32301. if ($key && '-' === $key[0]) {
  32302. continue;
  32303. }
  32304. return $value;
  32305. }
  32306. }
  32307. public function hasParameterOption($values)
  32308. {
  32309. $values = (array) $values;
  32310. foreach ($this->parameters as $k => $v) {
  32311. if (!is_int($k)) {
  32312. $v = $k;
  32313. }
  32314. if (in_array($v, $values)) {
  32315. return true;
  32316. }
  32317. }
  32318. return false;
  32319. }
  32320. public function getParameterOption($values, $default = false)
  32321. {
  32322. $values = (array) $values;
  32323. foreach ($this->parameters as $k => $v) {
  32324. if (is_int($k)) {
  32325. if (in_array($v, $values)) {
  32326. return true;
  32327. }
  32328. } elseif (in_array($k, $values)) {
  32329. return $v;
  32330. }
  32331. }
  32332. return $default;
  32333. }
  32334. public function __toString()
  32335. {
  32336. $params = array();
  32337. foreach ($this->parameters as $param => $val) {
  32338. if ($param && '-' === $param[0]) {
  32339. $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
  32340. } else {
  32341. $params[] = $this->escapeToken($val);
  32342. }
  32343. }
  32344. return implode(' ', $params);
  32345. }
  32346. protected function parse()
  32347. {
  32348. foreach ($this->parameters as $key => $value) {
  32349. if (0 === strpos($key, '--')) {
  32350. $this->addLongOption(substr($key, 2), $value);
  32351. } elseif ('-' === $key[0]) {
  32352. $this->addShortOption(substr($key, 1), $value);
  32353. } else {
  32354. $this->addArgument($key, $value);
  32355. }
  32356. }
  32357. }
  32358. private function addShortOption($shortcut, $value)
  32359. {
  32360. if (!$this->definition->hasShortcut($shortcut)) {
  32361. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  32362. }
  32363. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  32364. }
  32365. private function addLongOption($name, $value)
  32366. {
  32367. if (!$this->definition->hasOption($name)) {
  32368. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  32369. }
  32370. $option = $this->definition->getOption($name);
  32371. if (null === $value) {
  32372. if ($option->isValueRequired()) {
  32373. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  32374. }
  32375. $value = $option->isValueOptional() ? $option->getDefault() : true;
  32376. }
  32377. $this->options[$name] = $value;
  32378. }
  32379. private function addArgument($name, $value)
  32380. {
  32381. if (!$this->definition->hasArgument($name)) {
  32382. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  32383. }
  32384. $this->arguments[$name] = $value;
  32385. }
  32386. }
  32387. <?php
  32388. namespace Symfony\Component\Console\Input;
  32389. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32390. use Symfony\Component\Console\Exception\RuntimeException;
  32391. abstract class Input implements InputInterface
  32392. {
  32393. protected $definition;
  32394. protected $options = array();
  32395. protected $arguments = array();
  32396. protected $interactive = true;
  32397. public function __construct(InputDefinition $definition = null)
  32398. {
  32399. if (null === $definition) {
  32400. $this->definition = new InputDefinition();
  32401. } else {
  32402. $this->bind($definition);
  32403. $this->validate();
  32404. }
  32405. }
  32406. public function bind(InputDefinition $definition)
  32407. {
  32408. $this->arguments = array();
  32409. $this->options = array();
  32410. $this->definition = $definition;
  32411. $this->parse();
  32412. }
  32413. abstract protected function parse();
  32414. public function validate()
  32415. {
  32416. $definition = $this->definition;
  32417. $givenArguments = $this->arguments;
  32418. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  32419. return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  32420. });
  32421. if (count($missingArguments) > 0) {
  32422. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  32423. }
  32424. }
  32425. public function isInteractive()
  32426. {
  32427. return $this->interactive;
  32428. }
  32429. public function setInteractive($interactive)
  32430. {
  32431. $this->interactive = (bool) $interactive;
  32432. }
  32433. public function getArguments()
  32434. {
  32435. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  32436. }
  32437. public function getArgument($name)
  32438. {
  32439. if (!$this->definition->hasArgument($name)) {
  32440. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  32441. }
  32442. return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
  32443. }
  32444. public function setArgument($name, $value)
  32445. {
  32446. if (!$this->definition->hasArgument($name)) {
  32447. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  32448. }
  32449. $this->arguments[$name] = $value;
  32450. }
  32451. public function hasArgument($name)
  32452. {
  32453. return $this->definition->hasArgument($name);
  32454. }
  32455. public function getOptions()
  32456. {
  32457. return array_merge($this->definition->getOptionDefaults(), $this->options);
  32458. }
  32459. public function getOption($name)
  32460. {
  32461. if (!$this->definition->hasOption($name)) {
  32462. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  32463. }
  32464. return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  32465. }
  32466. public function setOption($name, $value)
  32467. {
  32468. if (!$this->definition->hasOption($name)) {
  32469. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  32470. }
  32471. $this->options[$name] = $value;
  32472. }
  32473. public function hasOption($name)
  32474. {
  32475. return $this->definition->hasOption($name);
  32476. }
  32477. public function escapeToken($token)
  32478. {
  32479. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  32480. }
  32481. }
  32482. <?php
  32483. namespace Symfony\Component\Console\Input;
  32484. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32485. use Symfony\Component\Console\Exception\LogicException;
  32486. class InputArgument
  32487. {
  32488. const REQUIRED = 1;
  32489. const OPTIONAL = 2;
  32490. const IS_ARRAY = 4;
  32491. private $name;
  32492. private $mode;
  32493. private $default;
  32494. private $description;
  32495. public function __construct($name, $mode = null, $description = '', $default = null)
  32496. {
  32497. if (null === $mode) {
  32498. $mode = self::OPTIONAL;
  32499. } elseif (!is_int($mode) || $mode > 7 || $mode < 1) {
  32500. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  32501. }
  32502. $this->name = $name;
  32503. $this->mode = $mode;
  32504. $this->description = $description;
  32505. $this->setDefault($default);
  32506. }
  32507. public function getName()
  32508. {
  32509. return $this->name;
  32510. }
  32511. public function isRequired()
  32512. {
  32513. return self::REQUIRED === (self::REQUIRED & $this->mode);
  32514. }
  32515. public function isArray()
  32516. {
  32517. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  32518. }
  32519. public function setDefault($default = null)
  32520. {
  32521. if (self::REQUIRED === $this->mode && null !== $default) {
  32522. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  32523. }
  32524. if ($this->isArray()) {
  32525. if (null === $default) {
  32526. $default = array();
  32527. } elseif (!is_array($default)) {
  32528. throw new LogicException('A default value for an array argument must be an array.');
  32529. }
  32530. }
  32531. $this->default = $default;
  32532. }
  32533. public function getDefault()
  32534. {
  32535. return $this->default;
  32536. }
  32537. public function getDescription()
  32538. {
  32539. return $this->description;
  32540. }
  32541. }
  32542. <?php
  32543. namespace Symfony\Component\Console\Input;
  32544. interface InputAwareInterface
  32545. {
  32546. public function setInput(InputInterface $input);
  32547. }
  32548. <?php
  32549. namespace Symfony\Component\Console\Input;
  32550. use Symfony\Component\Console\Descriptor\TextDescriptor;
  32551. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  32552. use Symfony\Component\Console\Output\BufferedOutput;
  32553. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32554. use Symfony\Component\Console\Exception\LogicException;
  32555. class InputDefinition
  32556. {
  32557. private $arguments;
  32558. private $requiredCount;
  32559. private $hasAnArrayArgument = false;
  32560. private $hasOptional;
  32561. private $options;
  32562. private $shortcuts;
  32563. public function __construct(array $definition = array())
  32564. {
  32565. $this->setDefinition($definition);
  32566. }
  32567. public function setDefinition(array $definition)
  32568. {
  32569. $arguments = array();
  32570. $options = array();
  32571. foreach ($definition as $item) {
  32572. if ($item instanceof InputOption) {
  32573. $options[] = $item;
  32574. } else {
  32575. $arguments[] = $item;
  32576. }
  32577. }
  32578. $this->setArguments($arguments);
  32579. $this->setOptions($options);
  32580. }
  32581. public function setArguments($arguments = array())
  32582. {
  32583. $this->arguments = array();
  32584. $this->requiredCount = 0;
  32585. $this->hasOptional = false;
  32586. $this->hasAnArrayArgument = false;
  32587. $this->addArguments($arguments);
  32588. }
  32589. public function addArguments($arguments = array())
  32590. {
  32591. if (null !== $arguments) {
  32592. foreach ($arguments as $argument) {
  32593. $this->addArgument($argument);
  32594. }
  32595. }
  32596. }
  32597. public function addArgument(InputArgument $argument)
  32598. {
  32599. if (isset($this->arguments[$argument->getName()])) {
  32600. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  32601. }
  32602. if ($this->hasAnArrayArgument) {
  32603. throw new LogicException('Cannot add an argument after an array argument.');
  32604. }
  32605. if ($argument->isRequired() && $this->hasOptional) {
  32606. throw new LogicException('Cannot add a required argument after an optional one.');
  32607. }
  32608. if ($argument->isArray()) {
  32609. $this->hasAnArrayArgument = true;
  32610. }
  32611. if ($argument->isRequired()) {
  32612. ++$this->requiredCount;
  32613. } else {
  32614. $this->hasOptional = true;
  32615. }
  32616. $this->arguments[$argument->getName()] = $argument;
  32617. }
  32618. public function getArgument($name)
  32619. {
  32620. if (!$this->hasArgument($name)) {
  32621. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  32622. }
  32623. $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  32624. return $arguments[$name];
  32625. }
  32626. public function hasArgument($name)
  32627. {
  32628. $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  32629. return isset($arguments[$name]);
  32630. }
  32631. public function getArguments()
  32632. {
  32633. return $this->arguments;
  32634. }
  32635. public function getArgumentCount()
  32636. {
  32637. return $this->hasAnArrayArgument ? PHP_INT_MAX : count($this->arguments);
  32638. }
  32639. public function getArgumentRequiredCount()
  32640. {
  32641. return $this->requiredCount;
  32642. }
  32643. public function getArgumentDefaults()
  32644. {
  32645. $values = array();
  32646. foreach ($this->arguments as $argument) {
  32647. $values[$argument->getName()] = $argument->getDefault();
  32648. }
  32649. return $values;
  32650. }
  32651. public function setOptions($options = array())
  32652. {
  32653. $this->options = array();
  32654. $this->shortcuts = array();
  32655. $this->addOptions($options);
  32656. }
  32657. public function addOptions($options = array())
  32658. {
  32659. foreach ($options as $option) {
  32660. $this->addOption($option);
  32661. }
  32662. }
  32663. public function addOption(InputOption $option)
  32664. {
  32665. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  32666. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  32667. }
  32668. if ($option->getShortcut()) {
  32669. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  32670. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  32671. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  32672. }
  32673. }
  32674. }
  32675. $this->options[$option->getName()] = $option;
  32676. if ($option->getShortcut()) {
  32677. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  32678. $this->shortcuts[$shortcut] = $option->getName();
  32679. }
  32680. }
  32681. }
  32682. public function getOption($name)
  32683. {
  32684. if (!$this->hasOption($name)) {
  32685. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  32686. }
  32687. return $this->options[$name];
  32688. }
  32689. public function hasOption($name)
  32690. {
  32691. return isset($this->options[$name]);
  32692. }
  32693. public function getOptions()
  32694. {
  32695. return $this->options;
  32696. }
  32697. public function hasShortcut($name)
  32698. {
  32699. return isset($this->shortcuts[$name]);
  32700. }
  32701. public function getOptionForShortcut($shortcut)
  32702. {
  32703. return $this->getOption($this->shortcutToName($shortcut));
  32704. }
  32705. public function getOptionDefaults()
  32706. {
  32707. $values = array();
  32708. foreach ($this->options as $option) {
  32709. $values[$option->getName()] = $option->getDefault();
  32710. }
  32711. return $values;
  32712. }
  32713. private function shortcutToName($shortcut)
  32714. {
  32715. if (!isset($this->shortcuts[$shortcut])) {
  32716. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  32717. }
  32718. return $this->shortcuts[$shortcut];
  32719. }
  32720. public function getSynopsis($short = false)
  32721. {
  32722. $elements = array();
  32723. if ($short && $this->getOptions()) {
  32724. $elements[] = '[options]';
  32725. } elseif (!$short) {
  32726. foreach ($this->getOptions() as $option) {
  32727. $value = '';
  32728. if ($option->acceptValue()) {
  32729. $value = sprintf(
  32730. ' %s%s%s',
  32731. $option->isValueOptional() ? '[' : '',
  32732. strtoupper($option->getName()),
  32733. $option->isValueOptional() ? ']' : ''
  32734. );
  32735. }
  32736. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  32737. $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
  32738. }
  32739. }
  32740. if (count($elements) && $this->getArguments()) {
  32741. $elements[] = '[--]';
  32742. }
  32743. foreach ($this->getArguments() as $argument) {
  32744. $element = '<'.$argument->getName().'>';
  32745. if (!$argument->isRequired()) {
  32746. $element = '['.$element.']';
  32747. } elseif ($argument->isArray()) {
  32748. $element = $element.' ('.$element.')';
  32749. }
  32750. if ($argument->isArray()) {
  32751. $element .= '...';
  32752. }
  32753. $elements[] = $element;
  32754. }
  32755. return implode(' ', $elements);
  32756. }
  32757. public function asText()
  32758. {
  32759. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  32760. $descriptor = new TextDescriptor();
  32761. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  32762. $descriptor->describe($output, $this, array('raw_output' => true));
  32763. return $output->fetch();
  32764. }
  32765. public function asXml($asDom = false)
  32766. {
  32767. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  32768. $descriptor = new XmlDescriptor();
  32769. if ($asDom) {
  32770. return $descriptor->getInputDefinitionDocument($this);
  32771. }
  32772. $output = new BufferedOutput();
  32773. $descriptor->describe($output, $this);
  32774. return $output->fetch();
  32775. }
  32776. }
  32777. <?php
  32778. namespace Symfony\Component\Console\Input;
  32779. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32780. use Symfony\Component\Console\Exception\RuntimeException;
  32781. interface InputInterface
  32782. {
  32783. public function getFirstArgument();
  32784. public function hasParameterOption($values);
  32785. public function getParameterOption($values, $default = false);
  32786. public function bind(InputDefinition $definition);
  32787. public function validate();
  32788. public function getArguments();
  32789. public function getArgument($name);
  32790. public function setArgument($name, $value);
  32791. public function hasArgument($name);
  32792. public function getOptions();
  32793. public function getOption($name);
  32794. public function setOption($name, $value);
  32795. public function hasOption($name);
  32796. public function isInteractive();
  32797. public function setInteractive($interactive);
  32798. }
  32799. <?php
  32800. namespace Symfony\Component\Console\Input;
  32801. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32802. use Symfony\Component\Console\Exception\LogicException;
  32803. class InputOption
  32804. {
  32805. const VALUE_NONE = 1;
  32806. const VALUE_REQUIRED = 2;
  32807. const VALUE_OPTIONAL = 4;
  32808. const VALUE_IS_ARRAY = 8;
  32809. private $name;
  32810. private $shortcut;
  32811. private $mode;
  32812. private $default;
  32813. private $description;
  32814. public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
  32815. {
  32816. if (0 === strpos($name, '--')) {
  32817. $name = substr($name, 2);
  32818. }
  32819. if (empty($name)) {
  32820. throw new InvalidArgumentException('An option name cannot be empty.');
  32821. }
  32822. if (empty($shortcut)) {
  32823. $shortcut = null;
  32824. }
  32825. if (null !== $shortcut) {
  32826. if (is_array($shortcut)) {
  32827. $shortcut = implode('|', $shortcut);
  32828. }
  32829. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  32830. $shortcuts = array_filter($shortcuts);
  32831. $shortcut = implode('|', $shortcuts);
  32832. if (empty($shortcut)) {
  32833. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  32834. }
  32835. }
  32836. if (null === $mode) {
  32837. $mode = self::VALUE_NONE;
  32838. } elseif (!is_int($mode) || $mode > 15 || $mode < 1) {
  32839. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  32840. }
  32841. $this->name = $name;
  32842. $this->shortcut = $shortcut;
  32843. $this->mode = $mode;
  32844. $this->description = $description;
  32845. if ($this->isArray() && !$this->acceptValue()) {
  32846. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  32847. }
  32848. $this->setDefault($default);
  32849. }
  32850. public function getShortcut()
  32851. {
  32852. return $this->shortcut;
  32853. }
  32854. public function getName()
  32855. {
  32856. return $this->name;
  32857. }
  32858. public function acceptValue()
  32859. {
  32860. return $this->isValueRequired() || $this->isValueOptional();
  32861. }
  32862. public function isValueRequired()
  32863. {
  32864. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  32865. }
  32866. public function isValueOptional()
  32867. {
  32868. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  32869. }
  32870. public function isArray()
  32871. {
  32872. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  32873. }
  32874. public function setDefault($default = null)
  32875. {
  32876. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  32877. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  32878. }
  32879. if ($this->isArray()) {
  32880. if (null === $default) {
  32881. $default = array();
  32882. } elseif (!is_array($default)) {
  32883. throw new LogicException('A default value for an array option must be an array.');
  32884. }
  32885. }
  32886. $this->default = $this->acceptValue() ? $default : false;
  32887. }
  32888. public function getDefault()
  32889. {
  32890. return $this->default;
  32891. }
  32892. public function getDescription()
  32893. {
  32894. return $this->description;
  32895. }
  32896. public function equals(InputOption $option)
  32897. {
  32898. return $option->getName() === $this->getName()
  32899. && $option->getShortcut() === $this->getShortcut()
  32900. && $option->getDefault() === $this->getDefault()
  32901. && $option->isArray() === $this->isArray()
  32902. && $option->isValueRequired() === $this->isValueRequired()
  32903. && $option->isValueOptional() === $this->isValueOptional()
  32904. ;
  32905. }
  32906. }
  32907. <?php
  32908. namespace Symfony\Component\Console\Input;
  32909. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32910. class StringInput extends ArgvInput
  32911. {
  32912. const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  32913. const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  32914. public function __construct($input, InputDefinition $definition = null)
  32915. {
  32916. if ($definition) {
  32917. @trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
  32918. }
  32919. parent::__construct(array(), null);
  32920. $this->setTokens($this->tokenize($input));
  32921. if (null !== $definition) {
  32922. $this->bind($definition);
  32923. }
  32924. }
  32925. private function tokenize($input)
  32926. {
  32927. $tokens = array();
  32928. $length = strlen($input);
  32929. $cursor = 0;
  32930. while ($cursor < $length) {
  32931. if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
  32932. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
  32933. $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2)));
  32934. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
  32935. $tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2));
  32936. } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
  32937. $tokens[] = stripcslashes($match[1]);
  32938. } else {
  32939. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
  32940. }
  32941. $cursor += strlen($match[0]);
  32942. }
  32943. return $tokens;
  32944. }
  32945. }
  32946. Copyright (c) 2004-2016 Fabien Potencier
  32947. Permission is hereby granted, free of charge, to any person obtaining a copy
  32948. of this software and associated documentation files (the "Software"), to deal
  32949. in the Software without restriction, including without limitation the rights
  32950. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  32951. copies of the Software, and to permit persons to whom the Software is furnished
  32952. to do so, subject to the following conditions:
  32953. The above copyright notice and this permission notice shall be included in all
  32954. copies or substantial portions of the Software.
  32955. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  32956. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  32957. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  32958. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  32959. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  32960. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  32961. THE SOFTWARE.
  32962. <?php
  32963. namespace Symfony\Component\Console\Logger;
  32964. use Psr\Log\AbstractLogger;
  32965. use Psr\Log\InvalidArgumentException;
  32966. use Psr\Log\LogLevel;
  32967. use Symfony\Component\Console\Output\OutputInterface;
  32968. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  32969. class ConsoleLogger extends AbstractLogger
  32970. {
  32971. const INFO = 'info';
  32972. const ERROR = 'error';
  32973. private $output;
  32974. private $verbosityLevelMap = array(
  32975. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  32976. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  32977. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  32978. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  32979. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  32980. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  32981. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  32982. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  32983. );
  32984. private $formatLevelMap = array(
  32985. LogLevel::EMERGENCY => self::ERROR,
  32986. LogLevel::ALERT => self::ERROR,
  32987. LogLevel::CRITICAL => self::ERROR,
  32988. LogLevel::ERROR => self::ERROR,
  32989. LogLevel::WARNING => self::INFO,
  32990. LogLevel::NOTICE => self::INFO,
  32991. LogLevel::INFO => self::INFO,
  32992. LogLevel::DEBUG => self::INFO,
  32993. );
  32994. public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array())
  32995. {
  32996. $this->output = $output;
  32997. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  32998. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  32999. }
  33000. public function log($level, $message, array $context = array())
  33001. {
  33002. if (!isset($this->verbosityLevelMap[$level])) {
  33003. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  33004. }
  33005. if ($this->formatLevelMap[$level] === self::ERROR && $this->output instanceof ConsoleOutputInterface) {
  33006. $output = $this->output->getErrorOutput();
  33007. } else {
  33008. $output = $this->output;
  33009. }
  33010. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  33011. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
  33012. }
  33013. }
  33014. private function interpolate($message, array $context)
  33015. {
  33016. $replace = array();
  33017. foreach ($context as $key => $val) {
  33018. if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {
  33019. $replace[sprintf('{%s}', $key)] = $val;
  33020. }
  33021. }
  33022. return strtr($message, $replace);
  33023. }
  33024. }
  33025. <?php
  33026. namespace Symfony\Component\Console\Output;
  33027. class BufferedOutput extends Output
  33028. {
  33029. private $buffer = '';
  33030. public function fetch()
  33031. {
  33032. $content = $this->buffer;
  33033. $this->buffer = '';
  33034. return $content;
  33035. }
  33036. protected function doWrite($message, $newline)
  33037. {
  33038. $this->buffer .= $message;
  33039. if ($newline) {
  33040. $this->buffer .= "\n";
  33041. }
  33042. }
  33043. }
  33044. <?php
  33045. namespace Symfony\Component\Console\Output;
  33046. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  33047. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  33048. {
  33049. private $stderr;
  33050. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  33051. {
  33052. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  33053. $actualDecorated = $this->isDecorated();
  33054. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  33055. if (null === $decorated) {
  33056. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  33057. }
  33058. }
  33059. public function setDecorated($decorated)
  33060. {
  33061. parent::setDecorated($decorated);
  33062. $this->stderr->setDecorated($decorated);
  33063. }
  33064. public function setFormatter(OutputFormatterInterface $formatter)
  33065. {
  33066. parent::setFormatter($formatter);
  33067. $this->stderr->setFormatter($formatter);
  33068. }
  33069. public function setVerbosity($level)
  33070. {
  33071. parent::setVerbosity($level);
  33072. $this->stderr->setVerbosity($level);
  33073. }
  33074. public function getErrorOutput()
  33075. {
  33076. return $this->stderr;
  33077. }
  33078. public function setErrorOutput(OutputInterface $error)
  33079. {
  33080. $this->stderr = $error;
  33081. }
  33082. protected function hasStdoutSupport()
  33083. {
  33084. return false === $this->isRunningOS400();
  33085. }
  33086. protected function hasStderrSupport()
  33087. {
  33088. return false === $this->isRunningOS400();
  33089. }
  33090. private function isRunningOS400()
  33091. {
  33092. $checks = array(
  33093. function_exists('php_uname') ? php_uname('s') : '',
  33094. getenv('OSTYPE'),
  33095. PHP_OS,
  33096. );
  33097. return false !== stripos(implode(';', $checks), 'OS400');
  33098. }
  33099. private function openOutputStream()
  33100. {
  33101. $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
  33102. return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
  33103. }
  33104. private function openErrorStream()
  33105. {
  33106. $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
  33107. return fopen($errorStream, 'w');
  33108. }
  33109. }
  33110. <?php
  33111. namespace Symfony\Component\Console\Output;
  33112. interface ConsoleOutputInterface extends OutputInterface
  33113. {
  33114. public function getErrorOutput();
  33115. public function setErrorOutput(OutputInterface $error);
  33116. }
  33117. <?php
  33118. namespace Symfony\Component\Console\Output;
  33119. use Symfony\Component\Console\Formatter\OutputFormatter;
  33120. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  33121. class NullOutput implements OutputInterface
  33122. {
  33123. public function setFormatter(OutputFormatterInterface $formatter)
  33124. {
  33125. }
  33126. public function getFormatter()
  33127. {
  33128. return new OutputFormatter();
  33129. }
  33130. public function setDecorated($decorated)
  33131. {
  33132. }
  33133. public function isDecorated()
  33134. {
  33135. return false;
  33136. }
  33137. public function setVerbosity($level)
  33138. {
  33139. }
  33140. public function getVerbosity()
  33141. {
  33142. return self::VERBOSITY_QUIET;
  33143. }
  33144. public function isQuiet()
  33145. {
  33146. return true;
  33147. }
  33148. public function isVerbose()
  33149. {
  33150. return false;
  33151. }
  33152. public function isVeryVerbose()
  33153. {
  33154. return false;
  33155. }
  33156. public function isDebug()
  33157. {
  33158. return false;
  33159. }
  33160. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  33161. {
  33162. }
  33163. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  33164. {
  33165. }
  33166. }
  33167. <?php
  33168. namespace Symfony\Component\Console\Output;
  33169. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  33170. use Symfony\Component\Console\Formatter\OutputFormatter;
  33171. abstract class Output implements OutputInterface
  33172. {
  33173. private $verbosity;
  33174. private $formatter;
  33175. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
  33176. {
  33177. $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
  33178. $this->formatter = $formatter ?: new OutputFormatter();
  33179. $this->formatter->setDecorated($decorated);
  33180. }
  33181. public function setFormatter(OutputFormatterInterface $formatter)
  33182. {
  33183. $this->formatter = $formatter;
  33184. }
  33185. public function getFormatter()
  33186. {
  33187. return $this->formatter;
  33188. }
  33189. public function setDecorated($decorated)
  33190. {
  33191. $this->formatter->setDecorated($decorated);
  33192. }
  33193. public function isDecorated()
  33194. {
  33195. return $this->formatter->isDecorated();
  33196. }
  33197. public function setVerbosity($level)
  33198. {
  33199. $this->verbosity = (int) $level;
  33200. }
  33201. public function getVerbosity()
  33202. {
  33203. return $this->verbosity;
  33204. }
  33205. public function isQuiet()
  33206. {
  33207. return self::VERBOSITY_QUIET === $this->verbosity;
  33208. }
  33209. public function isVerbose()
  33210. {
  33211. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  33212. }
  33213. public function isVeryVerbose()
  33214. {
  33215. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  33216. }
  33217. public function isDebug()
  33218. {
  33219. return self::VERBOSITY_DEBUG <= $this->verbosity;
  33220. }
  33221. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  33222. {
  33223. $this->write($messages, true, $options);
  33224. }
  33225. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  33226. {
  33227. $messages = (array) $messages;
  33228. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  33229. $type = $types & $options ?: self::OUTPUT_NORMAL;
  33230. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  33231. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  33232. if ($verbosity > $this->getVerbosity()) {
  33233. return;
  33234. }
  33235. foreach ($messages as $message) {
  33236. switch ($type) {
  33237. case OutputInterface::OUTPUT_NORMAL:
  33238. $message = $this->formatter->format($message);
  33239. break;
  33240. case OutputInterface::OUTPUT_RAW:
  33241. break;
  33242. case OutputInterface::OUTPUT_PLAIN:
  33243. $message = strip_tags($this->formatter->format($message));
  33244. break;
  33245. }
  33246. $this->doWrite($message, $newline);
  33247. }
  33248. }
  33249. abstract protected function doWrite($message, $newline);
  33250. }
  33251. <?php
  33252. namespace Symfony\Component\Console\Output;
  33253. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  33254. interface OutputInterface
  33255. {
  33256. const VERBOSITY_QUIET = 16;
  33257. const VERBOSITY_NORMAL = 32;
  33258. const VERBOSITY_VERBOSE = 64;
  33259. const VERBOSITY_VERY_VERBOSE = 128;
  33260. const VERBOSITY_DEBUG = 256;
  33261. const OUTPUT_NORMAL = 1;
  33262. const OUTPUT_RAW = 2;
  33263. const OUTPUT_PLAIN = 4;
  33264. public function write($messages, $newline = false, $options = 0);
  33265. public function writeln($messages, $options = 0);
  33266. public function setVerbosity($level);
  33267. public function getVerbosity();
  33268. public function setDecorated($decorated);
  33269. public function isDecorated();
  33270. public function setFormatter(OutputFormatterInterface $formatter);
  33271. public function getFormatter();
  33272. }
  33273. <?php
  33274. namespace Symfony\Component\Console\Output;
  33275. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33276. use Symfony\Component\Console\Exception\RuntimeException;
  33277. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  33278. class StreamOutput extends Output
  33279. {
  33280. private $stream;
  33281. public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  33282. {
  33283. if (!is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  33284. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  33285. }
  33286. $this->stream = $stream;
  33287. if (null === $decorated) {
  33288. $decorated = $this->hasColorSupport();
  33289. }
  33290. parent::__construct($verbosity, $decorated, $formatter);
  33291. }
  33292. public function getStream()
  33293. {
  33294. return $this->stream;
  33295. }
  33296. protected function doWrite($message, $newline)
  33297. {
  33298. if (false === @fwrite($this->stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) {
  33299. throw new RuntimeException('Unable to write output.');
  33300. }
  33301. fflush($this->stream);
  33302. }
  33303. protected function hasColorSupport()
  33304. {
  33305. if (DIRECTORY_SEPARATOR === '\\') {
  33306. return
  33307. '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
  33308. || false !== getenv('ANSICON')
  33309. || 'ON' === getenv('ConEmuANSI')
  33310. || 'xterm' === getenv('TERM');
  33311. }
  33312. return function_exists('posix_isatty') && @posix_isatty($this->stream);
  33313. }
  33314. }
  33315. <?php
  33316. namespace Symfony\Component\Console\Question;
  33317. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33318. class ChoiceQuestion extends Question
  33319. {
  33320. private $choices;
  33321. private $multiselect = false;
  33322. private $prompt = ' > ';
  33323. private $errorMessage = 'Value "%s" is invalid';
  33324. public function __construct($question, array $choices, $default = null)
  33325. {
  33326. parent::__construct($question, $default);
  33327. $this->choices = $choices;
  33328. $this->setValidator($this->getDefaultValidator());
  33329. $this->setAutocompleterValues($choices);
  33330. }
  33331. public function getChoices()
  33332. {
  33333. return $this->choices;
  33334. }
  33335. public function setMultiselect($multiselect)
  33336. {
  33337. $this->multiselect = $multiselect;
  33338. $this->setValidator($this->getDefaultValidator());
  33339. return $this;
  33340. }
  33341. public function isMultiselect()
  33342. {
  33343. return $this->multiselect;
  33344. }
  33345. public function getPrompt()
  33346. {
  33347. return $this->prompt;
  33348. }
  33349. public function setPrompt($prompt)
  33350. {
  33351. $this->prompt = $prompt;
  33352. return $this;
  33353. }
  33354. public function setErrorMessage($errorMessage)
  33355. {
  33356. $this->errorMessage = $errorMessage;
  33357. $this->setValidator($this->getDefaultValidator());
  33358. return $this;
  33359. }
  33360. private function getDefaultValidator()
  33361. {
  33362. $choices = $this->choices;
  33363. $errorMessage = $this->errorMessage;
  33364. $multiselect = $this->multiselect;
  33365. $isAssoc = $this->isAssoc($choices);
  33366. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  33367. $selectedChoices = str_replace(' ', '', $selected);
  33368. if ($multiselect) {
  33369. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  33370. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  33371. }
  33372. $selectedChoices = explode(',', $selectedChoices);
  33373. } else {
  33374. $selectedChoices = array($selected);
  33375. }
  33376. $multiselectChoices = array();
  33377. foreach ($selectedChoices as $value) {
  33378. $results = array();
  33379. foreach ($choices as $key => $choice) {
  33380. if ($choice === $value) {
  33381. $results[] = $key;
  33382. }
  33383. }
  33384. if (count($results) > 1) {
  33385. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
  33386. }
  33387. $result = array_search($value, $choices);
  33388. if (!$isAssoc) {
  33389. if (false !== $result) {
  33390. $result = $choices[$result];
  33391. } elseif (isset($choices[$value])) {
  33392. $result = $choices[$value];
  33393. }
  33394. } elseif (false === $result && isset($choices[$value])) {
  33395. $result = $value;
  33396. }
  33397. if (false === $result) {
  33398. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  33399. }
  33400. $multiselectChoices[] = (string) $result;
  33401. }
  33402. if ($multiselect) {
  33403. return $multiselectChoices;
  33404. }
  33405. return current($multiselectChoices);
  33406. };
  33407. }
  33408. }
  33409. <?php
  33410. namespace Symfony\Component\Console\Question;
  33411. class ConfirmationQuestion extends Question
  33412. {
  33413. private $trueAnswerRegex;
  33414. public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
  33415. {
  33416. parent::__construct($question, (bool) $default);
  33417. $this->trueAnswerRegex = $trueAnswerRegex;
  33418. $this->setNormalizer($this->getDefaultNormalizer());
  33419. }
  33420. private function getDefaultNormalizer()
  33421. {
  33422. $default = $this->getDefault();
  33423. $regex = $this->trueAnswerRegex;
  33424. return function ($answer) use ($default, $regex) {
  33425. if (is_bool($answer)) {
  33426. return $answer;
  33427. }
  33428. $answerIsTrue = (bool) preg_match($regex, $answer);
  33429. if (false === $default) {
  33430. return $answer && $answerIsTrue;
  33431. }
  33432. return !$answer || $answerIsTrue;
  33433. };
  33434. }
  33435. }
  33436. <?php
  33437. namespace Symfony\Component\Console\Question;
  33438. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33439. use Symfony\Component\Console\Exception\LogicException;
  33440. class Question
  33441. {
  33442. private $question;
  33443. private $attempts;
  33444. private $hidden = false;
  33445. private $hiddenFallback = true;
  33446. private $autocompleterValues;
  33447. private $validator;
  33448. private $default;
  33449. private $normalizer;
  33450. public function __construct($question, $default = null)
  33451. {
  33452. $this->question = $question;
  33453. $this->default = $default;
  33454. }
  33455. public function getQuestion()
  33456. {
  33457. return $this->question;
  33458. }
  33459. public function getDefault()
  33460. {
  33461. return $this->default;
  33462. }
  33463. public function isHidden()
  33464. {
  33465. return $this->hidden;
  33466. }
  33467. public function setHidden($hidden)
  33468. {
  33469. if ($this->autocompleterValues) {
  33470. throw new LogicException('A hidden question cannot use the autocompleter.');
  33471. }
  33472. $this->hidden = (bool) $hidden;
  33473. return $this;
  33474. }
  33475. public function isHiddenFallback()
  33476. {
  33477. return $this->hiddenFallback;
  33478. }
  33479. public function setHiddenFallback($fallback)
  33480. {
  33481. $this->hiddenFallback = (bool) $fallback;
  33482. return $this;
  33483. }
  33484. public function getAutocompleterValues()
  33485. {
  33486. return $this->autocompleterValues;
  33487. }
  33488. public function setAutocompleterValues($values)
  33489. {
  33490. if (is_array($values)) {
  33491. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  33492. }
  33493. if (null !== $values && !is_array($values)) {
  33494. if (!$values instanceof \Traversable || !$values instanceof \Countable) {
  33495. throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or an object implementing both `Countable` and `Traversable` interfaces.');
  33496. }
  33497. }
  33498. if ($this->hidden) {
  33499. throw new LogicException('A hidden question cannot use the autocompleter.');
  33500. }
  33501. $this->autocompleterValues = $values;
  33502. return $this;
  33503. }
  33504. public function setValidator($validator)
  33505. {
  33506. $this->validator = $validator;
  33507. return $this;
  33508. }
  33509. public function getValidator()
  33510. {
  33511. return $this->validator;
  33512. }
  33513. public function setMaxAttempts($attempts)
  33514. {
  33515. if (null !== $attempts && $attempts < 1) {
  33516. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  33517. }
  33518. $this->attempts = $attempts;
  33519. return $this;
  33520. }
  33521. public function getMaxAttempts()
  33522. {
  33523. return $this->attempts;
  33524. }
  33525. public function setNormalizer($normalizer)
  33526. {
  33527. $this->normalizer = $normalizer;
  33528. return $this;
  33529. }
  33530. public function getNormalizer()
  33531. {
  33532. return $this->normalizer;
  33533. }
  33534. protected function isAssoc($array)
  33535. {
  33536. return (bool) count(array_filter(array_keys($array), 'is_string'));
  33537. }
  33538. }
  33539. <?php
  33540. namespace Symfony\Component\Console;
  33541. use Symfony\Component\Console\Exception\RuntimeException;
  33542. use Symfony\Component\Console\Input\StringInput;
  33543. use Symfony\Component\Console\Output\ConsoleOutput;
  33544. use Symfony\Component\Process\ProcessBuilder;
  33545. use Symfony\Component\Process\PhpExecutableFinder;
  33546. class Shell
  33547. {
  33548. private $application;
  33549. private $history;
  33550. private $output;
  33551. private $hasReadline;
  33552. private $processIsolation = false;
  33553. public function __construct(Application $application)
  33554. {
  33555. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  33556. $this->hasReadline = function_exists('readline');
  33557. $this->application = $application;
  33558. $this->history = getenv('HOME').'/.history_'.$application->getName();
  33559. $this->output = new ConsoleOutput();
  33560. }
  33561. public function run()
  33562. {
  33563. $this->application->setAutoExit(false);
  33564. $this->application->setCatchExceptions(true);
  33565. if ($this->hasReadline) {
  33566. readline_read_history($this->history);
  33567. readline_completion_function(array($this, 'autocompleter'));
  33568. }
  33569. $this->output->writeln($this->getHeader());
  33570. $php = null;
  33571. if ($this->processIsolation) {
  33572. $finder = new PhpExecutableFinder();
  33573. $php = $finder->find();
  33574. $this->output->writeln(<<<'EOF'
  33575. <info>Running with process isolation, you should consider this:</info>
  33576. * each command is executed as separate process,
  33577. * commands don't support interactivity, all params must be passed explicitly,
  33578. * commands output is not colorized.
  33579. EOF
  33580. );
  33581. }
  33582. while (true) {
  33583. $command = $this->readline();
  33584. if (false === $command) {
  33585. $this->output->writeln("\n");
  33586. break;
  33587. }
  33588. if ($this->hasReadline) {
  33589. readline_add_history($command);
  33590. readline_write_history($this->history);
  33591. }
  33592. if ($this->processIsolation) {
  33593. $pb = new ProcessBuilder();
  33594. $process = $pb
  33595. ->add($php)
  33596. ->add($_SERVER['argv'][0])
  33597. ->add($command)
  33598. ->inheritEnvironmentVariables(true)
  33599. ->getProcess()
  33600. ;
  33601. $output = $this->output;
  33602. $process->run(function ($type, $data) use ($output) {
  33603. $output->writeln($data);
  33604. });
  33605. $ret = $process->getExitCode();
  33606. } else {
  33607. $ret = $this->application->run(new StringInput($command), $this->output);
  33608. }
  33609. if (0 !== $ret) {
  33610. $this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
  33611. }
  33612. }
  33613. }
  33614. protected function getHeader()
  33615. {
  33616. return <<<EOF
  33617. Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
  33618. At the prompt, type <comment>help</comment> for some help,
  33619. or <comment>list</comment> to get a list of available commands.
  33620. To exit the shell, type <comment>^D</comment>.
  33621. EOF;
  33622. }
  33623. protected function getPrompt()
  33624. {
  33625. return $this->output->getFormatter()->format($this->application->getName().' > ');
  33626. }
  33627. protected function getOutput()
  33628. {
  33629. return $this->output;
  33630. }
  33631. protected function getApplication()
  33632. {
  33633. return $this->application;
  33634. }
  33635. private function autocompleter($text)
  33636. {
  33637. $info = readline_info();
  33638. $text = substr($info['line_buffer'], 0, $info['end']);
  33639. if ($info['point'] !== $info['end']) {
  33640. return true;
  33641. }
  33642. if (false === strpos($text, ' ') || !$text) {
  33643. return array_keys($this->application->all());
  33644. }
  33645. try {
  33646. $command = $this->application->find(substr($text, 0, strpos($text, ' ')));
  33647. } catch (\Exception $e) {
  33648. return true;
  33649. }
  33650. $list = array('--help');
  33651. foreach ($command->getDefinition()->getOptions() as $option) {
  33652. $list[] = '--'.$option->getName();
  33653. }
  33654. return $list;
  33655. }
  33656. private function readline()
  33657. {
  33658. if ($this->hasReadline) {
  33659. $line = readline($this->getPrompt());
  33660. } else {
  33661. $this->output->write($this->getPrompt());
  33662. $line = fgets(STDIN, 1024);
  33663. $line = (false === $line || '' === $line) ? false : rtrim($line);
  33664. }
  33665. return $line;
  33666. }
  33667. public function getProcessIsolation()
  33668. {
  33669. return $this->processIsolation;
  33670. }
  33671. public function setProcessIsolation($processIsolation)
  33672. {
  33673. $this->processIsolation = (bool) $processIsolation;
  33674. if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
  33675. throw new RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
  33676. }
  33677. }
  33678. }
  33679. <?php
  33680. namespace Symfony\Component\Console\Style;
  33681. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  33682. use Symfony\Component\Console\Helper\ProgressBar;
  33683. use Symfony\Component\Console\Output\OutputInterface;
  33684. abstract class OutputStyle implements OutputInterface, StyleInterface
  33685. {
  33686. private $output;
  33687. public function __construct(OutputInterface $output)
  33688. {
  33689. $this->output = $output;
  33690. }
  33691. public function newLine($count = 1)
  33692. {
  33693. $this->output->write(str_repeat(PHP_EOL, $count));
  33694. }
  33695. public function createProgressBar($max = 0)
  33696. {
  33697. return new ProgressBar($this->output, $max);
  33698. }
  33699. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  33700. {
  33701. $this->output->write($messages, $newline, $type);
  33702. }
  33703. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  33704. {
  33705. $this->output->writeln($messages, $type);
  33706. }
  33707. public function setVerbosity($level)
  33708. {
  33709. $this->output->setVerbosity($level);
  33710. }
  33711. public function getVerbosity()
  33712. {
  33713. return $this->output->getVerbosity();
  33714. }
  33715. public function setDecorated($decorated)
  33716. {
  33717. $this->output->setDecorated($decorated);
  33718. }
  33719. public function isDecorated()
  33720. {
  33721. return $this->output->isDecorated();
  33722. }
  33723. public function setFormatter(OutputFormatterInterface $formatter)
  33724. {
  33725. $this->output->setFormatter($formatter);
  33726. }
  33727. public function getFormatter()
  33728. {
  33729. return $this->output->getFormatter();
  33730. }
  33731. }
  33732. <?php
  33733. namespace Symfony\Component\Console\Style;
  33734. interface StyleInterface
  33735. {
  33736. public function title($message);
  33737. public function section($message);
  33738. public function listing(array $elements);
  33739. public function text($message);
  33740. public function success($message);
  33741. public function error($message);
  33742. public function warning($message);
  33743. public function note($message);
  33744. public function caution($message);
  33745. public function table(array $headers, array $rows);
  33746. public function ask($question, $default = null, $validator = null);
  33747. public function askHidden($question, $validator = null);
  33748. public function confirm($question, $default = true);
  33749. public function choice($question, array $choices, $default = null);
  33750. public function newLine($count = 1);
  33751. public function progressStart($max = 0);
  33752. public function progressAdvance($step = 1);
  33753. public function progressFinish();
  33754. }
  33755. <?php
  33756. namespace Symfony\Component\Console\Style;
  33757. use Symfony\Component\Console\Application;
  33758. use Symfony\Component\Console\Exception\RuntimeException;
  33759. use Symfony\Component\Console\Formatter\OutputFormatter;
  33760. use Symfony\Component\Console\Helper\Helper;
  33761. use Symfony\Component\Console\Helper\ProgressBar;
  33762. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  33763. use Symfony\Component\Console\Helper\Table;
  33764. use Symfony\Component\Console\Input\InputInterface;
  33765. use Symfony\Component\Console\Output\BufferedOutput;
  33766. use Symfony\Component\Console\Output\OutputInterface;
  33767. use Symfony\Component\Console\Question\ChoiceQuestion;
  33768. use Symfony\Component\Console\Question\ConfirmationQuestion;
  33769. use Symfony\Component\Console\Question\Question;
  33770. class SymfonyStyle extends OutputStyle
  33771. {
  33772. const MAX_LINE_LENGTH = 120;
  33773. private $input;
  33774. private $questionHelper;
  33775. private $progressBar;
  33776. private $lineLength;
  33777. private $bufferedOutput;
  33778. public function __construct(InputInterface $input, OutputInterface $output)
  33779. {
  33780. $this->input = $input;
  33781. $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
  33782. $this->lineLength = min($this->getTerminalWidth() - (int) (DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  33783. parent::__construct($output);
  33784. }
  33785. public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
  33786. {
  33787. $messages = is_array($messages) ? array_values($messages) : array($messages);
  33788. $this->autoPrependBlock();
  33789. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
  33790. $this->newLine();
  33791. }
  33792. public function title($message)
  33793. {
  33794. $this->autoPrependBlock();
  33795. $this->writeln(array(
  33796. sprintf('<comment>%s</>', $message),
  33797. sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  33798. ));
  33799. $this->newLine();
  33800. }
  33801. public function section($message)
  33802. {
  33803. $this->autoPrependBlock();
  33804. $this->writeln(array(
  33805. sprintf('<comment>%s</>', $message),
  33806. sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  33807. ));
  33808. $this->newLine();
  33809. }
  33810. public function listing(array $elements)
  33811. {
  33812. $this->autoPrependText();
  33813. $elements = array_map(function ($element) {
  33814. return sprintf(' * %s', $element);
  33815. }, $elements);
  33816. $this->writeln($elements);
  33817. $this->newLine();
  33818. }
  33819. public function text($message)
  33820. {
  33821. $this->autoPrependText();
  33822. $messages = is_array($message) ? array_values($message) : array($message);
  33823. foreach ($messages as $message) {
  33824. $this->writeln(sprintf(' %s', $message));
  33825. }
  33826. }
  33827. public function comment($message)
  33828. {
  33829. $messages = is_array($message) ? array_values($message) : array($message);
  33830. $this->autoPrependBlock();
  33831. $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
  33832. $this->newLine();
  33833. }
  33834. public function success($message)
  33835. {
  33836. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  33837. }
  33838. public function error($message)
  33839. {
  33840. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  33841. }
  33842. public function warning($message)
  33843. {
  33844. $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
  33845. }
  33846. public function note($message)
  33847. {
  33848. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  33849. }
  33850. public function caution($message)
  33851. {
  33852. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  33853. }
  33854. public function table(array $headers, array $rows)
  33855. {
  33856. $style = clone Table::getStyleDefinition('symfony-style-guide');
  33857. $style->setCellHeaderFormat('<info>%s</info>');
  33858. $table = new Table($this);
  33859. $table->setHeaders($headers);
  33860. $table->setRows($rows);
  33861. $table->setStyle($style);
  33862. $table->render();
  33863. $this->newLine();
  33864. }
  33865. public function ask($question, $default = null, $validator = null)
  33866. {
  33867. $question = new Question($question, $default);
  33868. $question->setValidator($validator);
  33869. return $this->askQuestion($question);
  33870. }
  33871. public function askHidden($question, $validator = null)
  33872. {
  33873. $question = new Question($question);
  33874. $question->setHidden(true);
  33875. $question->setValidator($validator);
  33876. return $this->askQuestion($question);
  33877. }
  33878. public function confirm($question, $default = true)
  33879. {
  33880. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  33881. }
  33882. public function choice($question, array $choices, $default = null)
  33883. {
  33884. if (null !== $default) {
  33885. $values = array_flip($choices);
  33886. $default = $values[$default];
  33887. }
  33888. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  33889. }
  33890. public function progressStart($max = 0)
  33891. {
  33892. $this->progressBar = $this->createProgressBar($max);
  33893. $this->progressBar->start();
  33894. }
  33895. public function progressAdvance($step = 1)
  33896. {
  33897. $this->getProgressBar()->advance($step);
  33898. }
  33899. public function progressFinish()
  33900. {
  33901. $this->getProgressBar()->finish();
  33902. $this->newLine(2);
  33903. $this->progressBar = null;
  33904. }
  33905. public function createProgressBar($max = 0)
  33906. {
  33907. $progressBar = parent::createProgressBar($max);
  33908. if ('\\' !== DIRECTORY_SEPARATOR) {
  33909. $progressBar->setEmptyBarCharacter('â–‘');
  33910. $progressBar->setProgressCharacter('');
  33911. $progressBar->setBarCharacter('â–“');
  33912. }
  33913. return $progressBar;
  33914. }
  33915. public function askQuestion(Question $question)
  33916. {
  33917. if ($this->input->isInteractive()) {
  33918. $this->autoPrependBlock();
  33919. }
  33920. if (!$this->questionHelper) {
  33921. $this->questionHelper = new SymfonyQuestionHelper();
  33922. }
  33923. $answer = $this->questionHelper->ask($this->input, $this, $question);
  33924. if ($this->input->isInteractive()) {
  33925. $this->newLine();
  33926. $this->bufferedOutput->write("\n");
  33927. }
  33928. return $answer;
  33929. }
  33930. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  33931. {
  33932. parent::writeln($messages, $type);
  33933. $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
  33934. }
  33935. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  33936. {
  33937. parent::write($messages, $newline, $type);
  33938. $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
  33939. }
  33940. public function newLine($count = 1)
  33941. {
  33942. parent::newLine($count);
  33943. $this->bufferedOutput->write(str_repeat("\n", $count));
  33944. }
  33945. private function getProgressBar()
  33946. {
  33947. if (!$this->progressBar) {
  33948. throw new RuntimeException('The ProgressBar is not started.');
  33949. }
  33950. return $this->progressBar;
  33951. }
  33952. private function getTerminalWidth()
  33953. {
  33954. $application = new Application();
  33955. $dimensions = $application->getTerminalDimensions();
  33956. return $dimensions[0] ?: self::MAX_LINE_LENGTH;
  33957. }
  33958. private function autoPrependBlock()
  33959. {
  33960. $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  33961. if (!isset($chars[0])) {
  33962. return $this->newLine();
  33963. }
  33964. $this->newLine(2 - substr_count($chars, "\n"));
  33965. }
  33966. private function autoPrependText()
  33967. {
  33968. $fetched = $this->bufferedOutput->fetch();
  33969. if ("\n" !== substr($fetched, -1)) {
  33970. $this->newLine();
  33971. }
  33972. }
  33973. private function reduceBuffer($messages)
  33974. {
  33975. return array_map(function ($value) {
  33976. return substr($value, -4);
  33977. }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
  33978. }
  33979. private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
  33980. {
  33981. $indentLength = 0;
  33982. $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
  33983. $lines = array();
  33984. if (null !== $type) {
  33985. $type = sprintf('[%s] ', $type);
  33986. $indentLength = strlen($type);
  33987. $lineIndentation = str_repeat(' ', $indentLength);
  33988. }
  33989. foreach ($messages as $key => $message) {
  33990. if ($escape) {
  33991. $message = OutputFormatter::escape($message);
  33992. }
  33993. $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
  33994. if (count($messages) > 1 && $key < count($messages) - 1) {
  33995. $lines[] = '';
  33996. }
  33997. }
  33998. $firstLineIndex = 0;
  33999. if ($padding && $this->isDecorated()) {
  34000. $firstLineIndex = 1;
  34001. array_unshift($lines, '');
  34002. $lines[] = '';
  34003. }
  34004. foreach ($lines as $i => &$line) {
  34005. if (null !== $type) {
  34006. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  34007. }
  34008. $line = $prefix.$line;
  34009. $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
  34010. if ($style) {
  34011. $line = sprintf('<%s>%s</>', $style, $line);
  34012. }
  34013. }
  34014. return $lines;
  34015. }
  34016. }
  34017. <?php
  34018. namespace Symfony\Component\Console\Tester;
  34019. use Symfony\Component\Console\Application;
  34020. use Symfony\Component\Console\Input\ArrayInput;
  34021. use Symfony\Component\Console\Input\InputInterface;
  34022. use Symfony\Component\Console\Output\OutputInterface;
  34023. use Symfony\Component\Console\Output\StreamOutput;
  34024. class ApplicationTester
  34025. {
  34026. private $application;
  34027. private $input;
  34028. private $output;
  34029. private $statusCode;
  34030. public function __construct(Application $application)
  34031. {
  34032. $this->application = $application;
  34033. }
  34034. public function run(array $input, $options = array())
  34035. {
  34036. $this->input = new ArrayInput($input);
  34037. if (isset($options['interactive'])) {
  34038. $this->input->setInteractive($options['interactive']);
  34039. }
  34040. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  34041. if (isset($options['decorated'])) {
  34042. $this->output->setDecorated($options['decorated']);
  34043. }
  34044. if (isset($options['verbosity'])) {
  34045. $this->output->setVerbosity($options['verbosity']);
  34046. }
  34047. return $this->statusCode = $this->application->run($this->input, $this->output);
  34048. }
  34049. public function getDisplay($normalize = false)
  34050. {
  34051. rewind($this->output->getStream());
  34052. $display = stream_get_contents($this->output->getStream());
  34053. if ($normalize) {
  34054. $display = str_replace(PHP_EOL, "\n", $display);
  34055. }
  34056. return $display;
  34057. }
  34058. public function getInput()
  34059. {
  34060. return $this->input;
  34061. }
  34062. public function getOutput()
  34063. {
  34064. return $this->output;
  34065. }
  34066. public function getStatusCode()
  34067. {
  34068. return $this->statusCode;
  34069. }
  34070. }
  34071. <?php
  34072. namespace Symfony\Component\Console\Tester;
  34073. use Symfony\Component\Console\Command\Command;
  34074. use Symfony\Component\Console\Input\ArrayInput;
  34075. use Symfony\Component\Console\Output\StreamOutput;
  34076. use Symfony\Component\Console\Input\InputInterface;
  34077. use Symfony\Component\Console\Output\OutputInterface;
  34078. class CommandTester
  34079. {
  34080. private $command;
  34081. private $input;
  34082. private $output;
  34083. private $statusCode;
  34084. public function __construct(Command $command)
  34085. {
  34086. $this->command = $command;
  34087. }
  34088. public function execute(array $input, array $options = array())
  34089. {
  34090. if (!isset($input['command'])
  34091. && (null !== $application = $this->command->getApplication())
  34092. && $application->getDefinition()->hasArgument('command')
  34093. ) {
  34094. $input = array_merge(array('command' => $this->command->getName()), $input);
  34095. }
  34096. $this->input = new ArrayInput($input);
  34097. if (isset($options['interactive'])) {
  34098. $this->input->setInteractive($options['interactive']);
  34099. }
  34100. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  34101. if (isset($options['decorated'])) {
  34102. $this->output->setDecorated($options['decorated']);
  34103. }
  34104. if (isset($options['verbosity'])) {
  34105. $this->output->setVerbosity($options['verbosity']);
  34106. }
  34107. return $this->statusCode = $this->command->run($this->input, $this->output);
  34108. }
  34109. public function getDisplay($normalize = false)
  34110. {
  34111. rewind($this->output->getStream());
  34112. $display = stream_get_contents($this->output->getStream());
  34113. if ($normalize) {
  34114. $display = str_replace(PHP_EOL, "\n", $display);
  34115. }
  34116. return $display;
  34117. }
  34118. public function getInput()
  34119. {
  34120. return $this->input;
  34121. }
  34122. public function getOutput()
  34123. {
  34124. return $this->output;
  34125. }
  34126. public function getStatusCode()
  34127. {
  34128. return $this->statusCode;
  34129. }
  34130. }
  34131. <?php
  34132. namespace Symfony\Component\Filesystem\Exception;
  34133. interface ExceptionInterface
  34134. {
  34135. }
  34136. <?php
  34137. namespace Symfony\Component\Filesystem\Exception;
  34138. class FileNotFoundException extends IOException
  34139. {
  34140. public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
  34141. {
  34142. if (null === $message) {
  34143. if (null === $path) {
  34144. $message = 'File could not be found.';
  34145. } else {
  34146. $message = sprintf('File "%s" could not be found.', $path);
  34147. }
  34148. }
  34149. parent::__construct($message, $code, $previous, $path);
  34150. }
  34151. }
  34152. <?php
  34153. namespace Symfony\Component\Filesystem\Exception;
  34154. class IOException extends \RuntimeException implements IOExceptionInterface
  34155. {
  34156. private $path;
  34157. public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
  34158. {
  34159. $this->path = $path;
  34160. parent::__construct($message, $code, $previous);
  34161. }
  34162. public function getPath()
  34163. {
  34164. return $this->path;
  34165. }
  34166. }
  34167. <?php
  34168. namespace Symfony\Component\Filesystem\Exception;
  34169. interface IOExceptionInterface extends ExceptionInterface
  34170. {
  34171. public function getPath();
  34172. }
  34173. <?php
  34174. namespace Symfony\Component\Filesystem;
  34175. use Symfony\Component\Filesystem\Exception\IOException;
  34176. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  34177. class Filesystem
  34178. {
  34179. public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
  34180. {
  34181. if (stream_is_local($originFile) && !is_file($originFile)) {
  34182. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  34183. }
  34184. $this->mkdir(dirname($targetFile));
  34185. $doCopy = true;
  34186. if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
  34187. $doCopy = filemtime($originFile) > filemtime($targetFile);
  34188. }
  34189. if ($doCopy) {
  34190. if (false === $source = @fopen($originFile, 'r')) {
  34191. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
  34192. }
  34193. if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) {
  34194. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
  34195. }
  34196. $bytesCopied = stream_copy_to_stream($source, $target);
  34197. fclose($source);
  34198. fclose($target);
  34199. unset($source, $target);
  34200. if (!is_file($targetFile)) {
  34201. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  34202. }
  34203. @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  34204. if (stream_is_local($originFile) && $bytesCopied !== ($bytesOrigin = filesize($originFile))) {
  34205. throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
  34206. }
  34207. }
  34208. }
  34209. public function mkdir($dirs, $mode = 0777)
  34210. {
  34211. foreach ($this->toIterator($dirs) as $dir) {
  34212. if (is_dir($dir)) {
  34213. continue;
  34214. }
  34215. if (true !== @mkdir($dir, $mode, true)) {
  34216. $error = error_get_last();
  34217. if (!is_dir($dir)) {
  34218. if ($error) {
  34219. throw new IOException(sprintf('Failed to create "%s": %s.', $dir, $error['message']), 0, null, $dir);
  34220. }
  34221. throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
  34222. }
  34223. }
  34224. }
  34225. }
  34226. public function exists($files)
  34227. {
  34228. foreach ($this->toIterator($files) as $file) {
  34229. if ('\\' === DIRECTORY_SEPARATOR && strlen($file) > 258) {
  34230. throw new IOException('Could not check if file exist because path length exceeds 258 characters.', 0, null, $file);
  34231. }
  34232. if (!file_exists($file)) {
  34233. return false;
  34234. }
  34235. }
  34236. return true;
  34237. }
  34238. public function touch($files, $time = null, $atime = null)
  34239. {
  34240. foreach ($this->toIterator($files) as $file) {
  34241. $touch = $time ? @touch($file, $time, $atime) : @touch($file);
  34242. if (true !== $touch) {
  34243. throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
  34244. }
  34245. }
  34246. }
  34247. public function remove($files)
  34248. {
  34249. if ($files instanceof \Traversable) {
  34250. $files = iterator_to_array($files, false);
  34251. } elseif (!is_array($files)) {
  34252. $files = array($files);
  34253. }
  34254. $files = array_reverse($files);
  34255. foreach ($files as $file) {
  34256. if (is_link($file)) {
  34257. if (!@(unlink($file) || '\\' !== DIRECTORY_SEPARATOR || rmdir($file)) && file_exists($file)) {
  34258. $error = error_get_last();
  34259. throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, $error['message']));
  34260. }
  34261. } elseif (is_dir($file)) {
  34262. $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
  34263. if (!@rmdir($file) && file_exists($file)) {
  34264. $error = error_get_last();
  34265. throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, $error['message']));
  34266. }
  34267. } elseif (!@unlink($file) && file_exists($file)) {
  34268. $error = error_get_last();
  34269. throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, $error['message']));
  34270. }
  34271. }
  34272. }
  34273. public function chmod($files, $mode, $umask = 0000, $recursive = false)
  34274. {
  34275. foreach ($this->toIterator($files) as $file) {
  34276. if (true !== @chmod($file, $mode & ~$umask)) {
  34277. throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
  34278. }
  34279. if ($recursive && is_dir($file) && !is_link($file)) {
  34280. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  34281. }
  34282. }
  34283. }
  34284. public function chown($files, $user, $recursive = false)
  34285. {
  34286. foreach ($this->toIterator($files) as $file) {
  34287. if ($recursive && is_dir($file) && !is_link($file)) {
  34288. $this->chown(new \FilesystemIterator($file), $user, true);
  34289. }
  34290. if (is_link($file) && function_exists('lchown')) {
  34291. if (true !== @lchown($file, $user)) {
  34292. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  34293. }
  34294. } else {
  34295. if (true !== @chown($file, $user)) {
  34296. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  34297. }
  34298. }
  34299. }
  34300. }
  34301. public function chgrp($files, $group, $recursive = false)
  34302. {
  34303. foreach ($this->toIterator($files) as $file) {
  34304. if ($recursive && is_dir($file) && !is_link($file)) {
  34305. $this->chgrp(new \FilesystemIterator($file), $group, true);
  34306. }
  34307. if (is_link($file) && function_exists('lchgrp')) {
  34308. if (true !== @lchgrp($file, $group) || (defined('HHVM_VERSION') && !posix_getgrnam($group))) {
  34309. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  34310. }
  34311. } else {
  34312. if (true !== @chgrp($file, $group)) {
  34313. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  34314. }
  34315. }
  34316. }
  34317. }
  34318. public function rename($origin, $target, $overwrite = false)
  34319. {
  34320. if (!$overwrite && $this->isReadable($target)) {
  34321. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  34322. }
  34323. if (true !== @rename($origin, $target)) {
  34324. throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
  34325. }
  34326. }
  34327. private function isReadable($filename)
  34328. {
  34329. if ('\\' === DIRECTORY_SEPARATOR && strlen($filename) > 258) {
  34330. throw new IOException('Could not check if file is readable because path length exceeds 258 characters.', 0, null, $filename);
  34331. }
  34332. return is_readable($filename);
  34333. }
  34334. public function symlink($originDir, $targetDir, $copyOnWindows = false)
  34335. {
  34336. if ('\\' === DIRECTORY_SEPARATOR) {
  34337. $originDir = strtr($originDir, '/', '\\');
  34338. $targetDir = strtr($targetDir, '/', '\\');
  34339. if ($copyOnWindows) {
  34340. $this->mirror($originDir, $targetDir);
  34341. return;
  34342. }
  34343. }
  34344. $this->mkdir(dirname($targetDir));
  34345. $ok = false;
  34346. if (is_link($targetDir)) {
  34347. if (readlink($targetDir) != $originDir) {
  34348. $this->remove($targetDir);
  34349. } else {
  34350. $ok = true;
  34351. }
  34352. }
  34353. if (!$ok && true !== @symlink($originDir, $targetDir)) {
  34354. $report = error_get_last();
  34355. if (is_array($report)) {
  34356. if ('\\' === DIRECTORY_SEPARATOR && false !== strpos($report['message'], 'error code(1314)')) {
  34357. throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', 0, null, $targetDir);
  34358. }
  34359. }
  34360. throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
  34361. }
  34362. }
  34363. public function makePathRelative($endPath, $startPath)
  34364. {
  34365. if ('\\' === DIRECTORY_SEPARATOR) {
  34366. $endPath = str_replace('\\', '/', $endPath);
  34367. $startPath = str_replace('\\', '/', $startPath);
  34368. }
  34369. $startPathArr = explode('/', trim($startPath, '/'));
  34370. $endPathArr = explode('/', trim($endPath, '/'));
  34371. $index = 0;
  34372. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  34373. ++$index;
  34374. }
  34375. $depth = count($startPathArr) - $index;
  34376. if ('/' === $startPath[0] && 0 === $index && 1 === $depth) {
  34377. $traverser = '';
  34378. } else {
  34379. $traverser = str_repeat('../', $depth);
  34380. }
  34381. $endPathRemainder = implode('/', array_slice($endPathArr, $index));
  34382. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  34383. return '' === $relativePath ? './' : $relativePath;
  34384. }
  34385. public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
  34386. {
  34387. $targetDir = rtrim($targetDir, '/\\');
  34388. $originDir = rtrim($originDir, '/\\');
  34389. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  34390. $deleteIterator = $iterator;
  34391. if (null === $deleteIterator) {
  34392. $flags = \FilesystemIterator::SKIP_DOTS;
  34393. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  34394. }
  34395. foreach ($deleteIterator as $file) {
  34396. $origin = str_replace($targetDir, $originDir, $file->getPathname());
  34397. if (!$this->exists($origin)) {
  34398. $this->remove($file);
  34399. }
  34400. }
  34401. }
  34402. $copyOnWindows = false;
  34403. if (isset($options['copy_on_windows'])) {
  34404. $copyOnWindows = $options['copy_on_windows'];
  34405. }
  34406. if (null === $iterator) {
  34407. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  34408. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  34409. }
  34410. if ($this->exists($originDir)) {
  34411. $this->mkdir($targetDir);
  34412. }
  34413. foreach ($iterator as $file) {
  34414. $target = str_replace($originDir, $targetDir, $file->getPathname());
  34415. if ($copyOnWindows) {
  34416. if (is_file($file)) {
  34417. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  34418. } elseif (is_dir($file)) {
  34419. $this->mkdir($target);
  34420. } else {
  34421. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  34422. }
  34423. } else {
  34424. if (is_link($file)) {
  34425. $this->symlink($file->getLinkTarget(), $target);
  34426. } elseif (is_dir($file)) {
  34427. $this->mkdir($target);
  34428. } elseif (is_file($file)) {
  34429. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  34430. } else {
  34431. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  34432. }
  34433. }
  34434. }
  34435. }
  34436. public function isAbsolutePath($file)
  34437. {
  34438. return strspn($file, '/\\', 0, 1)
  34439. || (strlen($file) > 3 && ctype_alpha($file[0])
  34440. && substr($file, 1, 1) === ':'
  34441. && strspn($file, '/\\', 2, 1)
  34442. )
  34443. || null !== parse_url($file, PHP_URL_SCHEME)
  34444. ;
  34445. }
  34446. public function tempnam($dir, $prefix)
  34447. {
  34448. list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
  34449. if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
  34450. $tmpFile = @tempnam($hierarchy, $prefix);
  34451. if (false !== $tmpFile) {
  34452. if (null !== $scheme && 'gs' !== $scheme) {
  34453. return $scheme.'://'.$tmpFile;
  34454. }
  34455. return $tmpFile;
  34456. }
  34457. throw new IOException('A temporary file could not be created.');
  34458. }
  34459. for ($i = 0; $i < 10; ++$i) {
  34460. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
  34461. $handle = @fopen($tmpFile, 'x+');
  34462. if (false === $handle) {
  34463. continue;
  34464. }
  34465. @fclose($handle);
  34466. return $tmpFile;
  34467. }
  34468. throw new IOException('A temporary file could not be created.');
  34469. }
  34470. public function dumpFile($filename, $content, $mode = 0666)
  34471. {
  34472. $dir = dirname($filename);
  34473. if (!is_dir($dir)) {
  34474. $this->mkdir($dir);
  34475. } elseif (!is_writable($dir)) {
  34476. throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
  34477. }
  34478. $tmpFile = $this->tempnam($dir, basename($filename));
  34479. if (false === @file_put_contents($tmpFile, $content)) {
  34480. throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
  34481. }
  34482. if (null !== $mode) {
  34483. if (func_num_args() > 2) {
  34484. @trigger_error('Support for modifying file permissions is deprecated since version 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
  34485. }
  34486. $this->chmod($tmpFile, $mode);
  34487. }
  34488. $this->rename($tmpFile, $filename, true);
  34489. }
  34490. private function toIterator($files)
  34491. {
  34492. if (!$files instanceof \Traversable) {
  34493. $files = new \ArrayObject(is_array($files) ? $files : array($files));
  34494. }
  34495. return $files;
  34496. }
  34497. private function getSchemeAndHierarchy($filename)
  34498. {
  34499. $components = explode('://', $filename, 2);
  34500. return 2 === count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
  34501. }
  34502. }
  34503. Copyright (c) 2004-2016 Fabien Potencier
  34504. Permission is hereby granted, free of charge, to any person obtaining a copy
  34505. of this software and associated documentation files (the "Software"), to deal
  34506. in the Software without restriction, including without limitation the rights
  34507. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34508. copies of the Software, and to permit persons to whom the Software is furnished
  34509. to do so, subject to the following conditions:
  34510. The above copyright notice and this permission notice shall be included in all
  34511. copies or substantial portions of the Software.
  34512. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34513. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34514. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34515. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34516. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34517. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  34518. THE SOFTWARE.
  34519. <?php
  34520. namespace Symfony\Component\Filesystem;
  34521. use Symfony\Component\Filesystem\Exception\IOException;
  34522. class LockHandler
  34523. {
  34524. private $file;
  34525. private $handle;
  34526. public function __construct($name, $lockPath = null)
  34527. {
  34528. $lockPath = $lockPath ?: sys_get_temp_dir();
  34529. if (!is_dir($lockPath)) {
  34530. $fs = new Filesystem();
  34531. $fs->mkdir($lockPath);
  34532. }
  34533. if (!is_writable($lockPath)) {
  34534. throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
  34535. }
  34536. $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name));
  34537. }
  34538. public function lock($blocking = false)
  34539. {
  34540. if ($this->handle) {
  34541. return true;
  34542. }
  34543. set_error_handler(function () {});
  34544. if (!$this->handle = fopen($this->file, 'r')) {
  34545. if ($this->handle = fopen($this->file, 'x')) {
  34546. chmod($this->file, 0444);
  34547. } elseif (!$this->handle = fopen($this->file, 'r')) {
  34548. usleep(100);
  34549. $this->handle = fopen($this->file, 'r');
  34550. }
  34551. }
  34552. restore_error_handler();
  34553. if (!$this->handle) {
  34554. $error = error_get_last();
  34555. throw new IOException($error['message'], 0, null, $this->file);
  34556. }
  34557. if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
  34558. fclose($this->handle);
  34559. $this->handle = null;
  34560. return false;
  34561. }
  34562. return true;
  34563. }
  34564. public function release()
  34565. {
  34566. if ($this->handle) {
  34567. flock($this->handle, LOCK_UN | LOCK_NB);
  34568. fclose($this->handle);
  34569. $this->handle = null;
  34570. }
  34571. }
  34572. }
  34573. <?php
  34574. namespace Symfony\Component\Finder\Adapter;
  34575. @trigger_error('The '.__NAMESPACE__.'\AbstractAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  34576. abstract class AbstractAdapter implements AdapterInterface
  34577. {
  34578. protected $followLinks = false;
  34579. protected $mode = 0;
  34580. protected $minDepth = 0;
  34581. protected $maxDepth = PHP_INT_MAX;
  34582. protected $exclude = array();
  34583. protected $names = array();
  34584. protected $notNames = array();
  34585. protected $contains = array();
  34586. protected $notContains = array();
  34587. protected $sizes = array();
  34588. protected $dates = array();
  34589. protected $filters = array();
  34590. protected $sort = false;
  34591. protected $paths = array();
  34592. protected $notPaths = array();
  34593. protected $ignoreUnreadableDirs = false;
  34594. private static $areSupported = array();
  34595. public function isSupported()
  34596. {
  34597. $name = $this->getName();
  34598. if (!array_key_exists($name, self::$areSupported)) {
  34599. self::$areSupported[$name] = $this->canBeUsed();
  34600. }
  34601. return self::$areSupported[$name];
  34602. }
  34603. public function setFollowLinks($followLinks)
  34604. {
  34605. $this->followLinks = $followLinks;
  34606. return $this;
  34607. }
  34608. public function setMode($mode)
  34609. {
  34610. $this->mode = $mode;
  34611. return $this;
  34612. }
  34613. public function setDepths(array $depths)
  34614. {
  34615. $this->minDepth = 0;
  34616. $this->maxDepth = PHP_INT_MAX;
  34617. foreach ($depths as $comparator) {
  34618. switch ($comparator->getOperator()) {
  34619. case '>':
  34620. $this->minDepth = $comparator->getTarget() + 1;
  34621. break;
  34622. case '>=':
  34623. $this->minDepth = $comparator->getTarget();
  34624. break;
  34625. case '<':
  34626. $this->maxDepth = $comparator->getTarget() - 1;
  34627. break;
  34628. case '<=':
  34629. $this->maxDepth = $comparator->getTarget();
  34630. break;
  34631. default:
  34632. $this->minDepth = $this->maxDepth = $comparator->getTarget();
  34633. }
  34634. }
  34635. return $this;
  34636. }
  34637. public function setExclude(array $exclude)
  34638. {
  34639. $this->exclude = $exclude;
  34640. return $this;
  34641. }
  34642. public function setNames(array $names)
  34643. {
  34644. $this->names = $names;
  34645. return $this;
  34646. }
  34647. public function setNotNames(array $notNames)
  34648. {
  34649. $this->notNames = $notNames;
  34650. return $this;
  34651. }
  34652. public function setContains(array $contains)
  34653. {
  34654. $this->contains = $contains;
  34655. return $this;
  34656. }
  34657. public function setNotContains(array $notContains)
  34658. {
  34659. $this->notContains = $notContains;
  34660. return $this;
  34661. }
  34662. public function setSizes(array $sizes)
  34663. {
  34664. $this->sizes = $sizes;
  34665. return $this;
  34666. }
  34667. public function setDates(array $dates)
  34668. {
  34669. $this->dates = $dates;
  34670. return $this;
  34671. }
  34672. public function setFilters(array $filters)
  34673. {
  34674. $this->filters = $filters;
  34675. return $this;
  34676. }
  34677. public function setSort($sort)
  34678. {
  34679. $this->sort = $sort;
  34680. return $this;
  34681. }
  34682. public function setPath(array $paths)
  34683. {
  34684. $this->paths = $paths;
  34685. return $this;
  34686. }
  34687. public function setNotPath(array $notPaths)
  34688. {
  34689. $this->notPaths = $notPaths;
  34690. return $this;
  34691. }
  34692. public function ignoreUnreadableDirs($ignore = true)
  34693. {
  34694. $this->ignoreUnreadableDirs = (bool) $ignore;
  34695. return $this;
  34696. }
  34697. abstract protected function canBeUsed();
  34698. }
  34699. <?php
  34700. namespace Symfony\Component\Finder\Adapter;
  34701. @trigger_error('The '.__NAMESPACE__.'\AbstractFindAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  34702. use Symfony\Component\Finder\Exception\AccessDeniedException;
  34703. use Symfony\Component\Finder\Iterator;
  34704. use Symfony\Component\Finder\Shell\Shell;
  34705. use Symfony\Component\Finder\Expression\Expression;
  34706. use Symfony\Component\Finder\Shell\Command;
  34707. use Symfony\Component\Finder\Comparator\NumberComparator;
  34708. use Symfony\Component\Finder\Comparator\DateComparator;
  34709. abstract class AbstractFindAdapter extends AbstractAdapter
  34710. {
  34711. protected $shell;
  34712. public function __construct()
  34713. {
  34714. $this->shell = new Shell();
  34715. }
  34716. public function searchInDirectory($dir)
  34717. {
  34718. $dir = realpath($dir);
  34719. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode && ($this->contains || $this->notContains)) {
  34720. return new Iterator\FilePathsIterator(array(), $dir);
  34721. }
  34722. $command = Command::create();
  34723. $find = $this->buildFindCommand($command, $dir);
  34724. if ($this->followLinks) {
  34725. $find->add('-follow');
  34726. }
  34727. $find->add('-mindepth')->add($this->minDepth + 1);
  34728. if (PHP_INT_MAX !== $this->maxDepth) {
  34729. $find->add('-maxdepth')->add($this->maxDepth + 1);
  34730. }
  34731. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode) {
  34732. $find->add('-type d');
  34733. } elseif (Iterator\FileTypeFilterIterator::ONLY_FILES === $this->mode) {
  34734. $find->add('-type f');
  34735. }
  34736. $this->buildNamesFiltering($find, $this->names);
  34737. $this->buildNamesFiltering($find, $this->notNames, true);
  34738. $this->buildPathsFiltering($find, $dir, $this->paths);
  34739. $this->buildPathsFiltering($find, $dir, $this->notPaths, true);
  34740. $this->buildSizesFiltering($find, $this->sizes);
  34741. $this->buildDatesFiltering($find, $this->dates);
  34742. $useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
  34743. $useSort = is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
  34744. if ($useGrep && ($this->contains || $this->notContains)) {
  34745. $grep = $command->ins('grep');
  34746. $this->buildContentFiltering($grep, $this->contains);
  34747. $this->buildContentFiltering($grep, $this->notContains, true);
  34748. }
  34749. if ($useSort) {
  34750. $this->buildSorting($command, $this->sort);
  34751. }
  34752. $command->setErrorHandler(
  34753. $this->ignoreUnreadableDirs
  34754. ? function ($stderr) { }
  34755. : function ($stderr) { throw new AccessDeniedException($stderr); }
  34756. );
  34757. $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
  34758. $iterator = new Iterator\FilePathsIterator($paths, $dir);
  34759. if ($this->exclude) {
  34760. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  34761. }
  34762. if (!$useGrep && ($this->contains || $this->notContains)) {
  34763. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  34764. }
  34765. if ($this->filters) {
  34766. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  34767. }
  34768. if (!$useSort && $this->sort) {
  34769. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  34770. $iterator = $iteratorAggregate->getIterator();
  34771. }
  34772. return $iterator;
  34773. }
  34774. protected function canBeUsed()
  34775. {
  34776. return $this->shell->testCommand('find');
  34777. }
  34778. protected function buildFindCommand(Command $command, $dir)
  34779. {
  34780. return $command
  34781. ->ins('find')
  34782. ->add('find ')
  34783. ->arg($dir)
  34784. ->add('-noleaf');
  34785. }
  34786. private function buildNamesFiltering(Command $command, array $names, $not = false)
  34787. {
  34788. if (0 === count($names)) {
  34789. return;
  34790. }
  34791. $command->add($not ? '-not' : null)->cmd('(');
  34792. foreach ($names as $i => $name) {
  34793. $expr = Expression::create($name);
  34794. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  34795. $expr = Expression::create($expr->getGlob()->toRegex(false));
  34796. }
  34797. if ($expr->isRegex()) {
  34798. $regex = $expr->getRegex();
  34799. $regex->prepend($regex->hasStartFlag() ? '/' : '/[^/]*')
  34800. ->setStartFlag(false)
  34801. ->setStartJoker(true)
  34802. ->replaceJokers('[^/]');
  34803. if (!$regex->hasEndFlag() || $regex->hasEndJoker()) {
  34804. $regex->setEndJoker(false)->append('[^/]*');
  34805. }
  34806. }
  34807. $command
  34808. ->add($i > 0 ? '-or' : null)
  34809. ->add($expr->isRegex()
  34810. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  34811. : ($expr->isCaseSensitive() ? '-name' : '-iname')
  34812. )
  34813. ->arg($expr->renderPattern());
  34814. }
  34815. $command->cmd(')');
  34816. }
  34817. private function buildPathsFiltering(Command $command, $dir, array $paths, $not = false)
  34818. {
  34819. if (0 === count($paths)) {
  34820. return;
  34821. }
  34822. $command->add($not ? '-not' : null)->cmd('(');
  34823. foreach ($paths as $i => $path) {
  34824. $expr = Expression::create($path);
  34825. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  34826. $expr = Expression::create($expr->getGlob()->toRegex(false));
  34827. }
  34828. if ($expr->isRegex()) {
  34829. $regex = $expr->getRegex();
  34830. $regex->prepend($regex->hasStartFlag() ? preg_quote($dir).DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
  34831. } else {
  34832. $expr->prepend('*')->append('*');
  34833. }
  34834. $command
  34835. ->add($i > 0 ? '-or' : null)
  34836. ->add($expr->isRegex()
  34837. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  34838. : ($expr->isCaseSensitive() ? '-path' : '-ipath')
  34839. )
  34840. ->arg($expr->renderPattern());
  34841. }
  34842. $command->cmd(')');
  34843. }
  34844. private function buildSizesFiltering(Command $command, array $sizes)
  34845. {
  34846. foreach ($sizes as $i => $size) {
  34847. $command->add($i > 0 ? '-and' : null);
  34848. switch ($size->getOperator()) {
  34849. case '<=':
  34850. $command->add('-size -'.($size->getTarget() + 1).'c');
  34851. break;
  34852. case '>=':
  34853. $command->add('-size +'.($size->getTarget() - 1).'c');
  34854. break;
  34855. case '>':
  34856. $command->add('-size +'.$size->getTarget().'c');
  34857. break;
  34858. case '!=':
  34859. $command->add('-size -'.$size->getTarget().'c');
  34860. $command->add('-size +'.$size->getTarget().'c');
  34861. break;
  34862. case '<':
  34863. default:
  34864. $command->add('-size -'.$size->getTarget().'c');
  34865. }
  34866. }
  34867. }
  34868. private function buildDatesFiltering(Command $command, array $dates)
  34869. {
  34870. foreach ($dates as $i => $date) {
  34871. $command->add($i > 0 ? '-and' : null);
  34872. $mins = (int) round((time() - $date->getTarget()) / 60);
  34873. if (0 > $mins) {
  34874. $command->add(' -mmin -0');
  34875. return;
  34876. }
  34877. switch ($date->getOperator()) {
  34878. case '<=':
  34879. $command->add('-mmin +'.($mins - 1));
  34880. break;
  34881. case '>=':
  34882. $command->add('-mmin -'.($mins + 1));
  34883. break;
  34884. case '>':
  34885. $command->add('-mmin -'.$mins);
  34886. break;
  34887. case '!=':
  34888. $command->add('-mmin +'.$mins.' -or -mmin -'.$mins);
  34889. break;
  34890. case '<':
  34891. default:
  34892. $command->add('-mmin +'.$mins);
  34893. }
  34894. }
  34895. }
  34896. private function buildSorting(Command $command, $sort)
  34897. {
  34898. $this->buildFormatSorting($command, $sort);
  34899. }
  34900. abstract protected function buildFormatSorting(Command $command, $sort);
  34901. abstract protected function buildContentFiltering(Command $command, array $contains, $not = false);
  34902. }
  34903. <?php
  34904. namespace Symfony\Component\Finder\Adapter;
  34905. interface AdapterInterface
  34906. {
  34907. public function setFollowLinks($followLinks);
  34908. public function setMode($mode);
  34909. public function setExclude(array $exclude);
  34910. public function setDepths(array $depths);
  34911. public function setNames(array $names);
  34912. public function setNotNames(array $notNames);
  34913. public function setContains(array $contains);
  34914. public function setNotContains(array $notContains);
  34915. public function setSizes(array $sizes);
  34916. public function setDates(array $dates);
  34917. public function setFilters(array $filters);
  34918. public function setSort($sort);
  34919. public function setPath(array $paths);
  34920. public function setNotPath(array $notPaths);
  34921. public function ignoreUnreadableDirs($ignore = true);
  34922. public function searchInDirectory($dir);
  34923. public function isSupported();
  34924. public function getName();
  34925. }
  34926. <?php
  34927. namespace Symfony\Component\Finder\Adapter;
  34928. @trigger_error('The '.__NAMESPACE__.'\BsdFindAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  34929. use Symfony\Component\Finder\Shell\Shell;
  34930. use Symfony\Component\Finder\Shell\Command;
  34931. use Symfony\Component\Finder\Iterator\SortableIterator;
  34932. use Symfony\Component\Finder\Expression\Expression;
  34933. class BsdFindAdapter extends AbstractFindAdapter
  34934. {
  34935. public function getName()
  34936. {
  34937. return 'bsd_find';
  34938. }
  34939. protected function canBeUsed()
  34940. {
  34941. return in_array($this->shell->getType(), array(Shell::TYPE_BSD, Shell::TYPE_DARWIN)) && parent::canBeUsed();
  34942. }
  34943. protected function buildFormatSorting(Command $command, $sort)
  34944. {
  34945. switch ($sort) {
  34946. case SortableIterator::SORT_BY_NAME:
  34947. $command->ins('sort')->add('| sort');
  34948. return;
  34949. case SortableIterator::SORT_BY_TYPE:
  34950. $format = '%HT';
  34951. break;
  34952. case SortableIterator::SORT_BY_ACCESSED_TIME:
  34953. $format = '%a';
  34954. break;
  34955. case SortableIterator::SORT_BY_CHANGED_TIME:
  34956. $format = '%c';
  34957. break;
  34958. case SortableIterator::SORT_BY_MODIFIED_TIME:
  34959. $format = '%m';
  34960. break;
  34961. default:
  34962. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  34963. }
  34964. $command
  34965. ->add('-print0 | xargs -0 stat -f')
  34966. ->arg($format.'%t%N')
  34967. ->add('| sort | cut -f 2');
  34968. }
  34969. protected function buildFindCommand(Command $command, $dir)
  34970. {
  34971. parent::buildFindCommand($command, $dir)->addAtIndex('-E', 1);
  34972. return $command;
  34973. }
  34974. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  34975. {
  34976. foreach ($contains as $contain) {
  34977. $expr = Expression::create($contain);
  34978. $command
  34979. ->add('| grep -v \'^$\'')
  34980. ->add('| xargs -I{} grep -I')
  34981. ->add($expr->isCaseSensitive() ? null : '-i')
  34982. ->add($not ? '-L' : '-l')
  34983. ->add('-Ee')->arg($expr->renderPattern())
  34984. ->add('{}')
  34985. ;
  34986. }
  34987. }
  34988. }
  34989. <?php
  34990. namespace Symfony\Component\Finder\Adapter;
  34991. @trigger_error('The '.__NAMESPACE__.'\GnuFindAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  34992. use Symfony\Component\Finder\Shell\Shell;
  34993. use Symfony\Component\Finder\Shell\Command;
  34994. use Symfony\Component\Finder\Iterator\SortableIterator;
  34995. use Symfony\Component\Finder\Expression\Expression;
  34996. class GnuFindAdapter extends AbstractFindAdapter
  34997. {
  34998. public function getName()
  34999. {
  35000. return 'gnu_find';
  35001. }
  35002. protected function buildFormatSorting(Command $command, $sort)
  35003. {
  35004. switch ($sort) {
  35005. case SortableIterator::SORT_BY_NAME:
  35006. $command->ins('sort')->add('| sort');
  35007. return;
  35008. case SortableIterator::SORT_BY_TYPE:
  35009. $format = '%y';
  35010. break;
  35011. case SortableIterator::SORT_BY_ACCESSED_TIME:
  35012. $format = '%A@';
  35013. break;
  35014. case SortableIterator::SORT_BY_CHANGED_TIME:
  35015. $format = '%C@';
  35016. break;
  35017. case SortableIterator::SORT_BY_MODIFIED_TIME:
  35018. $format = '%T@';
  35019. break;
  35020. default:
  35021. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  35022. }
  35023. $command
  35024. ->get('find')
  35025. ->add('-printf')
  35026. ->arg($format.' %h/%f\\n')
  35027. ->add('| sort | cut')
  35028. ->arg('-d ')
  35029. ->arg('-f2-')
  35030. ;
  35031. }
  35032. protected function canBeUsed()
  35033. {
  35034. return $this->shell->getType() === Shell::TYPE_UNIX && parent::canBeUsed();
  35035. }
  35036. protected function buildFindCommand(Command $command, $dir)
  35037. {
  35038. return parent::buildFindCommand($command, $dir)->add('-regextype posix-extended');
  35039. }
  35040. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  35041. {
  35042. foreach ($contains as $contain) {
  35043. $expr = Expression::create($contain);
  35044. $command
  35045. ->add('| xargs -I{} -r grep -I')
  35046. ->add($expr->isCaseSensitive() ? null : '-i')
  35047. ->add($not ? '-L' : '-l')
  35048. ->add('-Ee')->arg($expr->renderPattern())
  35049. ->add('{}')
  35050. ;
  35051. }
  35052. }
  35053. }
  35054. <?php
  35055. namespace Symfony\Component\Finder\Adapter;
  35056. @trigger_error('The '.__NAMESPACE__.'\PhpAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  35057. use Symfony\Component\Finder\Iterator;
  35058. class PhpAdapter extends AbstractAdapter
  35059. {
  35060. public function searchInDirectory($dir)
  35061. {
  35062. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  35063. if ($this->followLinks) {
  35064. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  35065. }
  35066. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  35067. if ($this->exclude) {
  35068. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  35069. }
  35070. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  35071. if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
  35072. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
  35073. }
  35074. if ($this->mode) {
  35075. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  35076. }
  35077. if ($this->names || $this->notNames) {
  35078. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  35079. }
  35080. if ($this->contains || $this->notContains) {
  35081. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  35082. }
  35083. if ($this->sizes) {
  35084. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  35085. }
  35086. if ($this->dates) {
  35087. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  35088. }
  35089. if ($this->filters) {
  35090. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  35091. }
  35092. if ($this->paths || $this->notPaths) {
  35093. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  35094. }
  35095. if ($this->sort) {
  35096. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  35097. $iterator = $iteratorAggregate->getIterator();
  35098. }
  35099. return $iterator;
  35100. }
  35101. public function getName()
  35102. {
  35103. return 'php';
  35104. }
  35105. protected function canBeUsed()
  35106. {
  35107. return true;
  35108. }
  35109. }
  35110. <?php
  35111. namespace Symfony\Component\Finder\Comparator;
  35112. class Comparator
  35113. {
  35114. private $target;
  35115. private $operator = '==';
  35116. public function getTarget()
  35117. {
  35118. return $this->target;
  35119. }
  35120. public function setTarget($target)
  35121. {
  35122. $this->target = $target;
  35123. }
  35124. public function getOperator()
  35125. {
  35126. return $this->operator;
  35127. }
  35128. public function setOperator($operator)
  35129. {
  35130. if (!$operator) {
  35131. $operator = '==';
  35132. }
  35133. if (!in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
  35134. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  35135. }
  35136. $this->operator = $operator;
  35137. }
  35138. public function test($test)
  35139. {
  35140. switch ($this->operator) {
  35141. case '>':
  35142. return $test > $this->target;
  35143. case '>=':
  35144. return $test >= $this->target;
  35145. case '<':
  35146. return $test < $this->target;
  35147. case '<=':
  35148. return $test <= $this->target;
  35149. case '!=':
  35150. return $test != $this->target;
  35151. }
  35152. return $test == $this->target;
  35153. }
  35154. }
  35155. <?php
  35156. namespace Symfony\Component\Finder\Comparator;
  35157. class DateComparator extends Comparator
  35158. {
  35159. public function __construct($test)
  35160. {
  35161. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  35162. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  35163. }
  35164. try {
  35165. $date = new \DateTime($matches[2]);
  35166. $target = $date->format('U');
  35167. } catch (\Exception $e) {
  35168. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  35169. }
  35170. $operator = isset($matches[1]) ? $matches[1] : '==';
  35171. if ('since' === $operator || 'after' === $operator) {
  35172. $operator = '>';
  35173. }
  35174. if ('until' === $operator || 'before' === $operator) {
  35175. $operator = '<';
  35176. }
  35177. $this->setOperator($operator);
  35178. $this->setTarget($target);
  35179. }
  35180. }
  35181. <?php
  35182. namespace Symfony\Component\Finder\Comparator;
  35183. class NumberComparator extends Comparator
  35184. {
  35185. public function __construct($test)
  35186. {
  35187. if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  35188. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
  35189. }
  35190. $target = $matches[2];
  35191. if (!is_numeric($target)) {
  35192. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  35193. }
  35194. if (isset($matches[3])) {
  35195. switch (strtolower($matches[3])) {
  35196. case 'k':
  35197. $target *= 1000;
  35198. break;
  35199. case 'ki':
  35200. $target *= 1024;
  35201. break;
  35202. case 'm':
  35203. $target *= 1000000;
  35204. break;
  35205. case 'mi':
  35206. $target *= 1024 * 1024;
  35207. break;
  35208. case 'g':
  35209. $target *= 1000000000;
  35210. break;
  35211. case 'gi':
  35212. $target *= 1024 * 1024 * 1024;
  35213. break;
  35214. }
  35215. }
  35216. $this->setTarget($target);
  35217. $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
  35218. }
  35219. }
  35220. <?php
  35221. namespace Symfony\Component\Finder\Exception;
  35222. class AccessDeniedException extends \UnexpectedValueException
  35223. {
  35224. }
  35225. <?php
  35226. namespace Symfony\Component\Finder\Exception;
  35227. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  35228. use Symfony\Component\Finder\Adapter\AdapterInterface;
  35229. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  35230. {
  35231. private $adapter;
  35232. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  35233. {
  35234. $this->adapter = $adapter;
  35235. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  35236. }
  35237. public function getAdapter()
  35238. {
  35239. return $this->adapter;
  35240. }
  35241. }
  35242. <?php
  35243. namespace Symfony\Component\Finder\Exception;
  35244. interface ExceptionInterface
  35245. {
  35246. public function getAdapter();
  35247. }
  35248. <?php
  35249. namespace Symfony\Component\Finder\Exception;
  35250. @trigger_error('The '.__NAMESPACE__.'\OperationNotPermitedException class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  35251. class OperationNotPermitedException extends AdapterFailureException
  35252. {
  35253. }
  35254. <?php
  35255. namespace Symfony\Component\Finder\Exception;
  35256. @trigger_error('The '.__NAMESPACE__.'\ShellCommandFailureException class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  35257. use Symfony\Component\Finder\Adapter\AdapterInterface;
  35258. use Symfony\Component\Finder\Shell\Command;
  35259. class ShellCommandFailureException extends AdapterFailureException
  35260. {
  35261. private $command;
  35262. public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
  35263. {
  35264. $this->command = $command;
  35265. parent::__construct($adapter, 'Shell command failed: "'.$command->join().'".', $previous);
  35266. }
  35267. public function getCommand()
  35268. {
  35269. return $this->command;
  35270. }
  35271. }
  35272. <?php
  35273. namespace Symfony\Component\Finder\Expression;
  35274. @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  35275. class Expression implements ValueInterface
  35276. {
  35277. const TYPE_REGEX = 1;
  35278. const TYPE_GLOB = 2;
  35279. private $value;
  35280. public static function create($expr)
  35281. {
  35282. return new self($expr);
  35283. }
  35284. public function __construct($expr)
  35285. {
  35286. try {
  35287. $this->value = Regex::create($expr);
  35288. } catch (\InvalidArgumentException $e) {
  35289. $this->value = new Glob($expr);
  35290. }
  35291. }
  35292. public function __toString()
  35293. {
  35294. return $this->render();
  35295. }
  35296. public function render()
  35297. {
  35298. return $this->value->render();
  35299. }
  35300. public function renderPattern()
  35301. {
  35302. return $this->value->renderPattern();
  35303. }
  35304. public function isCaseSensitive()
  35305. {
  35306. return $this->value->isCaseSensitive();
  35307. }
  35308. public function getType()
  35309. {
  35310. return $this->value->getType();
  35311. }
  35312. public function prepend($expr)
  35313. {
  35314. $this->value->prepend($expr);
  35315. return $this;
  35316. }
  35317. public function append($expr)
  35318. {
  35319. $this->value->append($expr);
  35320. return $this;
  35321. }
  35322. public function isRegex()
  35323. {
  35324. return self::TYPE_REGEX === $this->value->getType();
  35325. }
  35326. public function isGlob()
  35327. {
  35328. return self::TYPE_GLOB === $this->value->getType();
  35329. }
  35330. public function getGlob()
  35331. {
  35332. if (self::TYPE_GLOB !== $this->value->getType()) {
  35333. throw new \LogicException('Regex can\'t be transformed to glob.');
  35334. }
  35335. return $this->value;
  35336. }
  35337. public function getRegex()
  35338. {
  35339. return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
  35340. }
  35341. }
  35342. <?php
  35343. namespace Symfony\Component\Finder\Expression;
  35344. @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  35345. use Symfony\Component\Finder\Glob as FinderGlob;
  35346. class Glob implements ValueInterface
  35347. {
  35348. private $pattern;
  35349. public function __construct($pattern)
  35350. {
  35351. $this->pattern = $pattern;
  35352. }
  35353. public function render()
  35354. {
  35355. return $this->pattern;
  35356. }
  35357. public function renderPattern()
  35358. {
  35359. return $this->pattern;
  35360. }
  35361. public function getType()
  35362. {
  35363. return Expression::TYPE_GLOB;
  35364. }
  35365. public function isCaseSensitive()
  35366. {
  35367. return true;
  35368. }
  35369. public function prepend($expr)
  35370. {
  35371. $this->pattern = $expr.$this->pattern;
  35372. return $this;
  35373. }
  35374. public function append($expr)
  35375. {
  35376. $this->pattern .= $expr;
  35377. return $this;
  35378. }
  35379. public function isExpandable()
  35380. {
  35381. return false !== strpos($this->pattern, '{')
  35382. && false !== strpos($this->pattern, '}');
  35383. }
  35384. public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
  35385. {
  35386. $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
  35387. return new Regex($regex);
  35388. }
  35389. }
  35390. <?php
  35391. namespace Symfony\Component\Finder\Expression;
  35392. @trigger_error('The '.__NAMESPACE__.'\Regex class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  35393. class Regex implements ValueInterface
  35394. {
  35395. const START_FLAG = '^';
  35396. const END_FLAG = '$';
  35397. const BOUNDARY = '~';
  35398. const JOKER = '.*';
  35399. const ESCAPING = '\\';
  35400. private $pattern;
  35401. private $options;
  35402. private $startFlag;
  35403. private $endFlag;
  35404. private $startJoker;
  35405. private $endJoker;
  35406. public static function create($expr)
  35407. {
  35408. if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {
  35409. $start = substr($m[1], 0, 1);
  35410. $end = substr($m[1], -1);
  35411. if (
  35412. ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))
  35413. || ($start === '{' && $end === '}')
  35414. || ($start === '(' && $end === ')')
  35415. ) {
  35416. return new self(substr($m[1], 1, -1), $m[2], $end);
  35417. }
  35418. }
  35419. throw new \InvalidArgumentException('Given expression is not a regex.');
  35420. }
  35421. public function __construct($pattern, $options = '', $delimiter = null)
  35422. {
  35423. if (null !== $delimiter) {
  35424. $pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
  35425. }
  35426. $this->parsePattern($pattern);
  35427. $this->options = $options;
  35428. }
  35429. public function __toString()
  35430. {
  35431. return $this->render();
  35432. }
  35433. public function render()
  35434. {
  35435. return self::BOUNDARY
  35436. .$this->renderPattern()
  35437. .self::BOUNDARY
  35438. .$this->options;
  35439. }
  35440. public function renderPattern()
  35441. {
  35442. return ($this->startFlag ? self::START_FLAG : '')
  35443. .($this->startJoker ? self::JOKER : '')
  35444. .str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
  35445. .($this->endJoker ? self::JOKER : '')
  35446. .($this->endFlag ? self::END_FLAG : '');
  35447. }
  35448. public function isCaseSensitive()
  35449. {
  35450. return !$this->hasOption('i');
  35451. }
  35452. public function getType()
  35453. {
  35454. return Expression::TYPE_REGEX;
  35455. }
  35456. public function prepend($expr)
  35457. {
  35458. $this->pattern = $expr.$this->pattern;
  35459. return $this;
  35460. }
  35461. public function append($expr)
  35462. {
  35463. $this->pattern .= $expr;
  35464. return $this;
  35465. }
  35466. public function hasOption($option)
  35467. {
  35468. return false !== strpos($this->options, $option);
  35469. }
  35470. public function addOption($option)
  35471. {
  35472. if (!$this->hasOption($option)) {
  35473. $this->options .= $option;
  35474. }
  35475. return $this;
  35476. }
  35477. public function removeOption($option)
  35478. {
  35479. $this->options = str_replace($option, '', $this->options);
  35480. return $this;
  35481. }
  35482. public function setStartFlag($startFlag)
  35483. {
  35484. $this->startFlag = $startFlag;
  35485. return $this;
  35486. }
  35487. public function hasStartFlag()
  35488. {
  35489. return $this->startFlag;
  35490. }
  35491. public function setEndFlag($endFlag)
  35492. {
  35493. $this->endFlag = (bool) $endFlag;
  35494. return $this;
  35495. }
  35496. public function hasEndFlag()
  35497. {
  35498. return $this->endFlag;
  35499. }
  35500. public function setStartJoker($startJoker)
  35501. {
  35502. $this->startJoker = $startJoker;
  35503. return $this;
  35504. }
  35505. public function hasStartJoker()
  35506. {
  35507. return $this->startJoker;
  35508. }
  35509. public function setEndJoker($endJoker)
  35510. {
  35511. $this->endJoker = (bool) $endJoker;
  35512. return $this;
  35513. }
  35514. public function hasEndJoker()
  35515. {
  35516. return $this->endJoker;
  35517. }
  35518. public function replaceJokers($replacement)
  35519. {
  35520. $replace = function ($subject) use ($replacement) {
  35521. $subject = $subject[0];
  35522. $replace = 0 === substr_count($subject, '\\') % 2;
  35523. return $replace ? str_replace('.', $replacement, $subject) : $subject;
  35524. };
  35525. $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);
  35526. return $this;
  35527. }
  35528. private function parsePattern($pattern)
  35529. {
  35530. if ($this->startFlag = self::START_FLAG === substr($pattern, 0, 1)) {
  35531. $pattern = substr($pattern, 1);
  35532. }
  35533. if ($this->startJoker = self::JOKER === substr($pattern, 0, 2)) {
  35534. $pattern = substr($pattern, 2);
  35535. }
  35536. if ($this->endFlag = (self::END_FLAG === substr($pattern, -1) && self::ESCAPING !== substr($pattern, -2, -1))) {
  35537. $pattern = substr($pattern, 0, -1);
  35538. }
  35539. if ($this->endJoker = (self::JOKER === substr($pattern, -2) && self::ESCAPING !== substr($pattern, -3, -2))) {
  35540. $pattern = substr($pattern, 0, -2);
  35541. }
  35542. $this->pattern = $pattern;
  35543. }
  35544. }
  35545. <?php
  35546. namespace Symfony\Component\Finder\Expression;
  35547. @trigger_error('The '.__NAMESPACE__.'\ValueInterface interface is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  35548. interface ValueInterface
  35549. {
  35550. public function render();
  35551. public function renderPattern();
  35552. public function isCaseSensitive();
  35553. public function getType();
  35554. public function prepend($expr);
  35555. public function append($expr);
  35556. }
  35557. <?php
  35558. namespace Symfony\Component\Finder;
  35559. use Symfony\Component\Finder\Adapter\AdapterInterface;
  35560. use Symfony\Component\Finder\Adapter\GnuFindAdapter;
  35561. use Symfony\Component\Finder\Adapter\BsdFindAdapter;
  35562. use Symfony\Component\Finder\Adapter\PhpAdapter;
  35563. use Symfony\Component\Finder\Comparator\DateComparator;
  35564. use Symfony\Component\Finder\Comparator\NumberComparator;
  35565. use Symfony\Component\Finder\Exception\ExceptionInterface;
  35566. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  35567. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  35568. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  35569. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  35570. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  35571. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  35572. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  35573. use Symfony\Component\Finder\Iterator\SortableIterator;
  35574. class Finder implements \IteratorAggregate, \Countable
  35575. {
  35576. const IGNORE_VCS_FILES = 1;
  35577. const IGNORE_DOT_FILES = 2;
  35578. private $mode = 0;
  35579. private $names = array();
  35580. private $notNames = array();
  35581. private $exclude = array();
  35582. private $filters = array();
  35583. private $depths = array();
  35584. private $sizes = array();
  35585. private $followLinks = false;
  35586. private $sort = false;
  35587. private $ignore = 0;
  35588. private $dirs = array();
  35589. private $dates = array();
  35590. private $iterators = array();
  35591. private $contains = array();
  35592. private $notContains = array();
  35593. private $adapters = null;
  35594. private $paths = array();
  35595. private $notPaths = array();
  35596. private $ignoreUnreadableDirs = false;
  35597. private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
  35598. public function __construct()
  35599. {
  35600. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  35601. }
  35602. public static function create()
  35603. {
  35604. return new static();
  35605. }
  35606. public function addAdapter(AdapterInterface $adapter, $priority = 0)
  35607. {
  35608. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  35609. $this->initDefaultAdapters();
  35610. $this->adapters[$adapter->getName()] = array(
  35611. 'adapter' => $adapter,
  35612. 'priority' => $priority,
  35613. 'selected' => false,
  35614. );
  35615. return $this->sortAdapters();
  35616. }
  35617. public function useBestAdapter()
  35618. {
  35619. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  35620. $this->initDefaultAdapters();
  35621. $this->resetAdapterSelection();
  35622. return $this->sortAdapters();
  35623. }
  35624. public function setAdapter($name)
  35625. {
  35626. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  35627. $this->initDefaultAdapters();
  35628. if (!isset($this->adapters[$name])) {
  35629. throw new \InvalidArgumentException(sprintf('Adapter "%s" does not exist.', $name));
  35630. }
  35631. $this->resetAdapterSelection();
  35632. $this->adapters[$name]['selected'] = true;
  35633. return $this->sortAdapters();
  35634. }
  35635. public function removeAdapters()
  35636. {
  35637. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  35638. $this->adapters = array();
  35639. return $this;
  35640. }
  35641. public function getAdapters()
  35642. {
  35643. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  35644. $this->initDefaultAdapters();
  35645. return array_values(array_map(function (array $adapter) {
  35646. return $adapter['adapter'];
  35647. }, $this->adapters));
  35648. }
  35649. public function directories()
  35650. {
  35651. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  35652. return $this;
  35653. }
  35654. public function files()
  35655. {
  35656. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  35657. return $this;
  35658. }
  35659. public function depth($level)
  35660. {
  35661. $this->depths[] = new Comparator\NumberComparator($level);
  35662. return $this;
  35663. }
  35664. public function date($date)
  35665. {
  35666. $this->dates[] = new Comparator\DateComparator($date);
  35667. return $this;
  35668. }
  35669. public function name($pattern)
  35670. {
  35671. $this->names[] = $pattern;
  35672. return $this;
  35673. }
  35674. public function notName($pattern)
  35675. {
  35676. $this->notNames[] = $pattern;
  35677. return $this;
  35678. }
  35679. public function contains($pattern)
  35680. {
  35681. $this->contains[] = $pattern;
  35682. return $this;
  35683. }
  35684. public function notContains($pattern)
  35685. {
  35686. $this->notContains[] = $pattern;
  35687. return $this;
  35688. }
  35689. public function path($pattern)
  35690. {
  35691. $this->paths[] = $pattern;
  35692. return $this;
  35693. }
  35694. public function notPath($pattern)
  35695. {
  35696. $this->notPaths[] = $pattern;
  35697. return $this;
  35698. }
  35699. public function size($size)
  35700. {
  35701. $this->sizes[] = new Comparator\NumberComparator($size);
  35702. return $this;
  35703. }
  35704. public function exclude($dirs)
  35705. {
  35706. $this->exclude = array_merge($this->exclude, (array) $dirs);
  35707. return $this;
  35708. }
  35709. public function ignoreDotFiles($ignoreDotFiles)
  35710. {
  35711. if ($ignoreDotFiles) {
  35712. $this->ignore |= static::IGNORE_DOT_FILES;
  35713. } else {
  35714. $this->ignore &= ~static::IGNORE_DOT_FILES;
  35715. }
  35716. return $this;
  35717. }
  35718. public function ignoreVCS($ignoreVCS)
  35719. {
  35720. if ($ignoreVCS) {
  35721. $this->ignore |= static::IGNORE_VCS_FILES;
  35722. } else {
  35723. $this->ignore &= ~static::IGNORE_VCS_FILES;
  35724. }
  35725. return $this;
  35726. }
  35727. public static function addVCSPattern($pattern)
  35728. {
  35729. foreach ((array) $pattern as $p) {
  35730. self::$vcsPatterns[] = $p;
  35731. }
  35732. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  35733. }
  35734. public function sort(\Closure $closure)
  35735. {
  35736. $this->sort = $closure;
  35737. return $this;
  35738. }
  35739. public function sortByName()
  35740. {
  35741. $this->sort = Iterator\SortableIterator::SORT_BY_NAME;
  35742. return $this;
  35743. }
  35744. public function sortByType()
  35745. {
  35746. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  35747. return $this;
  35748. }
  35749. public function sortByAccessedTime()
  35750. {
  35751. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  35752. return $this;
  35753. }
  35754. public function sortByChangedTime()
  35755. {
  35756. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  35757. return $this;
  35758. }
  35759. public function sortByModifiedTime()
  35760. {
  35761. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  35762. return $this;
  35763. }
  35764. public function filter(\Closure $closure)
  35765. {
  35766. $this->filters[] = $closure;
  35767. return $this;
  35768. }
  35769. public function followLinks()
  35770. {
  35771. $this->followLinks = true;
  35772. return $this;
  35773. }
  35774. public function ignoreUnreadableDirs($ignore = true)
  35775. {
  35776. $this->ignoreUnreadableDirs = (bool) $ignore;
  35777. return $this;
  35778. }
  35779. public function in($dirs)
  35780. {
  35781. $resolvedDirs = array();
  35782. foreach ((array) $dirs as $dir) {
  35783. if (is_dir($dir)) {
  35784. $resolvedDirs[] = $dir;
  35785. } elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
  35786. $resolvedDirs = array_merge($resolvedDirs, $glob);
  35787. } else {
  35788. throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
  35789. }
  35790. }
  35791. $this->dirs = array_merge($this->dirs, $resolvedDirs);
  35792. return $this;
  35793. }
  35794. public function getIterator()
  35795. {
  35796. if (0 === count($this->dirs) && 0 === count($this->iterators)) {
  35797. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  35798. }
  35799. if (1 === count($this->dirs) && 0 === count($this->iterators)) {
  35800. return $this->searchInDirectory($this->dirs[0]);
  35801. }
  35802. $iterator = new \AppendIterator();
  35803. foreach ($this->dirs as $dir) {
  35804. $iterator->append($this->searchInDirectory($dir));
  35805. }
  35806. foreach ($this->iterators as $it) {
  35807. $iterator->append($it);
  35808. }
  35809. return $iterator;
  35810. }
  35811. public function append($iterator)
  35812. {
  35813. if ($iterator instanceof \IteratorAggregate) {
  35814. $this->iterators[] = $iterator->getIterator();
  35815. } elseif ($iterator instanceof \Iterator) {
  35816. $this->iterators[] = $iterator;
  35817. } elseif ($iterator instanceof \Traversable || is_array($iterator)) {
  35818. $it = new \ArrayIterator();
  35819. foreach ($iterator as $file) {
  35820. $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
  35821. }
  35822. $this->iterators[] = $it;
  35823. } else {
  35824. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  35825. }
  35826. return $this;
  35827. }
  35828. public function count()
  35829. {
  35830. return iterator_count($this->getIterator());
  35831. }
  35832. private function sortAdapters()
  35833. {
  35834. uasort($this->adapters, function (array $a, array $b) {
  35835. if ($a['selected'] || $b['selected']) {
  35836. return $a['selected'] ? -1 : 1;
  35837. }
  35838. return $a['priority'] > $b['priority'] ? -1 : 1;
  35839. });
  35840. return $this;
  35841. }
  35842. private function searchInDirectory($dir)
  35843. {
  35844. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  35845. $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
  35846. }
  35847. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  35848. $this->notPaths[] = '#(^|/)\..+(/|$)#';
  35849. }
  35850. if ($this->adapters) {
  35851. foreach ($this->adapters as $adapter) {
  35852. if ($adapter['adapter']->isSupported()) {
  35853. try {
  35854. return $this
  35855. ->buildAdapter($adapter['adapter'])
  35856. ->searchInDirectory($dir);
  35857. } catch (ExceptionInterface $e) {
  35858. }
  35859. }
  35860. }
  35861. }
  35862. $minDepth = 0;
  35863. $maxDepth = PHP_INT_MAX;
  35864. foreach ($this->depths as $comparator) {
  35865. switch ($comparator->getOperator()) {
  35866. case '>':
  35867. $minDepth = $comparator->getTarget() + 1;
  35868. break;
  35869. case '>=':
  35870. $minDepth = $comparator->getTarget();
  35871. break;
  35872. case '<':
  35873. $maxDepth = $comparator->getTarget() - 1;
  35874. break;
  35875. case '<=':
  35876. $maxDepth = $comparator->getTarget();
  35877. break;
  35878. default:
  35879. $minDepth = $maxDepth = $comparator->getTarget();
  35880. }
  35881. }
  35882. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  35883. if ($this->followLinks) {
  35884. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  35885. }
  35886. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  35887. if ($this->exclude) {
  35888. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  35889. }
  35890. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  35891. if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
  35892. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  35893. }
  35894. if ($this->mode) {
  35895. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  35896. }
  35897. if ($this->names || $this->notNames) {
  35898. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  35899. }
  35900. if ($this->contains || $this->notContains) {
  35901. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  35902. }
  35903. if ($this->sizes) {
  35904. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  35905. }
  35906. if ($this->dates) {
  35907. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  35908. }
  35909. if ($this->filters) {
  35910. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  35911. }
  35912. if ($this->paths || $this->notPaths) {
  35913. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  35914. }
  35915. if ($this->sort) {
  35916. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  35917. $iterator = $iteratorAggregate->getIterator();
  35918. }
  35919. return $iterator;
  35920. }
  35921. private function buildAdapter(AdapterInterface $adapter)
  35922. {
  35923. return $adapter
  35924. ->setFollowLinks($this->followLinks)
  35925. ->setDepths($this->depths)
  35926. ->setMode($this->mode)
  35927. ->setExclude($this->exclude)
  35928. ->setNames($this->names)
  35929. ->setNotNames($this->notNames)
  35930. ->setContains($this->contains)
  35931. ->setNotContains($this->notContains)
  35932. ->setSizes($this->sizes)
  35933. ->setDates($this->dates)
  35934. ->setFilters($this->filters)
  35935. ->setSort($this->sort)
  35936. ->setPath($this->paths)
  35937. ->setNotPath($this->notPaths)
  35938. ->ignoreUnreadableDirs($this->ignoreUnreadableDirs);
  35939. }
  35940. private function resetAdapterSelection()
  35941. {
  35942. $this->adapters = array_map(function (array $properties) {
  35943. $properties['selected'] = false;
  35944. return $properties;
  35945. }, $this->adapters);
  35946. }
  35947. private function initDefaultAdapters()
  35948. {
  35949. if (null === $this->adapters) {
  35950. $this->adapters = array();
  35951. $this
  35952. ->addAdapter(new GnuFindAdapter())
  35953. ->addAdapter(new BsdFindAdapter())
  35954. ->addAdapter(new PhpAdapter(), -50)
  35955. ->setAdapter('php')
  35956. ;
  35957. }
  35958. }
  35959. }
  35960. <?php
  35961. namespace Symfony\Component\Finder;
  35962. class Glob
  35963. {
  35964. public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
  35965. {
  35966. $firstByte = true;
  35967. $escaping = false;
  35968. $inCurlies = 0;
  35969. $regex = '';
  35970. $sizeGlob = strlen($glob);
  35971. for ($i = 0; $i < $sizeGlob; ++$i) {
  35972. $car = $glob[$i];
  35973. if ($firstByte) {
  35974. if ($strictLeadingDot && '.' !== $car) {
  35975. $regex .= '(?=[^\.])';
  35976. }
  35977. $firstByte = false;
  35978. }
  35979. if ('/' === $car) {
  35980. $firstByte = true;
  35981. }
  35982. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  35983. $regex .= "\\$car";
  35984. } elseif ('*' === $car) {
  35985. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  35986. } elseif ('?' === $car) {
  35987. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  35988. } elseif ('{' === $car) {
  35989. $regex .= $escaping ? '\\{' : '(';
  35990. if (!$escaping) {
  35991. ++$inCurlies;
  35992. }
  35993. } elseif ('}' === $car && $inCurlies) {
  35994. $regex .= $escaping ? '}' : ')';
  35995. if (!$escaping) {
  35996. --$inCurlies;
  35997. }
  35998. } elseif (',' === $car && $inCurlies) {
  35999. $regex .= $escaping ? ',' : '|';
  36000. } elseif ('\\' === $car) {
  36001. if ($escaping) {
  36002. $regex .= '\\\\';
  36003. $escaping = false;
  36004. } else {
  36005. $escaping = true;
  36006. }
  36007. continue;
  36008. } else {
  36009. $regex .= $car;
  36010. }
  36011. $escaping = false;
  36012. }
  36013. return $delimiter.'^'.$regex.'$'.$delimiter;
  36014. }
  36015. }
  36016. <?php
  36017. namespace Symfony\Component\Finder\Iterator;
  36018. class CustomFilterIterator extends FilterIterator
  36019. {
  36020. private $filters = array();
  36021. public function __construct(\Iterator $iterator, array $filters)
  36022. {
  36023. foreach ($filters as $filter) {
  36024. if (!is_callable($filter)) {
  36025. throw new \InvalidArgumentException('Invalid PHP callback.');
  36026. }
  36027. }
  36028. $this->filters = $filters;
  36029. parent::__construct($iterator);
  36030. }
  36031. public function accept()
  36032. {
  36033. $fileinfo = $this->current();
  36034. foreach ($this->filters as $filter) {
  36035. if (false === call_user_func($filter, $fileinfo)) {
  36036. return false;
  36037. }
  36038. }
  36039. return true;
  36040. }
  36041. }
  36042. <?php
  36043. namespace Symfony\Component\Finder\Iterator;
  36044. use Symfony\Component\Finder\Comparator\DateComparator;
  36045. class DateRangeFilterIterator extends FilterIterator
  36046. {
  36047. private $comparators = array();
  36048. public function __construct(\Iterator $iterator, array $comparators)
  36049. {
  36050. $this->comparators = $comparators;
  36051. parent::__construct($iterator);
  36052. }
  36053. public function accept()
  36054. {
  36055. $fileinfo = $this->current();
  36056. if (!file_exists($fileinfo->getRealPath())) {
  36057. return false;
  36058. }
  36059. $filedate = $fileinfo->getMTime();
  36060. foreach ($this->comparators as $compare) {
  36061. if (!$compare->test($filedate)) {
  36062. return false;
  36063. }
  36064. }
  36065. return true;
  36066. }
  36067. }
  36068. <?php
  36069. namespace Symfony\Component\Finder\Iterator;
  36070. class DepthRangeFilterIterator extends FilterIterator
  36071. {
  36072. private $minDepth = 0;
  36073. public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
  36074. {
  36075. $this->minDepth = $minDepth;
  36076. $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  36077. parent::__construct($iterator);
  36078. }
  36079. public function accept()
  36080. {
  36081. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  36082. }
  36083. }
  36084. <?php
  36085. namespace Symfony\Component\Finder\Iterator;
  36086. class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator
  36087. {
  36088. private $iterator;
  36089. private $isRecursive;
  36090. private $excludedDirs = array();
  36091. private $excludedPattern;
  36092. public function __construct(\Iterator $iterator, array $directories)
  36093. {
  36094. $this->iterator = $iterator;
  36095. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  36096. $patterns = array();
  36097. foreach ($directories as $directory) {
  36098. if (!$this->isRecursive || false !== strpos($directory, '/')) {
  36099. $patterns[] = preg_quote($directory, '#');
  36100. } else {
  36101. $this->excludedDirs[$directory] = true;
  36102. }
  36103. }
  36104. if ($patterns) {
  36105. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  36106. }
  36107. parent::__construct($iterator);
  36108. }
  36109. public function accept()
  36110. {
  36111. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  36112. return false;
  36113. }
  36114. if ($this->excludedPattern) {
  36115. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  36116. $path = str_replace('\\', '/', $path);
  36117. return !preg_match($this->excludedPattern, $path);
  36118. }
  36119. return true;
  36120. }
  36121. public function hasChildren()
  36122. {
  36123. return $this->isRecursive && $this->iterator->hasChildren();
  36124. }
  36125. public function getChildren()
  36126. {
  36127. $children = new self($this->iterator->getChildren(), array());
  36128. $children->excludedDirs = $this->excludedDirs;
  36129. $children->excludedPattern = $this->excludedPattern;
  36130. return $children;
  36131. }
  36132. }
  36133. <?php
  36134. namespace Symfony\Component\Finder\Iterator;
  36135. @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  36136. use Symfony\Component\Finder\SplFileInfo;
  36137. class FilePathsIterator extends \ArrayIterator
  36138. {
  36139. private $baseDir;
  36140. private $baseDirLength;
  36141. private $subPath;
  36142. private $subPathname;
  36143. private $current;
  36144. public function __construct(array $paths, $baseDir)
  36145. {
  36146. $this->baseDir = $baseDir;
  36147. $this->baseDirLength = strlen($baseDir);
  36148. parent::__construct($paths);
  36149. }
  36150. public function __call($name, array $arguments)
  36151. {
  36152. return call_user_func_array(array($this->current(), $name), $arguments);
  36153. }
  36154. public function current()
  36155. {
  36156. return $this->current;
  36157. }
  36158. public function key()
  36159. {
  36160. return $this->current->getPathname();
  36161. }
  36162. public function next()
  36163. {
  36164. parent::next();
  36165. $this->buildProperties();
  36166. }
  36167. public function rewind()
  36168. {
  36169. parent::rewind();
  36170. $this->buildProperties();
  36171. }
  36172. public function getSubPath()
  36173. {
  36174. return $this->subPath;
  36175. }
  36176. public function getSubPathname()
  36177. {
  36178. return $this->subPathname;
  36179. }
  36180. private function buildProperties()
  36181. {
  36182. $absolutePath = parent::current();
  36183. if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
  36184. $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
  36185. $dir = dirname($this->subPathname);
  36186. $this->subPath = '.' === $dir ? '' : $dir;
  36187. } else {
  36188. $this->subPath = $this->subPathname = '';
  36189. }
  36190. $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
  36191. }
  36192. }
  36193. <?php
  36194. namespace Symfony\Component\Finder\Iterator;
  36195. class FileTypeFilterIterator extends FilterIterator
  36196. {
  36197. const ONLY_FILES = 1;
  36198. const ONLY_DIRECTORIES = 2;
  36199. private $mode;
  36200. public function __construct(\Iterator $iterator, $mode)
  36201. {
  36202. $this->mode = $mode;
  36203. parent::__construct($iterator);
  36204. }
  36205. public function accept()
  36206. {
  36207. $fileinfo = $this->current();
  36208. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  36209. return false;
  36210. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  36211. return false;
  36212. }
  36213. return true;
  36214. }
  36215. }
  36216. <?php
  36217. namespace Symfony\Component\Finder\Iterator;
  36218. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  36219. {
  36220. public function accept()
  36221. {
  36222. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  36223. return true;
  36224. }
  36225. $fileinfo = $this->current();
  36226. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  36227. return false;
  36228. }
  36229. $content = $fileinfo->getContents();
  36230. if (!$content) {
  36231. return false;
  36232. }
  36233. return $this->isAccepted($content);
  36234. }
  36235. protected function toRegex($str)
  36236. {
  36237. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  36238. }
  36239. }
  36240. <?php
  36241. namespace Symfony\Component\Finder\Iterator;
  36242. use Symfony\Component\Finder\Glob;
  36243. class FilenameFilterIterator extends MultiplePcreFilterIterator
  36244. {
  36245. public function accept()
  36246. {
  36247. return $this->isAccepted($this->current()->getFilename());
  36248. }
  36249. protected function toRegex($str)
  36250. {
  36251. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  36252. }
  36253. }
  36254. <?php
  36255. namespace Symfony\Component\Finder\Iterator;
  36256. abstract class FilterIterator extends \FilterIterator
  36257. {
  36258. public function rewind()
  36259. {
  36260. if (PHP_VERSION_ID > 50607 || (PHP_VERSION_ID > 50523 && PHP_VERSION_ID < 50600)) {
  36261. parent::rewind();
  36262. return;
  36263. }
  36264. $iterator = $this;
  36265. while ($iterator instanceof \OuterIterator) {
  36266. $innerIterator = $iterator->getInnerIterator();
  36267. if ($innerIterator instanceof RecursiveDirectoryIterator) {
  36268. if ($innerIterator->isRewindable()) {
  36269. $innerIterator->next();
  36270. $innerIterator->rewind();
  36271. }
  36272. } elseif ($innerIterator instanceof \FilesystemIterator) {
  36273. $innerIterator->next();
  36274. $innerIterator->rewind();
  36275. }
  36276. $iterator = $innerIterator;
  36277. }
  36278. parent::rewind();
  36279. }
  36280. }
  36281. <?php
  36282. namespace Symfony\Component\Finder\Iterator;
  36283. abstract class MultiplePcreFilterIterator extends FilterIterator
  36284. {
  36285. protected $matchRegexps = array();
  36286. protected $noMatchRegexps = array();
  36287. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  36288. {
  36289. foreach ($matchPatterns as $pattern) {
  36290. $this->matchRegexps[] = $this->toRegex($pattern);
  36291. }
  36292. foreach ($noMatchPatterns as $pattern) {
  36293. $this->noMatchRegexps[] = $this->toRegex($pattern);
  36294. }
  36295. parent::__construct($iterator);
  36296. }
  36297. protected function isAccepted($string)
  36298. {
  36299. foreach ($this->noMatchRegexps as $regex) {
  36300. if (preg_match($regex, $string)) {
  36301. return false;
  36302. }
  36303. }
  36304. if ($this->matchRegexps) {
  36305. foreach ($this->matchRegexps as $regex) {
  36306. if (preg_match($regex, $string)) {
  36307. return true;
  36308. }
  36309. }
  36310. return false;
  36311. }
  36312. return true;
  36313. }
  36314. protected function isRegex($str)
  36315. {
  36316. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  36317. $start = substr($m[1], 0, 1);
  36318. $end = substr($m[1], -1);
  36319. if ($start === $end) {
  36320. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  36321. }
  36322. foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
  36323. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  36324. return true;
  36325. }
  36326. }
  36327. }
  36328. return false;
  36329. }
  36330. abstract protected function toRegex($str);
  36331. }
  36332. <?php
  36333. namespace Symfony\Component\Finder\Iterator;
  36334. class PathFilterIterator extends MultiplePcreFilterIterator
  36335. {
  36336. public function accept()
  36337. {
  36338. $filename = $this->current()->getRelativePathname();
  36339. if ('\\' === DIRECTORY_SEPARATOR) {
  36340. $filename = str_replace('\\', '/', $filename);
  36341. }
  36342. return $this->isAccepted($filename);
  36343. }
  36344. protected function toRegex($str)
  36345. {
  36346. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  36347. }
  36348. }
  36349. <?php
  36350. namespace Symfony\Component\Finder\Iterator;
  36351. use Symfony\Component\Finder\Exception\AccessDeniedException;
  36352. use Symfony\Component\Finder\SplFileInfo;
  36353. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  36354. {
  36355. private $ignoreUnreadableDirs;
  36356. private $rewindable;
  36357. private $rootPath;
  36358. private $subPath;
  36359. private $directorySeparator = '/';
  36360. public function __construct($path, $flags, $ignoreUnreadableDirs = false)
  36361. {
  36362. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  36363. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  36364. }
  36365. parent::__construct($path, $flags);
  36366. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  36367. $this->rootPath = (string) $path;
  36368. if ('/' !== DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  36369. $this->directorySeparator = DIRECTORY_SEPARATOR;
  36370. }
  36371. }
  36372. public function current()
  36373. {
  36374. if (null === $subPathname = $this->subPath) {
  36375. $subPathname = $this->subPath = (string) $this->getSubPath();
  36376. }
  36377. if ('' !== $subPathname) {
  36378. $subPathname .= $this->directorySeparator;
  36379. }
  36380. $subPathname .= $this->getFilename();
  36381. return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
  36382. }
  36383. public function getChildren()
  36384. {
  36385. try {
  36386. $children = parent::getChildren();
  36387. if ($children instanceof self) {
  36388. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  36389. $children->rewindable = &$this->rewindable;
  36390. $children->rootPath = $this->rootPath;
  36391. }
  36392. return $children;
  36393. } catch (\UnexpectedValueException $e) {
  36394. if ($this->ignoreUnreadableDirs) {
  36395. return new \RecursiveArrayIterator(array());
  36396. } else {
  36397. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  36398. }
  36399. }
  36400. }
  36401. public function rewind()
  36402. {
  36403. if (false === $this->isRewindable()) {
  36404. return;
  36405. }
  36406. if (PHP_VERSION_ID < 50523 || PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50607) {
  36407. parent::next();
  36408. }
  36409. parent::rewind();
  36410. }
  36411. public function isRewindable()
  36412. {
  36413. if (null !== $this->rewindable) {
  36414. return $this->rewindable;
  36415. }
  36416. if (false !== $stream = @opendir($this->getPath())) {
  36417. $infos = stream_get_meta_data($stream);
  36418. closedir($stream);
  36419. if ($infos['seekable']) {
  36420. return $this->rewindable = true;
  36421. }
  36422. }
  36423. return $this->rewindable = false;
  36424. }
  36425. }
  36426. <?php
  36427. namespace Symfony\Component\Finder\Iterator;
  36428. use Symfony\Component\Finder\Comparator\NumberComparator;
  36429. class SizeRangeFilterIterator extends FilterIterator
  36430. {
  36431. private $comparators = array();
  36432. public function __construct(\Iterator $iterator, array $comparators)
  36433. {
  36434. $this->comparators = $comparators;
  36435. parent::__construct($iterator);
  36436. }
  36437. public function accept()
  36438. {
  36439. $fileinfo = $this->current();
  36440. if (!$fileinfo->isFile()) {
  36441. return true;
  36442. }
  36443. $filesize = $fileinfo->getSize();
  36444. foreach ($this->comparators as $compare) {
  36445. if (!$compare->test($filesize)) {
  36446. return false;
  36447. }
  36448. }
  36449. return true;
  36450. }
  36451. }
  36452. <?php
  36453. namespace Symfony\Component\Finder\Iterator;
  36454. class SortableIterator implements \IteratorAggregate
  36455. {
  36456. const SORT_BY_NAME = 1;
  36457. const SORT_BY_TYPE = 2;
  36458. const SORT_BY_ACCESSED_TIME = 3;
  36459. const SORT_BY_CHANGED_TIME = 4;
  36460. const SORT_BY_MODIFIED_TIME = 5;
  36461. private $iterator;
  36462. private $sort;
  36463. public function __construct(\Traversable $iterator, $sort)
  36464. {
  36465. $this->iterator = $iterator;
  36466. if (self::SORT_BY_NAME === $sort) {
  36467. $this->sort = function ($a, $b) {
  36468. return strcmp($a->getRealpath(), $b->getRealpath());
  36469. };
  36470. } elseif (self::SORT_BY_TYPE === $sort) {
  36471. $this->sort = function ($a, $b) {
  36472. if ($a->isDir() && $b->isFile()) {
  36473. return -1;
  36474. } elseif ($a->isFile() && $b->isDir()) {
  36475. return 1;
  36476. }
  36477. return strcmp($a->getRealpath(), $b->getRealpath());
  36478. };
  36479. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  36480. $this->sort = function ($a, $b) {
  36481. return $a->getATime() - $b->getATime();
  36482. };
  36483. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  36484. $this->sort = function ($a, $b) {
  36485. return $a->getCTime() - $b->getCTime();
  36486. };
  36487. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  36488. $this->sort = function ($a, $b) {
  36489. return $a->getMTime() - $b->getMTime();
  36490. };
  36491. } elseif (is_callable($sort)) {
  36492. $this->sort = $sort;
  36493. } else {
  36494. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  36495. }
  36496. }
  36497. public function getIterator()
  36498. {
  36499. $array = iterator_to_array($this->iterator, true);
  36500. uasort($array, $this->sort);
  36501. return new \ArrayIterator($array);
  36502. }
  36503. }
  36504. Copyright (c) 2004-2016 Fabien Potencier
  36505. Permission is hereby granted, free of charge, to any person obtaining a copy
  36506. of this software and associated documentation files (the "Software"), to deal
  36507. in the Software without restriction, including without limitation the rights
  36508. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  36509. copies of the Software, and to permit persons to whom the Software is furnished
  36510. to do so, subject to the following conditions:
  36511. The above copyright notice and this permission notice shall be included in all
  36512. copies or substantial portions of the Software.
  36513. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  36514. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  36515. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  36516. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  36517. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  36518. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  36519. THE SOFTWARE.
  36520. <?php
  36521. namespace Symfony\Component\Finder\Shell;
  36522. @trigger_error('The '.__NAMESPACE__.'\Command class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  36523. class Command
  36524. {
  36525. private $parent;
  36526. private $bits = array();
  36527. private $labels = array();
  36528. private $errorHandler;
  36529. public function __construct(Command $parent = null)
  36530. {
  36531. $this->parent = $parent;
  36532. }
  36533. public function __toString()
  36534. {
  36535. return $this->join();
  36536. }
  36537. public static function create(Command $parent = null)
  36538. {
  36539. return new self($parent);
  36540. }
  36541. public static function escape($input)
  36542. {
  36543. return escapeshellcmd($input);
  36544. }
  36545. public static function quote($input)
  36546. {
  36547. return escapeshellarg($input);
  36548. }
  36549. public function add($bit)
  36550. {
  36551. $this->bits[] = $bit;
  36552. return $this;
  36553. }
  36554. public function top($bit)
  36555. {
  36556. array_unshift($this->bits, $bit);
  36557. foreach ($this->labels as $label => $index) {
  36558. $this->labels[$label] += 1;
  36559. }
  36560. return $this;
  36561. }
  36562. public function arg($arg)
  36563. {
  36564. $this->bits[] = self::quote($arg);
  36565. return $this;
  36566. }
  36567. public function cmd($esc)
  36568. {
  36569. $this->bits[] = self::escape($esc);
  36570. return $this;
  36571. }
  36572. public function ins($label)
  36573. {
  36574. if (isset($this->labels[$label])) {
  36575. throw new \RuntimeException(sprintf('Label "%s" already exists.', $label));
  36576. }
  36577. $this->bits[] = self::create($this);
  36578. $this->labels[$label] = count($this->bits) - 1;
  36579. return $this->bits[$this->labels[$label]];
  36580. }
  36581. public function get($label)
  36582. {
  36583. if (!isset($this->labels[$label])) {
  36584. throw new \RuntimeException(sprintf('Label "%s" does not exist.', $label));
  36585. }
  36586. return $this->bits[$this->labels[$label]];
  36587. }
  36588. public function end()
  36589. {
  36590. if (null === $this->parent) {
  36591. throw new \RuntimeException('Calling end on root command doesn\'t make sense.');
  36592. }
  36593. return $this->parent;
  36594. }
  36595. public function length()
  36596. {
  36597. return count($this->bits);
  36598. }
  36599. public function setErrorHandler(\Closure $errorHandler)
  36600. {
  36601. $this->errorHandler = $errorHandler;
  36602. return $this;
  36603. }
  36604. public function getErrorHandler()
  36605. {
  36606. return $this->errorHandler;
  36607. }
  36608. public function execute()
  36609. {
  36610. if (null === $errorHandler = $this->errorHandler) {
  36611. exec($this->join(), $output);
  36612. } else {
  36613. $process = proc_open($this->join(), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
  36614. $output = preg_split('~(\r\n|\r|\n)~', stream_get_contents($pipes[1]), -1, PREG_SPLIT_NO_EMPTY);
  36615. if ($error = stream_get_contents($pipes[2])) {
  36616. $errorHandler($error);
  36617. }
  36618. proc_close($process);
  36619. }
  36620. return $output ?: array();
  36621. }
  36622. public function join()
  36623. {
  36624. return implode(' ', array_filter(
  36625. array_map(function ($bit) {
  36626. return $bit instanceof Command ? $bit->join() : ($bit ?: null);
  36627. }, $this->bits),
  36628. function ($bit) { return null !== $bit; }
  36629. ));
  36630. }
  36631. public function addAtIndex($bit, $index)
  36632. {
  36633. array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
  36634. return $this;
  36635. }
  36636. }
  36637. <?php
  36638. namespace Symfony\Component\Finder\Shell;
  36639. @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  36640. class Shell
  36641. {
  36642. const TYPE_UNIX = 1;
  36643. const TYPE_DARWIN = 2;
  36644. const TYPE_CYGWIN = 3;
  36645. const TYPE_WINDOWS = 4;
  36646. const TYPE_BSD = 5;
  36647. private $type;
  36648. public function getType()
  36649. {
  36650. if (null === $this->type) {
  36651. $this->type = $this->guessType();
  36652. }
  36653. return $this->type;
  36654. }
  36655. public function testCommand($command)
  36656. {
  36657. if (!function_exists('exec')) {
  36658. return false;
  36659. }
  36660. $testCommand = 'which ';
  36661. if (self::TYPE_WINDOWS === $this->type) {
  36662. $testCommand = 'where ';
  36663. }
  36664. $command = escapeshellcmd($command);
  36665. exec($testCommand.$command, $output, $code);
  36666. return 0 === $code && count($output) > 0;
  36667. }
  36668. private function guessType()
  36669. {
  36670. $os = strtolower(PHP_OS);
  36671. if (false !== strpos($os, 'cygwin')) {
  36672. return self::TYPE_CYGWIN;
  36673. }
  36674. if (false !== strpos($os, 'darwin')) {
  36675. return self::TYPE_DARWIN;
  36676. }
  36677. if (false !== strpos($os, 'bsd')) {
  36678. return self::TYPE_BSD;
  36679. }
  36680. if (0 === strpos($os, 'win')) {
  36681. return self::TYPE_WINDOWS;
  36682. }
  36683. return self::TYPE_UNIX;
  36684. }
  36685. }
  36686. <?php
  36687. namespace Symfony\Component\Finder;
  36688. class SplFileInfo extends \SplFileInfo
  36689. {
  36690. private $relativePath;
  36691. private $relativePathname;
  36692. public function __construct($file, $relativePath, $relativePathname)
  36693. {
  36694. parent::__construct($file);
  36695. $this->relativePath = $relativePath;
  36696. $this->relativePathname = $relativePathname;
  36697. }
  36698. public function getRelativePath()
  36699. {
  36700. return $this->relativePath;
  36701. }
  36702. public function getRelativePathname()
  36703. {
  36704. return $this->relativePathname;
  36705. }
  36706. public function getContents()
  36707. {
  36708. $level = error_reporting(0);
  36709. $content = file_get_contents($this->getPathname());
  36710. error_reporting($level);
  36711. if (false === $content) {
  36712. $error = error_get_last();
  36713. throw new \RuntimeException($error['message']);
  36714. }
  36715. return $content;
  36716. }
  36717. }
  36718. Copyright (c) 2014-2016 Fabien Potencier
  36719. Permission is hereby granted, free of charge, to any person obtaining a copy
  36720. of this software and associated documentation files (the "Software"), to deal
  36721. in the Software without restriction, including without limitation the rights
  36722. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  36723. copies of the Software, and to permit persons to whom the Software is furnished
  36724. to do so, subject to the following conditions:
  36725. The above copyright notice and this permission notice shall be included in all
  36726. copies or substantial portions of the Software.
  36727. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  36728. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  36729. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  36730. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  36731. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  36732. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  36733. THE SOFTWARE.
  36734. <?php
  36735. namespace Symfony\Polyfill\Mbstring;
  36736. final class Mbstring
  36737. {
  36738. const MB_CASE_FOLD = PHP_INT_MAX;
  36739. private static $encodingList = array('ASCII', 'UTF-8');
  36740. private static $language = 'neutral';
  36741. private static $internalEncoding = 'UTF-8';
  36742. private static $caseFold = array(
  36743. array('µ','ſ',"\xCD\x85",'ς',"\xCF\x90","\xCF\x91","\xCF\x95","\xCF\x96","\xCF\xB0","\xCF\xB1","\xCF\xB5","\xE1\xBA\x9B","\xE1\xBE\xBE"),
  36744. array('μ','s','ι', 'σ','β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1",'ι'),
  36745. );
  36746. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  36747. {
  36748. if (is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
  36749. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  36750. } else {
  36751. $fromEncoding = self::getEncoding($fromEncoding);
  36752. }
  36753. $toEncoding = self::getEncoding($toEncoding);
  36754. if ('BASE64' === $fromEncoding) {
  36755. $s = base64_decode($s);
  36756. $fromEncoding = $toEncoding;
  36757. }
  36758. if ('BASE64' === $toEncoding) {
  36759. return base64_encode($s);
  36760. }
  36761. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  36762. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  36763. $fromEncoding = 'Windows-1252';
  36764. }
  36765. if ('UTF-8' !== $fromEncoding) {
  36766. $s = iconv($fromEncoding, 'UTF-8', $s);
  36767. }
  36768. return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
  36769. }
  36770. if ('HTML-ENTITIES' === $fromEncoding) {
  36771. $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
  36772. $fromEncoding = 'UTF-8';
  36773. }
  36774. return iconv($fromEncoding, $toEncoding, $s);
  36775. }
  36776. public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
  36777. {
  36778. $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
  36779. $ok = true;
  36780. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  36781. if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  36782. $ok = false;
  36783. }
  36784. });
  36785. return $ok ? $fromEncoding : false;
  36786. }
  36787. public static function mb_decode_mimeheader($s)
  36788. {
  36789. return iconv_mime_decode($s, 2, self::$internalEncoding);
  36790. }
  36791. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  36792. {
  36793. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
  36794. }
  36795. public static function mb_convert_case($s, $mode, $encoding = null)
  36796. {
  36797. if ('' === $s .= '') {
  36798. return '';
  36799. }
  36800. $encoding = self::getEncoding($encoding);
  36801. if ('UTF-8' === $encoding) {
  36802. $encoding = null;
  36803. } else {
  36804. $s = iconv($encoding, 'UTF-8', $s);
  36805. }
  36806. if (MB_CASE_TITLE == $mode) {
  36807. $s = preg_replace_callback('/\b\p{Ll}/u', array(__CLASS__, 'title_case_upper'), $s);
  36808. $s = preg_replace_callback('/\B[\p{Lu}\p{Lt}]+/u', array(__CLASS__, 'title_case_lower'), $s);
  36809. } else {
  36810. if (MB_CASE_UPPER == $mode) {
  36811. static $upper = null;
  36812. if (null === $upper) {
  36813. $upper = self::getData('upperCase');
  36814. }
  36815. $map = $upper;
  36816. } else {
  36817. if (self::MB_CASE_FOLD === $mode) {
  36818. $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
  36819. }
  36820. static $lower = null;
  36821. if (null === $lower) {
  36822. $lower = self::getData('lowerCase');
  36823. }
  36824. $map = $lower;
  36825. }
  36826. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  36827. $i = 0;
  36828. $len = strlen($s);
  36829. while ($i < $len) {
  36830. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  36831. $uchr = substr($s, $i, $ulen);
  36832. $i += $ulen;
  36833. if (isset($map[$uchr])) {
  36834. $uchr = $map[$uchr];
  36835. $nlen = strlen($uchr);
  36836. if ($nlen == $ulen) {
  36837. $nlen = $i;
  36838. do {
  36839. $s[--$nlen] = $uchr[--$ulen];
  36840. } while ($ulen);
  36841. } else {
  36842. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  36843. $len += $nlen - $ulen;
  36844. $i += $nlen - $ulen;
  36845. }
  36846. }
  36847. }
  36848. }
  36849. if (null === $encoding) {
  36850. return $s;
  36851. }
  36852. return iconv('UTF-8', $encoding, $s);
  36853. }
  36854. public static function mb_internal_encoding($encoding = null)
  36855. {
  36856. if (null === $encoding) {
  36857. return self::$internalEncoding;
  36858. }
  36859. $encoding = self::getEncoding($encoding);
  36860. if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
  36861. self::$internalEncoding = $encoding;
  36862. return true;
  36863. }
  36864. return false;
  36865. }
  36866. public static function mb_language($lang = null)
  36867. {
  36868. if (null === $lang) {
  36869. return self::$language;
  36870. }
  36871. switch ($lang = strtolower($lang)) {
  36872. case 'uni':
  36873. case 'neutral':
  36874. self::$language = $lang;
  36875. return true;
  36876. }
  36877. return false;
  36878. }
  36879. public static function mb_list_encodings()
  36880. {
  36881. return array('UTF-8');
  36882. }
  36883. public static function mb_encoding_aliases($encoding)
  36884. {
  36885. switch (strtoupper($encoding)) {
  36886. case 'UTF8':
  36887. case 'UTF-8':
  36888. return array('utf8');
  36889. }
  36890. return false;
  36891. }
  36892. public static function mb_check_encoding($var = null, $encoding = null)
  36893. {
  36894. if (null === $encoding) {
  36895. if (null === $var) {
  36896. return false;
  36897. }
  36898. $encoding = self::$internalEncoding;
  36899. }
  36900. return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
  36901. }
  36902. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  36903. {
  36904. if (null === $encodingList) {
  36905. $encodingList = self::$encodingList;
  36906. } else {
  36907. if (!is_array($encodingList)) {
  36908. $encodingList = array_map('trim', explode(',', $encodingList));
  36909. }
  36910. $encodingList = array_map('strtoupper', $encodingList);
  36911. }
  36912. foreach ($encodingList as $enc) {
  36913. switch ($enc) {
  36914. case 'ASCII':
  36915. if (!preg_match('/[\x80-\xFF]/', $str)) {
  36916. return $enc;
  36917. }
  36918. break;
  36919. case 'UTF8':
  36920. case 'UTF-8':
  36921. if (preg_match('//u', $str)) {
  36922. return 'UTF-8';
  36923. }
  36924. break;
  36925. default:
  36926. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  36927. return $enc;
  36928. }
  36929. }
  36930. }
  36931. return false;
  36932. }
  36933. public static function mb_detect_order($encodingList = null)
  36934. {
  36935. if (null === $encodingList) {
  36936. return self::$encodingList;
  36937. }
  36938. if (!is_array($encodingList)) {
  36939. $encodingList = array_map('trim', explode(',', $encodingList));
  36940. }
  36941. $encodingList = array_map('strtoupper', $encodingList);
  36942. foreach ($encodingList as $enc) {
  36943. switch ($enc) {
  36944. default:
  36945. if (strncmp($enc, 'ISO-8859-', 9)) {
  36946. return false;
  36947. }
  36948. case 'ASCII':
  36949. case 'UTF8':
  36950. case 'UTF-8':
  36951. }
  36952. }
  36953. self::$encodingList = $encodingList;
  36954. return true;
  36955. }
  36956. public static function mb_strlen($s, $encoding = null)
  36957. {
  36958. $encoding = self::getEncoding($encoding);
  36959. return iconv_strlen($s, $encoding);
  36960. }
  36961. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  36962. {
  36963. $encoding = self::getEncoding($encoding);
  36964. if ('' === $needle .= '') {
  36965. trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
  36966. return false;
  36967. }
  36968. return iconv_strpos($haystack, $needle, $offset, $encoding);
  36969. }
  36970. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  36971. {
  36972. $encoding = self::getEncoding($encoding);
  36973. if ($offset != (int) $offset) {
  36974. $offset = 0;
  36975. } elseif ($offset = (int) $offset) {
  36976. if ($offset < 0) {
  36977. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  36978. $offset = 0;
  36979. } else {
  36980. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  36981. }
  36982. }
  36983. $pos = iconv_strrpos($haystack, $needle, $encoding);
  36984. return false !== $pos ? $offset + $pos : false;
  36985. }
  36986. public static function mb_strtolower($s, $encoding = null)
  36987. {
  36988. return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
  36989. }
  36990. public static function mb_strtoupper($s, $encoding = null)
  36991. {
  36992. return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
  36993. }
  36994. public static function mb_substitute_character($c = null)
  36995. {
  36996. if (0 === strcasecmp($c, 'none')) {
  36997. return true;
  36998. }
  36999. return null !== $c ? false : 'none';
  37000. }
  37001. public static function mb_substr($s, $start, $length = null, $encoding = null)
  37002. {
  37003. $encoding = self::getEncoding($encoding);
  37004. if ($start < 0) {
  37005. $start = iconv_strlen($s, $encoding) + $start;
  37006. if ($start < 0) {
  37007. $start = 0;
  37008. }
  37009. }
  37010. if (null === $length) {
  37011. $length = 2147483647;
  37012. } elseif ($length < 0) {
  37013. $length = iconv_strlen($s, $encoding) + $length - $start;
  37014. if ($length < 0) {
  37015. return '';
  37016. }
  37017. }
  37018. return iconv_substr($s, $start, $length, $encoding).'';
  37019. }
  37020. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  37021. {
  37022. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  37023. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  37024. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  37025. }
  37026. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  37027. {
  37028. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  37029. return self::getSubpart($pos, $part, $haystack, $encoding);
  37030. }
  37031. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  37032. {
  37033. $encoding = self::getEncoding($encoding);
  37034. $needle = self::mb_substr($needle, 0, 1, $encoding);
  37035. $pos = iconv_strrpos($haystack, $needle, $encoding);
  37036. return self::getSubpart($pos, $part, $haystack, $encoding);
  37037. }
  37038. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  37039. {
  37040. $needle = self::mb_substr($needle, 0, 1, $encoding);
  37041. $pos = self::mb_strripos($haystack, $needle, $encoding);
  37042. return self::getSubpart($pos, $part, $haystack, $encoding);
  37043. }
  37044. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  37045. {
  37046. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  37047. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  37048. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  37049. }
  37050. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  37051. {
  37052. $pos = strpos($haystack, $needle);
  37053. if (false === $pos) {
  37054. return false;
  37055. }
  37056. if ($part) {
  37057. return substr($haystack, 0, $pos);
  37058. }
  37059. return substr($haystack, $pos);
  37060. }
  37061. public static function mb_get_info($type = 'all')
  37062. {
  37063. $info = array(
  37064. 'internal_encoding' => self::$internalEncoding,
  37065. 'http_output' => 'pass',
  37066. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  37067. 'func_overload' => 0,
  37068. 'func_overload_list' => 'no overload',
  37069. 'mail_charset' => 'UTF-8',
  37070. 'mail_header_encoding' => 'BASE64',
  37071. 'mail_body_encoding' => 'BASE64',
  37072. 'illegal_chars' => 0,
  37073. 'encoding_translation' => 'Off',
  37074. 'language' => self::$language,
  37075. 'detect_order' => self::$encodingList,
  37076. 'substitute_character' => 'none',
  37077. 'strict_detection' => 'Off',
  37078. );
  37079. if ('all' === $type) {
  37080. return $info;
  37081. }
  37082. if (isset($info[$type])) {
  37083. return $info[$type];
  37084. }
  37085. return false;
  37086. }
  37087. public static function mb_http_input($type = '')
  37088. {
  37089. return false;
  37090. }
  37091. public static function mb_http_output($encoding = null)
  37092. {
  37093. return null !== $encoding ? 'pass' === $encoding : 'pass';
  37094. }
  37095. public static function mb_strwidth($s, $encoding = null)
  37096. {
  37097. $encoding = self::getEncoding($encoding);
  37098. if ('UTF-8' !== $encoding) {
  37099. $s = iconv($encoding, 'UTF-8', $s);
  37100. }
  37101. $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide);
  37102. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  37103. }
  37104. public static function mb_substr_count($haystack, $needle, $encoding = null)
  37105. {
  37106. return substr_count($haystack, $needle);
  37107. }
  37108. public static function mb_output_handler($contents, $status)
  37109. {
  37110. return $contents;
  37111. }
  37112. private static function getSubpart($pos, $part, $haystack, $encoding)
  37113. {
  37114. if (false === $pos) {
  37115. return false;
  37116. }
  37117. if ($part) {
  37118. return self::mb_substr($haystack, 0, $pos, $encoding);
  37119. }
  37120. return self::mb_substr($haystack, $pos, null, $encoding);
  37121. }
  37122. private static function html_encoding_callback($m)
  37123. {
  37124. $i = 1;
  37125. $entities = '';
  37126. $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
  37127. while (isset($m[$i])) {
  37128. if (0x80 > $m[$i]) {
  37129. $entities .= chr($m[$i++]);
  37130. continue;
  37131. }
  37132. if (0xF0 <= $m[$i]) {
  37133. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  37134. } elseif (0xE0 <= $m[$i]) {
  37135. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  37136. } else {
  37137. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  37138. }
  37139. $entities .= '&#'.$c.';';
  37140. }
  37141. return $entities;
  37142. }
  37143. private static function title_case_lower($s)
  37144. {
  37145. return self::mb_convert_case($s[0], MB_CASE_LOWER, 'UTF-8');
  37146. }
  37147. private static function title_case_upper($s)
  37148. {
  37149. return self::mb_convert_case($s[0], MB_CASE_UPPER, 'UTF-8');
  37150. }
  37151. private static function getData($file)
  37152. {
  37153. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  37154. return require $file;
  37155. }
  37156. return false;
  37157. }
  37158. private static function getEncoding($encoding)
  37159. {
  37160. if (null === $encoding) {
  37161. return self::$internalEncoding;
  37162. }
  37163. $encoding = strtoupper($encoding);
  37164. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  37165. return 'CP850';
  37166. }
  37167. if ('UTF8' === $encoding) {
  37168. return 'UTF-8';
  37169. }
  37170. return $encoding;
  37171. }
  37172. }
  37173. <?php
  37174. static $data = array (
  37175. 'A' => 'a',
  37176. 'B' => 'b',
  37177. 'C' => 'c',
  37178. 'D' => 'd',
  37179. 'E' => 'e',
  37180. 'F' => 'f',
  37181. 'G' => 'g',
  37182. 'H' => 'h',
  37183. 'I' => 'i',
  37184. 'J' => 'j',
  37185. 'K' => 'k',
  37186. 'L' => 'l',
  37187. 'M' => 'm',
  37188. 'N' => 'n',
  37189. 'O' => 'o',
  37190. 'P' => 'p',
  37191. 'Q' => 'q',
  37192. 'R' => 'r',
  37193. 'S' => 's',
  37194. 'T' => 't',
  37195. 'U' => 'u',
  37196. 'V' => 'v',
  37197. 'W' => 'w',
  37198. 'X' => 'x',
  37199. 'Y' => 'y',
  37200. 'Z' => 'z',
  37201. 'À' => 'à',
  37202. '�' => 'á',
  37203. 'Â' => 'â',
  37204. 'Ã' => 'ã',
  37205. 'Ä' => 'ä',
  37206. 'Ã…' => 'Ã¥',
  37207. 'Æ' => 'æ',
  37208. 'Ç' => 'ç',
  37209. 'È' => 'è',
  37210. 'É' => 'é',
  37211. 'Ê' => 'ê',
  37212. 'Ë' => 'ë',
  37213. 'Ì' => 'ì',
  37214. '�' => 'í',
  37215. 'Î' => 'î',
  37216. '�' => 'ï',
  37217. '�' => 'ð',
  37218. 'Ñ' => 'ñ',
  37219. 'Ò' => 'ò',
  37220. 'Ó' => 'ó',
  37221. 'Ô' => 'ô',
  37222. 'Õ' => 'õ',
  37223. 'Ö' => 'ö',
  37224. 'Ø' => 'ø',
  37225. 'Ù' => 'ù',
  37226. 'Ú' => 'ú',
  37227. 'Û' => 'û',
  37228. 'Ü' => 'ü',
  37229. '�' => 'ý',
  37230. 'Þ' => 'þ',
  37231. 'Ā' => '�',
  37232. 'Ă' => 'ă',
  37233. 'Ä„' => 'Ä…',
  37234. 'Ć' => 'ć',
  37235. 'Ĉ' => 'ĉ',
  37236. 'ÄŠ' => 'Ä‹',
  37237. 'Č' => '�',
  37238. 'Ď' => '�',
  37239. '�' => 'đ',
  37240. 'Ä’' => 'Ä“',
  37241. 'Ä”' => 'Ä•',
  37242. 'Ä–' => 'Ä—',
  37243. 'Ę' => 'ę',
  37244. 'Äš' => 'Ä›',
  37245. 'Ĝ' => '�',
  37246. 'Äž' => 'ÄŸ',
  37247. 'Ä ' => 'Ä¡',
  37248. 'Ä¢' => 'Ä£',
  37249. 'Ĥ' => 'ĥ',
  37250. 'Ħ' => 'ħ',
  37251. 'Ĩ' => 'ĩ',
  37252. 'Ī' => 'ī',
  37253. 'Ĭ' => 'ĭ',
  37254. 'Į' => 'į',
  37255. 'Ä°' => 'i',
  37256. 'IJ' => 'ij',
  37257. 'Ĵ' => 'ĵ',
  37258. 'Ķ' => 'ķ',
  37259. 'Ĺ' => 'ĺ',
  37260. 'Ļ' => 'ļ',
  37261. 'Ľ' => 'ľ',
  37262. 'Ä¿' => 'Å€',
  37263. '�' => 'ł',
  37264. 'Ń' => 'ń',
  37265. 'Ņ' => 'ņ',
  37266. 'Ň' => 'ň',
  37267. 'ÅŠ' => 'Å‹',
  37268. 'Ō' => '�',
  37269. 'Ŏ' => '�',
  37270. '�' => 'ő',
  37271. 'Å’' => 'Å“',
  37272. 'Å”' => 'Å•',
  37273. 'Å–' => 'Å—',
  37274. 'Ř' => 'ř',
  37275. 'Åš' => 'Å›',
  37276. 'Ŝ' => '�',
  37277. 'Åž' => 'ÅŸ',
  37278. 'Å ' => 'Å¡',
  37279. 'Å¢' => 'Å£',
  37280. 'Ť' => 'ť',
  37281. 'Ŧ' => 'ŧ',
  37282. 'Ũ' => 'ũ',
  37283. 'Ū' => 'ū',
  37284. 'Ŭ' => 'ŭ',
  37285. 'Ů' => 'ů',
  37286. 'Ű' => 'ű',
  37287. 'Ų' => 'ų',
  37288. 'Ŵ' => 'ŵ',
  37289. 'Ŷ' => 'ŷ',
  37290. 'Ÿ' => 'ÿ',
  37291. 'Ź' => 'ź',
  37292. 'Ż' => 'ż',
  37293. 'Ž' => 'ž',
  37294. '�' => 'ɓ',
  37295. 'Ƃ' => 'ƃ',
  37296. 'Æ„' => 'Æ…',
  37297. 'Ɔ' => 'ɔ',
  37298. 'Ƈ' => 'ƈ',
  37299. 'Ɖ' => 'ɖ',
  37300. 'ÆŠ' => 'É—',
  37301. 'Ƌ' => 'ƌ',
  37302. 'Ǝ' => '�',
  37303. '�' => 'ə',
  37304. '�' => 'ɛ',
  37305. 'Æ‘' => 'Æ’',
  37306. 'Æ“' => 'É ',
  37307. 'Æ”' => 'É£',
  37308. 'Æ–' => 'É©',
  37309. 'Ɨ' => 'ɨ',
  37310. 'Ƙ' => 'ƙ',
  37311. 'Ɯ' => 'ɯ',
  37312. '�' => 'ɲ',
  37313. 'Ɵ' => 'ɵ',
  37314. 'Æ ' => 'Æ¡',
  37315. 'Æ¢' => 'Æ£',
  37316. 'Ƥ' => 'ƥ',
  37317. 'Ʀ' => 'ʀ',
  37318. 'Ƨ' => 'ƨ',
  37319. 'Ʃ' => 'ʃ',
  37320. 'Ƭ' => 'ƭ',
  37321. 'Ʈ' => 'ʈ',
  37322. 'Ư' => 'ư',
  37323. 'Ʊ' => 'ʊ',
  37324. 'Ʋ' => 'ʋ',
  37325. 'Ƴ' => 'ƴ',
  37326. 'Ƶ' => 'ƶ',
  37327. 'Æ·' => 'Ê’',
  37328. 'Ƹ' => 'ƹ',
  37329. 'Ƽ' => 'ƽ',
  37330. 'DŽ' => 'dž',
  37331. 'Dž' => 'dž',
  37332. 'LJ' => 'lj',
  37333. 'Lj' => 'lj',
  37334. 'NJ' => 'nj',
  37335. 'Nj' => 'nj',
  37336. '�' => 'ǎ',
  37337. '�' => '�',
  37338. 'Ç‘' => 'Ç’',
  37339. 'Ç“' => 'Ç”',
  37340. 'Ç•' => 'Ç–',
  37341. 'Ǘ' => 'ǘ',
  37342. 'Ç™' => 'Çš',
  37343. 'Ǜ' => 'ǜ',
  37344. 'Çž' => 'ÇŸ',
  37345. 'Ç ' => 'Ç¡',
  37346. 'Ç¢' => 'Ç£',
  37347. 'Ǥ' => 'ǥ',
  37348. 'Ǧ' => 'ǧ',
  37349. 'Ǩ' => 'ǩ',
  37350. 'Ǫ' => 'ǫ',
  37351. 'Ǭ' => 'ǭ',
  37352. 'Ǯ' => 'ǯ',
  37353. 'DZ' => 'dz',
  37354. 'Dz' => 'dz',
  37355. 'Ǵ' => 'ǵ',
  37356. 'Ƕ' => 'ƕ',
  37357. 'Ç·' => 'Æ¿',
  37358. 'Ǹ' => 'ǹ',
  37359. 'Ǻ' => 'ǻ',
  37360. 'Ǽ' => 'ǽ',
  37361. 'Ǿ' => 'ǿ',
  37362. 'Ȁ' => '�',
  37363. 'Ȃ' => 'ȃ',
  37364. 'È„' => 'È…',
  37365. 'Ȇ' => 'ȇ',
  37366. 'Ȉ' => 'ȉ',
  37367. 'ÈŠ' => 'È‹',
  37368. 'Ȍ' => '�',
  37369. 'Ȏ' => '�',
  37370. '�' => 'ȑ',
  37371. 'È’' => 'È“',
  37372. 'È”' => 'È•',
  37373. 'È–' => 'È—',
  37374. 'Ș' => 'ș',
  37375. 'Èš' => 'È›',
  37376. 'Ȝ' => '�',
  37377. 'Èž' => 'ÈŸ',
  37378. 'È ' => 'Æž',
  37379. 'È¢' => 'È£',
  37380. 'Ȥ' => 'ȥ',
  37381. 'Ȧ' => 'ȧ',
  37382. 'Ȩ' => 'ȩ',
  37383. 'Ȫ' => 'ȫ',
  37384. 'Ȭ' => 'ȭ',
  37385. 'Ȯ' => 'ȯ',
  37386. 'Ȱ' => 'ȱ',
  37387. 'Ȳ' => 'ȳ',
  37388. 'Ⱥ' => 'ⱥ',
  37389. 'Ȼ' => 'ȼ',
  37390. 'Ƚ' => 'ƚ',
  37391. 'Ⱦ' => 'ⱦ',
  37392. '�' => 'ɂ',
  37393. 'Ƀ' => 'ƀ',
  37394. 'Ʉ' => 'ʉ',
  37395. 'Ʌ' => 'ʌ',
  37396. 'Ɇ' => 'ɇ',
  37397. 'Ɉ' => 'ɉ',
  37398. 'ÉŠ' => 'É‹',
  37399. 'Ɍ' => '�',
  37400. 'Ɏ' => '�',
  37401. 'Ͱ' => 'ͱ',
  37402. 'Ͳ' => 'ͳ',
  37403. 'Ͷ' => 'ͷ',
  37404. 'Ϳ' => 'ϳ',
  37405. 'Ά' => 'ά',
  37406. 'Έ' => 'έ',
  37407. 'Ή' => 'ή',
  37408. 'Ί' => 'ί',
  37409. 'Ό' => 'ό',
  37410. 'Ύ' => '�',
  37411. '�' => 'ώ',
  37412. 'Α' => 'α',
  37413. 'Β' => 'β',
  37414. 'Γ' => 'γ',
  37415. 'Δ' => 'δ',
  37416. 'Ε' => 'ε',
  37417. 'Ζ' => 'ζ',
  37418. 'Η' => 'η',
  37419. 'Θ' => 'θ',
  37420. 'Ι' => 'ι',
  37421. 'Κ' => 'κ',
  37422. 'Λ' => 'λ',
  37423. 'Μ' => 'μ',
  37424. '�' => 'ν',
  37425. 'Ξ' => 'ξ',
  37426. 'Ο' => 'ο',
  37427. 'Π' => 'π',
  37428. 'Ρ' => '�',
  37429. 'Σ' => 'σ',
  37430. 'Τ' => 'τ',
  37431. 'Î¥' => 'Ï…',
  37432. 'Φ' => 'φ',
  37433. 'Χ' => 'χ',
  37434. 'Ψ' => 'ψ',
  37435. 'Ω' => 'ω',
  37436. 'Ϊ' => 'ϊ',
  37437. 'Ϋ' => 'ϋ',
  37438. '�' => 'ϗ',
  37439. 'Ϙ' => 'ϙ',
  37440. 'Ïš' => 'Ï›',
  37441. 'Ϝ' => '�',
  37442. 'Ïž' => 'ÏŸ',
  37443. 'Ï ' => 'Ï¡',
  37444. 'Ï¢' => 'Ï£',
  37445. 'Ϥ' => 'ϥ',
  37446. 'Ϧ' => 'ϧ',
  37447. 'Ϩ' => 'ϩ',
  37448. 'Ϫ' => 'ϫ',
  37449. 'Ϭ' => 'ϭ',
  37450. 'Ϯ' => 'ϯ',
  37451. 'ϴ' => 'θ',
  37452. 'Ϸ' => 'ϸ',
  37453. 'Ϲ' => 'ϲ',
  37454. 'Ϻ' => 'ϻ',
  37455. 'Ͻ' => 'ͻ',
  37456. 'Ͼ' => 'ͼ',
  37457. 'Ͽ' => 'ͽ',
  37458. 'Ѐ' => '�',
  37459. '�' => 'ё',
  37460. 'Ђ' => 'ђ',
  37461. 'Ѓ' => 'ѓ',
  37462. 'Є' => 'є',
  37463. 'Ð…' => 'Ñ•',
  37464. 'І' => 'і',
  37465. 'Ї' => 'ї',
  37466. 'Ј' => 'ј',
  37467. 'Љ' => 'љ',
  37468. 'Њ' => 'њ',
  37469. 'Ћ' => 'ћ',
  37470. 'Ќ' => 'ќ',
  37471. '�' => '�',
  37472. 'ÐŽ' => 'Ñž',
  37473. '�' => 'џ',
  37474. '�' => 'а',
  37475. 'Б' => 'б',
  37476. 'В' => 'в',
  37477. 'Г' => 'г',
  37478. 'Д' => 'д',
  37479. 'Е' => 'е',
  37480. 'Ж' => 'ж',
  37481. 'З' => 'з',
  37482. 'И' => 'и',
  37483. 'Й' => 'й',
  37484. 'К' => 'к',
  37485. 'Л' => 'л',
  37486. 'М' => 'м',
  37487. '�' => 'н',
  37488. 'О' => 'о',
  37489. 'П' => 'п',
  37490. 'Р' => 'р',
  37491. 'С' => '�',
  37492. 'Т' => 'т',
  37493. 'У' => 'у',
  37494. 'Ф' => 'ф',
  37495. 'Ð¥' => 'Ñ…',
  37496. 'Ц' => 'ц',
  37497. 'Ч' => 'ч',
  37498. 'Ш' => 'ш',
  37499. 'Щ' => 'щ',
  37500. 'Ъ' => 'ъ',
  37501. 'Ы' => 'ы',
  37502. 'Ь' => 'ь',
  37503. 'Э' => '�',
  37504. 'Ю' => 'ю',
  37505. 'Я' => '�',
  37506. 'Ñ ' => 'Ñ¡',
  37507. 'Ñ¢' => 'Ñ£',
  37508. 'Ѥ' => 'ѥ',
  37509. 'Ѧ' => 'ѧ',
  37510. 'Ѩ' => 'ѩ',
  37511. 'Ѫ' => 'ѫ',
  37512. 'Ѭ' => 'ѭ',
  37513. 'Ѯ' => 'ѯ',
  37514. 'Ѱ' => 'ѱ',
  37515. 'Ѳ' => 'ѳ',
  37516. 'Ѵ' => 'ѵ',
  37517. 'Ѷ' => 'ѷ',
  37518. 'Ѹ' => 'ѹ',
  37519. 'Ѻ' => 'ѻ',
  37520. 'Ѽ' => 'ѽ',
  37521. 'Ѿ' => 'ѿ',
  37522. 'Ò€' => 'Ò�',
  37523. 'ÒŠ' => 'Ò‹',
  37524. 'Ҍ' => '�',
  37525. 'ÒŽ' => 'Ò�',
  37526. 'Ò�' => 'Ò‘',
  37527. 'Ò’' => 'Ò“',
  37528. 'Ò”' => 'Ò•',
  37529. 'Ò–' => 'Ò—',
  37530. 'Ò˜' => 'Ò™',
  37531. 'Òš' => 'Ò›',
  37532. 'Ҝ' => '�',
  37533. 'Òž' => 'ÒŸ',
  37534. 'Ò ' => 'Ò¡',
  37535. 'Ò¢' => 'Ò£',
  37536. 'Ò¤' => 'Ò¥',
  37537. 'Ò¦' => 'Ò§',
  37538. 'Ò¨' => 'Ò©',
  37539. 'Òª' => 'Ò«',
  37540. 'Ò¬' => 'Ò­',
  37541. 'Ò®' => 'Ò¯',
  37542. 'Ò°' => 'Ò±',
  37543. 'Ò²' => 'Ò³',
  37544. 'Ò´' => 'Òµ',
  37545. 'Ò¶' => 'Ò·',
  37546. 'Ò¸' => 'Ò¹',
  37547. 'Òº' => 'Ò»',
  37548. 'Ò¼' => 'Ò½',
  37549. 'Ò¾' => 'Ò¿',
  37550. 'Ó€' => 'Ó�',
  37551. 'Ó�' => 'Ó‚',
  37552. 'Óƒ' => 'Ó„',
  37553. 'Ó…' => 'Ó†',
  37554. 'Ó‡' => 'Óˆ',
  37555. 'Ó‰' => 'ÓŠ',
  37556. 'Ӌ' => 'ӌ',
  37557. 'Ó�' => 'ÓŽ',
  37558. 'Ó�' => 'Ó‘',
  37559. 'Ó’' => 'Ó“',
  37560. 'Ó”' => 'Ó•',
  37561. 'Ó–' => 'Ó—',
  37562. 'Ó˜' => 'Ó™',
  37563. 'Óš' => 'Ó›',
  37564. 'Ӝ' => '�',
  37565. 'Óž' => 'ÓŸ',
  37566. 'Ó ' => 'Ó¡',
  37567. 'Ó¢' => 'Ó£',
  37568. 'Ó¤' => 'Ó¥',
  37569. 'Ó¦' => 'Ó§',
  37570. 'Ó¨' => 'Ó©',
  37571. 'Óª' => 'Ó«',
  37572. 'Ó¬' => 'Ó­',
  37573. 'Ó®' => 'Ó¯',
  37574. 'Ó°' => 'Ó±',
  37575. 'Ó²' => 'Ó³',
  37576. 'Ó´' => 'Óµ',
  37577. 'Ó¶' => 'Ó·',
  37578. 'Ó¸' => 'Ó¹',
  37579. 'Óº' => 'Ó»',
  37580. 'Ó¼' => 'Ó½',
  37581. 'Ó¾' => 'Ó¿',
  37582. 'Ô€' => 'Ô�',
  37583. 'Ô‚' => 'Ôƒ',
  37584. 'Ô„' => 'Ô…',
  37585. 'Ô†' => 'Ô‡',
  37586. 'Ôˆ' => 'Ô‰',
  37587. 'ÔŠ' => 'Ô‹',
  37588. 'Ԍ' => '�',
  37589. 'ÔŽ' => 'Ô�',
  37590. 'Ô�' => 'Ô‘',
  37591. 'Ô’' => 'Ô“',
  37592. 'Ô”' => 'Ô•',
  37593. 'Ô–' => 'Ô—',
  37594. 'Ô˜' => 'Ô™',
  37595. 'Ôš' => 'Ô›',
  37596. 'Ԝ' => '�',
  37597. 'Ôž' => 'ÔŸ',
  37598. 'Ô ' => 'Ô¡',
  37599. 'Ô¢' => 'Ô£',
  37600. 'Ô¤' => 'Ô¥',
  37601. 'Ô¦' => 'Ô§',
  37602. 'Ô¨' => 'Ô©',
  37603. 'Ôª' => 'Ô«',
  37604. 'Ô¬' => 'Ô­',
  37605. 'Ô®' => 'Ô¯',
  37606. 'Ô±' => 'Õ¡',
  37607. 'Ô²' => 'Õ¢',
  37608. 'Ô³' => 'Õ£',
  37609. 'Ô´' => 'Õ¤',
  37610. 'Ôµ' => 'Õ¥',
  37611. 'Ô¶' => 'Õ¦',
  37612. 'Ô·' => 'Õ§',
  37613. 'Ô¸' => 'Õ¨',
  37614. 'Ô¹' => 'Õ©',
  37615. 'Ôº' => 'Õª',
  37616. 'Ô»' => 'Õ«',
  37617. 'Ô¼' => 'Õ¬',
  37618. 'Ô½' => 'Õ­',
  37619. 'Ô¾' => 'Õ®',
  37620. 'Ô¿' => 'Õ¯',
  37621. 'Õ€' => 'Õ°',
  37622. 'Õ�' => 'Õ±',
  37623. 'Õ‚' => 'Õ²',
  37624. 'Õƒ' => 'Õ³',
  37625. 'Õ„' => 'Õ´',
  37626. 'Õ…' => 'Õµ',
  37627. 'Õ†' => 'Õ¶',
  37628. 'Õ‡' => 'Õ·',
  37629. 'Õˆ' => 'Õ¸',
  37630. 'Õ‰' => 'Õ¹',
  37631. 'ÕŠ' => 'Õº',
  37632. 'Õ‹' => 'Õ»',
  37633. 'Ռ' => 'ռ',
  37634. 'Õ�' => 'Õ½',
  37635. 'ÕŽ' => 'Õ¾',
  37636. 'Õ�' => 'Õ¿',
  37637. 'Õ�' => 'Ö€',
  37638. 'Õ‘' => 'Ö�',
  37639. 'Õ’' => 'Ö‚',
  37640. 'Õ“' => 'Öƒ',
  37641. 'Õ”' => 'Ö„',
  37642. 'Õ•' => 'Ö…',
  37643. 'Õ–' => 'Ö†',
  37644. 'á‚ ' => 'â´€',
  37645. 'á‚¡' => 'â´�',
  37646. 'á‚¢' => 'â´‚',
  37647. 'á‚£' => 'â´ƒ',
  37648. 'Ⴄ' => 'ⴄ',
  37649. 'á‚¥' => 'â´…',
  37650. 'Ⴆ' => 'ⴆ',
  37651. 'Ⴇ' => 'ⴇ',
  37652. 'Ⴈ' => 'ⴈ',
  37653. 'á‚©' => 'â´‰',
  37654. 'Ⴊ' => 'ⴊ',
  37655. 'á‚«' => 'â´‹',
  37656. 'Ⴌ' => 'ⴌ',
  37657. 'á‚­' => 'â´�',
  37658. 'á‚®' => 'â´Ž',
  37659. 'Ⴏ' => '�',
  37660. 'á‚°' => 'â´�',
  37661. 'Ⴑ' => 'ⴑ',
  37662. 'Ⴒ' => 'ⴒ',
  37663. 'Ⴓ' => 'ⴓ',
  37664. 'á‚´' => 'â´”',
  37665. 'Ⴕ' => 'ⴕ',
  37666. 'Ⴖ' => 'ⴖ',
  37667. 'á‚·' => 'â´—',
  37668. 'Ⴘ' => 'ⴘ',
  37669. 'Ⴙ' => 'ⴙ',
  37670. 'Ⴚ' => 'ⴚ',
  37671. 'á‚»' => 'â´›',
  37672. 'Ⴜ' => 'ⴜ',
  37673. 'Ⴝ' => '�',
  37674. 'Ⴞ' => 'ⴞ',
  37675. 'á‚¿' => 'â´Ÿ',
  37676. 'Ⴠ' => 'ⴠ',
  37677. '�' => 'ⴡ',
  37678. 'Ⴢ' => 'ⴢ',
  37679. 'Ⴣ' => 'ⴣ',
  37680. 'Ⴤ' => 'ⴤ',
  37681. 'Ⴥ' => 'ⴥ',
  37682. 'Ⴧ' => 'ⴧ',
  37683. '�' => 'ⴭ',
  37684. 'Ḁ' => '�',
  37685. 'Ḃ' => 'ḃ',
  37686. 'Ḅ' => 'ḅ',
  37687. 'Ḇ' => 'ḇ',
  37688. 'Ḉ' => 'ḉ',
  37689. 'Ḋ' => 'ḋ',
  37690. 'Ḍ' => '�',
  37691. 'Ḏ' => '�',
  37692. '�' => 'ḑ',
  37693. 'Ḓ' => 'ḓ',
  37694. 'Ḕ' => 'ḕ',
  37695. 'Ḗ' => 'ḗ',
  37696. 'Ḙ' => 'ḙ',
  37697. 'Ḛ' => 'ḛ',
  37698. 'Ḝ' => '�',
  37699. 'Ḟ' => 'ḟ',
  37700. 'Ḡ' => 'ḡ',
  37701. 'Ḣ' => 'ḣ',
  37702. 'Ḥ' => 'ḥ',
  37703. 'Ḧ' => 'ḧ',
  37704. 'Ḩ' => 'ḩ',
  37705. 'Ḫ' => 'ḫ',
  37706. 'Ḭ' => 'ḭ',
  37707. 'Ḯ' => 'ḯ',
  37708. 'Ḱ' => 'ḱ',
  37709. 'Ḳ' => 'ḳ',
  37710. 'Ḵ' => 'ḵ',
  37711. 'Ḷ' => 'ḷ',
  37712. 'Ḹ' => 'ḹ',
  37713. 'Ḻ' => 'ḻ',
  37714. 'Ḽ' => 'ḽ',
  37715. 'Ḿ' => 'ḿ',
  37716. 'Ṁ' => '�',
  37717. 'Ṃ' => 'ṃ',
  37718. 'Ṅ' => 'ṅ',
  37719. 'Ṇ' => 'ṇ',
  37720. 'Ṉ' => 'ṉ',
  37721. 'Ṋ' => 'ṋ',
  37722. 'Ṍ' => '�',
  37723. 'Ṏ' => '�',
  37724. '�' => 'ṑ',
  37725. 'Ṓ' => 'ṓ',
  37726. 'Ṕ' => 'ṕ',
  37727. 'á¹–' => 'á¹—',
  37728. 'Ṙ' => 'ṙ',
  37729. 'Ṛ' => 'ṛ',
  37730. 'Ṝ' => '�',
  37731. 'Ṟ' => 'ṟ',
  37732. 'Ṡ' => 'ṡ',
  37733. 'á¹¢' => 'á¹£',
  37734. 'Ṥ' => 'ṥ',
  37735. 'Ṧ' => 'ṧ',
  37736. 'Ṩ' => 'ṩ',
  37737. 'Ṫ' => 'ṫ',
  37738. 'Ṭ' => 'ṭ',
  37739. 'Ṯ' => 'ṯ',
  37740. 'á¹°' => 'á¹±',
  37741. 'á¹²' => 'á¹³',
  37742. 'á¹´' => 'á¹µ',
  37743. 'Ṷ' => 'ṷ',
  37744. 'Ṹ' => 'ṹ',
  37745. 'Ṻ' => 'ṻ',
  37746. 'á¹¼' => 'á¹½',
  37747. 'Ṿ' => 'ṿ',
  37748. 'Ẁ' => '�',
  37749. 'Ẃ' => 'ẃ',
  37750. 'Ẅ' => 'ẅ',
  37751. 'Ẇ' => 'ẇ',
  37752. 'Ẉ' => 'ẉ',
  37753. 'Ẋ' => 'ẋ',
  37754. 'Ẍ' => '�',
  37755. 'Ẏ' => '�',
  37756. '�' => 'ẑ',
  37757. 'Ẓ' => 'ẓ',
  37758. 'Ẕ' => 'ẕ',
  37759. 'ẞ' => 'ß',
  37760. 'Ạ' => 'ạ',
  37761. 'Ả' => 'ả',
  37762. 'Ấ' => 'ấ',
  37763. 'Ầ' => 'ầ',
  37764. 'Ẩ' => 'ẩ',
  37765. 'Ẫ' => 'ẫ',
  37766. 'Ậ' => 'ậ',
  37767. 'Ắ' => 'ắ',
  37768. 'Ằ' => 'ằ',
  37769. 'Ẳ' => 'ẳ',
  37770. 'Ẵ' => 'ẵ',
  37771. 'Ặ' => 'ặ',
  37772. 'Ẹ' => 'ẹ',
  37773. 'Ẻ' => 'ẻ',
  37774. 'Ẽ' => 'ẽ',
  37775. 'Ế' => 'ế',
  37776. 'Ề' => '�',
  37777. 'Ể' => 'ể',
  37778. 'Ễ' => 'ễ',
  37779. 'Ệ' => 'ệ',
  37780. 'Ỉ' => 'ỉ',
  37781. 'Ị' => 'ị',
  37782. 'Ọ' => '�',
  37783. 'Ỏ' => '�',
  37784. '�' => 'ố',
  37785. 'Ồ' => 'ồ',
  37786. 'Ổ' => 'ổ',
  37787. 'á»–' => 'á»—',
  37788. 'Ộ' => 'ộ',
  37789. 'Ớ' => 'ớ',
  37790. 'Ờ' => '�',
  37791. 'Ở' => 'ở',
  37792. 'Ỡ' => 'ỡ',
  37793. 'Ợ' => 'ợ',
  37794. 'Ụ' => 'ụ',
  37795. 'Ủ' => 'ủ',
  37796. 'Ứ' => 'ứ',
  37797. 'Ừ' => 'ừ',
  37798. 'Ử' => 'ử',
  37799. 'Ữ' => 'ữ',
  37800. 'á»°' => 'á»±',
  37801. 'Ỳ' => 'ỳ',
  37802. 'Ỵ' => 'ỵ',
  37803. 'Ỷ' => 'ỷ',
  37804. 'Ỹ' => 'ỹ',
  37805. 'Ỻ' => 'ỻ',
  37806. 'Ỽ' => 'ỽ',
  37807. 'Ỿ' => 'ỿ',
  37808. 'Ἀ' => 'ἀ',
  37809. 'Ἁ' => '�',
  37810. 'Ἂ' => 'ἂ',
  37811. 'Ἃ' => 'ἃ',
  37812. 'Ἄ' => 'ἄ',
  37813. '�' => 'ἅ',
  37814. 'Ἆ' => 'ἆ',
  37815. '�' => 'ἇ',
  37816. 'Ἐ' => '�',
  37817. 'Ἑ' => 'ἑ',
  37818. 'Ἒ' => 'ἒ',
  37819. 'Ἓ' => 'ἓ',
  37820. 'Ἔ' => 'ἔ',
  37821. '�' => 'ἕ',
  37822. 'Ἠ' => 'ἠ',
  37823. 'Ἡ' => 'ἡ',
  37824. 'Ἢ' => 'ἢ',
  37825. 'Ἣ' => 'ἣ',
  37826. 'Ἤ' => 'ἤ',
  37827. 'á¼­' => 'á¼¥',
  37828. 'Ἦ' => 'ἦ',
  37829. 'Ἧ' => 'ἧ',
  37830. 'Ἰ' => 'ἰ',
  37831. 'á¼¹' => 'á¼±',
  37832. 'Ἲ' => 'ἲ',
  37833. 'á¼»' => 'á¼³',
  37834. 'á¼¼' => 'á¼´',
  37835. 'á¼½' => 'á¼µ',
  37836. 'Ἶ' => 'ἶ',
  37837. 'Ἷ' => 'ἷ',
  37838. 'Ὀ' => 'ὀ',
  37839. 'Ὁ' => '�',
  37840. 'Ὂ' => 'ὂ',
  37841. 'Ὃ' => 'ὃ',
  37842. 'Ὄ' => 'ὄ',
  37843. '�' => 'ὅ',
  37844. 'Ὑ' => 'ὑ',
  37845. 'Ὓ' => 'ὓ',
  37846. '�' => 'ὕ',
  37847. 'Ὗ' => 'ὗ',
  37848. 'Ὠ' => 'ὠ',
  37849. 'Ὡ' => 'ὡ',
  37850. 'Ὢ' => 'ὢ',
  37851. 'Ὣ' => 'ὣ',
  37852. 'Ὤ' => 'ὤ',
  37853. 'á½­' => 'á½¥',
  37854. 'Ὦ' => 'ὦ',
  37855. 'Ὧ' => 'ὧ',
  37856. 'ᾈ' => 'ᾀ',
  37857. 'ᾉ' => '�',
  37858. 'ᾊ' => 'ᾂ',
  37859. 'ᾋ' => 'ᾃ',
  37860. 'ᾌ' => 'ᾄ',
  37861. '�' => 'ᾅ',
  37862. 'ᾎ' => 'ᾆ',
  37863. '�' => 'ᾇ',
  37864. 'ᾘ' => '�',
  37865. 'ᾙ' => 'ᾑ',
  37866. 'ᾚ' => 'ᾒ',
  37867. 'ᾛ' => 'ᾓ',
  37868. 'ᾜ' => 'ᾔ',
  37869. '�' => 'ᾕ',
  37870. 'ᾞ' => 'ᾖ',
  37871. 'ᾟ' => 'ᾗ',
  37872. 'ᾨ' => 'ᾠ',
  37873. 'ᾩ' => 'ᾡ',
  37874. 'ᾪ' => 'ᾢ',
  37875. 'ᾫ' => 'ᾣ',
  37876. 'ᾬ' => 'ᾤ',
  37877. 'á¾­' => 'á¾¥',
  37878. 'ᾮ' => 'ᾦ',
  37879. 'ᾯ' => 'ᾧ',
  37880. 'Ᾰ' => 'ᾰ',
  37881. 'á¾¹' => 'á¾±',
  37882. 'Ὰ' => 'ὰ',
  37883. 'á¾»' => 'á½±',
  37884. 'á¾¼' => 'á¾³',
  37885. 'Ὲ' => 'ὲ',
  37886. 'Έ' => 'έ',
  37887. 'á¿Š' => 'á½´',
  37888. 'á¿‹' => 'á½µ',
  37889. 'ῌ' => 'ῃ',
  37890. 'Ῐ' => '�',
  37891. 'á¿™' => 'á¿‘',
  37892. 'Ὶ' => 'ὶ',
  37893. 'á¿›' => 'á½·',
  37894. 'Ῠ' => 'ῠ',
  37895. 'á¿©' => 'á¿¡',
  37896. 'Ὺ' => 'ὺ',
  37897. 'á¿«' => 'á½»',
  37898. 'Ῥ' => 'ῥ',
  37899. 'Ὸ' => 'ὸ',
  37900. 'Ό' => 'ό',
  37901. 'Ὼ' => 'ὼ',
  37902. 'á¿»' => 'á½½',
  37903. 'ῼ' => 'ῳ',
  37904. 'Ω' => 'ω',
  37905. 'K' => 'k',
  37906. 'â„«' => 'Ã¥',
  37907. 'Ⅎ' => 'ⅎ',
  37908. 'â… ' => 'â…°',
  37909. 'â…¡' => 'â…±',
  37910. 'â…¢' => 'â…²',
  37911. 'â…£' => 'â…³',
  37912. 'â…¤' => 'â…´',
  37913. 'â…¥' => 'â…µ',
  37914. 'â…¦' => 'â…¶',
  37915. 'â…§' => 'â…·',
  37916. 'â…¨' => 'â…¸',
  37917. 'â…©' => 'â…¹',
  37918. 'â…ª' => 'â…º',
  37919. 'â…«' => 'â…»',
  37920. 'â…¬' => 'â…¼',
  37921. 'â…­' => 'â…½',
  37922. 'â…®' => 'â…¾',
  37923. 'â…¯' => 'â…¿',
  37924. 'Ↄ' => 'ↄ',
  37925. 'Ⓐ' => '�',
  37926. 'â’·' => 'â“‘',
  37927. 'â’¸' => 'â“’',
  37928. 'â’¹' => 'â““',
  37929. 'â’º' => 'â“”',
  37930. 'â’»' => 'â“•',
  37931. 'â’¼' => 'â“–',
  37932. 'â’½' => 'â“—',
  37933. 'Ⓘ' => 'ⓘ',
  37934. 'â’¿' => 'â“™',
  37935. 'â“€' => 'â“š',
  37936. '�' => 'ⓛ',
  37937. 'Ⓜ' => 'ⓜ',
  37938. 'Ⓝ' => '�',
  37939. 'â“„' => 'â“ž',
  37940. 'â“…' => 'â“Ÿ',
  37941. 'Ⓠ' => 'ⓠ',
  37942. 'Ⓡ' => 'ⓡ',
  37943. 'Ⓢ' => 'ⓢ',
  37944. 'Ⓣ' => 'ⓣ',
  37945. 'Ⓤ' => 'ⓤ',
  37946. 'â“‹' => 'â“¥',
  37947. 'Ⓦ' => 'ⓦ',
  37948. '�' => 'ⓧ',
  37949. 'Ⓨ' => 'ⓨ',
  37950. '�' => 'ⓩ',
  37951. 'â°€' => 'â°°',
  37952. 'â°�' => 'â°±',
  37953. 'â°‚' => 'â°²',
  37954. 'â°ƒ' => 'â°³',
  37955. 'â°„' => 'â°´',
  37956. 'â°…' => 'â°µ',
  37957. 'â°†' => 'â°¶',
  37958. 'â°‡' => 'â°·',
  37959. 'â°ˆ' => 'â°¸',
  37960. 'â°‰' => 'â°¹',
  37961. 'â°Š' => 'â°º',
  37962. 'â°‹' => 'â°»',
  37963. 'Ⰼ' => 'ⰼ',
  37964. 'â°�' => 'â°½',
  37965. 'â°Ž' => 'â°¾',
  37966. 'â°�' => 'â°¿',
  37967. 'â°�' => 'â±€',
  37968. 'Ⱁ' => '�',
  37969. 'Ⱂ' => 'ⱂ',
  37970. 'Ⱃ' => 'ⱃ',
  37971. 'Ⱄ' => 'ⱄ',
  37972. 'â°•' => 'â±…',
  37973. 'Ⱆ' => 'ⱆ',
  37974. 'Ⱇ' => 'ⱇ',
  37975. 'Ⱈ' => 'ⱈ',
  37976. 'Ⱉ' => 'ⱉ',
  37977. 'Ⱊ' => 'ⱊ',
  37978. 'Ⱋ' => 'ⱋ',
  37979. 'Ⱌ' => 'ⱌ',
  37980. '�' => '�',
  37981. 'Ⱎ' => 'ⱎ',
  37982. 'Ⱏ' => '�',
  37983. 'Ⱐ' => '�',
  37984. 'Ⱑ' => 'ⱑ',
  37985. 'â°¢' => 'â±’',
  37986. 'Ⱓ' => 'ⱓ',
  37987. 'â°¤' => 'â±”',
  37988. 'Ⱕ' => 'ⱕ',
  37989. 'â°¦' => 'â±–',
  37990. 'â°§' => 'â±—',
  37991. 'Ⱘ' => 'ⱘ',
  37992. 'â°©' => 'â±™',
  37993. 'Ⱚ' => 'ⱚ',
  37994. 'â°«' => 'â±›',
  37995. 'Ⱜ' => 'ⱜ',
  37996. 'Ⱝ' => '�',
  37997. 'Ⱞ' => 'ⱞ',
  37998. 'Ⱡ' => 'ⱡ',
  37999. 'â±¢' => 'É«',
  38000. 'â±£' => 'áµ½',
  38001. 'Ɽ' => 'ɽ',
  38002. 'Ⱨ' => 'ⱨ',
  38003. 'Ⱪ' => 'ⱪ',
  38004. 'Ⱬ' => 'ⱬ',
  38005. 'â±­' => 'É‘',
  38006. 'Ɱ' => 'ɱ',
  38007. 'Ɐ' => '�',
  38008. 'â±°' => 'É’',
  38009. 'â±²' => 'â±³',
  38010. 'Ⱶ' => 'ⱶ',
  38011. 'â±¾' => 'È¿',
  38012. 'Ɀ' => 'ɀ',
  38013. 'Ⲁ' => '�',
  38014. 'Ⲃ' => 'ⲃ',
  38015. 'Ⲅ' => 'ⲅ',
  38016. 'Ⲇ' => 'ⲇ',
  38017. 'Ⲉ' => 'ⲉ',
  38018. 'Ⲋ' => 'ⲋ',
  38019. 'Ⲍ' => '�',
  38020. 'Ⲏ' => '�',
  38021. '�' => 'ⲑ',
  38022. 'Ⲓ' => 'ⲓ',
  38023. 'Ⲕ' => 'ⲕ',
  38024. 'â²–' => 'â²—',
  38025. 'Ⲙ' => 'ⲙ',
  38026. 'Ⲛ' => 'ⲛ',
  38027. 'Ⲝ' => '�',
  38028. 'Ⲟ' => 'ⲟ',
  38029. 'Ⲡ' => 'ⲡ',
  38030. 'â²¢' => 'â²£',
  38031. 'Ⲥ' => 'ⲥ',
  38032. 'Ⲧ' => 'ⲧ',
  38033. 'Ⲩ' => 'ⲩ',
  38034. 'Ⲫ' => 'ⲫ',
  38035. 'Ⲭ' => 'ⲭ',
  38036. 'Ⲯ' => 'ⲯ',
  38037. 'â²°' => 'â²±',
  38038. 'â²²' => 'â²³',
  38039. 'â²´' => 'â²µ',
  38040. 'Ⲷ' => 'ⲷ',
  38041. 'Ⲹ' => 'ⲹ',
  38042. 'Ⲻ' => 'ⲻ',
  38043. 'â²¼' => 'â²½',
  38044. 'Ⲿ' => 'ⲿ',
  38045. 'Ⳁ' => '�',
  38046. 'Ⳃ' => 'ⳃ',
  38047. 'Ⳅ' => 'ⳅ',
  38048. 'Ⳇ' => 'ⳇ',
  38049. 'Ⳉ' => 'ⳉ',
  38050. 'Ⳋ' => 'ⳋ',
  38051. 'Ⳍ' => '�',
  38052. 'Ⳏ' => '�',
  38053. '�' => 'ⳑ',
  38054. 'Ⳓ' => 'ⳓ',
  38055. 'Ⳕ' => 'ⳕ',
  38056. 'â³–' => 'â³—',
  38057. 'Ⳙ' => 'ⳙ',
  38058. 'Ⳛ' => 'ⳛ',
  38059. 'Ⳝ' => '�',
  38060. 'Ⳟ' => 'ⳟ',
  38061. 'Ⳡ' => 'ⳡ',
  38062. 'â³¢' => 'â³£',
  38063. 'Ⳬ' => 'ⳬ',
  38064. 'â³­' => 'â³®',
  38065. 'â³²' => 'â³³',
  38066. 'Ꙁ' => '�',
  38067. 'Ꙃ' => 'ꙃ',
  38068. 'Ꙅ' => 'ꙅ',
  38069. 'Ꙇ' => 'ꙇ',
  38070. 'Ꙉ' => 'ꙉ',
  38071. 'Ꙋ' => 'ꙋ',
  38072. 'Ꙍ' => '�',
  38073. 'Ꙏ' => '�',
  38074. '�' => 'ꙑ',
  38075. 'Ꙓ' => 'ꙓ',
  38076. 'Ꙕ' => 'ꙕ',
  38077. 'ê™–' => 'ê™—',
  38078. 'Ꙙ' => 'ꙙ',
  38079. 'Ꙛ' => 'ꙛ',
  38080. 'Ꙝ' => '�',
  38081. 'Ꙟ' => 'ꙟ',
  38082. 'Ꙡ' => 'ꙡ',
  38083. 'Ꙣ' => 'ꙣ',
  38084. 'Ꙥ' => 'ꙥ',
  38085. 'Ꙧ' => 'ꙧ',
  38086. 'Ꙩ' => 'ꙩ',
  38087. 'Ꙫ' => 'ꙫ',
  38088. 'Ꙭ' => 'ꙭ',
  38089. 'Ꚁ' => '�',
  38090. 'Ꚃ' => 'ꚃ',
  38091. 'êš„' => 'êš…',
  38092. 'Ꚇ' => 'ꚇ',
  38093. 'Ꚉ' => 'ꚉ',
  38094. 'Ꚋ' => 'ꚋ',
  38095. 'Ꚍ' => '�',
  38096. 'Ꚏ' => '�',
  38097. '�' => 'ꚑ',
  38098. 'êš’' => 'êš“',
  38099. 'êš”' => 'êš•',
  38100. 'êš–' => 'êš—',
  38101. 'Ꚙ' => 'ꚙ',
  38102. 'êšš' => 'êš›',
  38103. 'Ꜣ' => 'ꜣ',
  38104. 'Ꜥ' => 'ꜥ',
  38105. 'Ꜧ' => 'ꜧ',
  38106. 'Ꜩ' => 'ꜩ',
  38107. 'Ꜫ' => 'ꜫ',
  38108. 'Ꜭ' => 'ꜭ',
  38109. 'Ꜯ' => 'ꜯ',
  38110. 'Ꜳ' => 'ꜳ',
  38111. 'Ꜵ' => 'ꜵ',
  38112. 'Ꜷ' => 'ꜷ',
  38113. 'Ꜹ' => 'ꜹ',
  38114. 'Ꜻ' => 'ꜻ',
  38115. 'Ꜽ' => 'ꜽ',
  38116. 'Ꜿ' => 'ꜿ',
  38117. '�' => '�',
  38118. '�' => '�',
  38119. '�' => '�',
  38120. '�' => '�',
  38121. '�' => '�',
  38122. '�' => '�',
  38123. '�' => '�',
  38124. '�' => '�',
  38125. '�' => '�',
  38126. '�' => '�',
  38127. '�' => '�',
  38128. '�' => '�',
  38129. '�' => '�',
  38130. '�' => '�',
  38131. '�' => '�',
  38132. '�' => '�',
  38133. '�' => '�',
  38134. '�' => '�',
  38135. '�' => '�',
  38136. '�' => '�',
  38137. '�' => '�',
  38138. '�' => '�',
  38139. '�' => '�',
  38140. '�' => '�',
  38141. '�' => '�',
  38142. '�' => '�',
  38143. '�' => 'ᵹ',
  38144. '�' => '�',
  38145. 'Ꞁ' => '�',
  38146. 'Ꞃ' => 'ꞃ',
  38147. 'êž„' => 'êž…',
  38148. 'Ꞇ' => 'ꞇ',
  38149. 'Ꞌ' => 'ꞌ',
  38150. '�' => 'ɥ',
  38151. '�' => 'ꞑ',
  38152. 'êž’' => 'êž“',
  38153. 'êž–' => 'êž—',
  38154. 'Ꞙ' => 'ꞙ',
  38155. 'êžš' => 'êž›',
  38156. 'Ꞝ' => '�',
  38157. 'Ꞟ' => 'ꞟ',
  38158. 'êž ' => 'êž¡',
  38159. 'Ꞣ' => 'ꞣ',
  38160. 'Ꞥ' => 'ꞥ',
  38161. 'Ꞧ' => 'ꞧ',
  38162. 'Ꞩ' => 'ꞩ',
  38163. 'Ɦ' => 'ɦ',
  38164. 'Ɜ' => 'ɜ',
  38165. 'Ɡ' => 'ɡ',
  38166. 'Ɬ' => 'ɬ',
  38167. 'êž°' => 'Êž',
  38168. 'Ʇ' => 'ʇ',
  38169. 'A' => '�',
  38170. 'B' => 'b',
  38171. 'C' => 'c',
  38172. 'D' => 'd',
  38173. 'ï¼¥' => 'ï½…',
  38174. 'F' => 'f',
  38175. 'G' => 'g',
  38176. 'H' => 'h',
  38177. 'I' => 'i',
  38178. 'J' => 'j',
  38179. 'K' => 'k',
  38180. 'L' => 'l',
  38181. 'M' => '�',
  38182. 'N' => 'n',
  38183. 'O' => '�',
  38184. 'P' => '�',
  38185. 'Q' => 'q',
  38186. 'ï¼²' => 'ï½’',
  38187. 'S' => 's',
  38188. 'ï¼´' => 'ï½”',
  38189. 'U' => 'u',
  38190. 'V' => 'v',
  38191. 'ï¼·' => 'ï½—',
  38192. 'X' => 'x',
  38193. 'ï¼¹' => 'ï½™',
  38194. 'Z' => 'z',
  38195. '�' => '�',
  38196. '�' => '�',
  38197. '�' => '�',
  38198. '�' => '�',
  38199. '�' => '�',
  38200. '�' => '�',
  38201. '�' => '�',
  38202. '�' => '�',
  38203. '�' => '�',
  38204. '�' => '�',
  38205. '�' => '�',
  38206. '�' => '�',
  38207. '�' => '�',
  38208. '�' => '�',
  38209. '�' => '�',
  38210. '�' => '�',
  38211. '�' => '�',
  38212. '�' => '�',
  38213. '�' => '�',
  38214. '�' => '�',
  38215. '�' => '�',
  38216. '�' => '�',
  38217. '�' => '�',
  38218. '�' => '�',
  38219. '�' => '�',
  38220. '�' => '�',
  38221. '�' => '�',
  38222. '�' => '�',
  38223. '�' => '�',
  38224. '�' => '�',
  38225. '�' => '�',
  38226. '�' => '�',
  38227. '�' => '�',
  38228. '�' => '�',
  38229. '�' => '�',
  38230. '�' => '�',
  38231. '�' => '�',
  38232. '�' => '�',
  38233. '�' => '�',
  38234. '�' => '�',
  38235. 'ð‘¢ ' => 'ð‘£€',
  38236. '𑢡' => '�',
  38237. '𑢢' => '𑣂',
  38238. '𑢣' => '𑣃',
  38239. '𑢤' => '𑣄',
  38240. 'ð‘¢¥' => 'ð‘£…',
  38241. '𑢦' => '𑣆',
  38242. '𑢧' => '𑣇',
  38243. '𑢨' => '𑣈',
  38244. '𑢩' => '𑣉',
  38245. '𑢪' => '𑣊',
  38246. '𑢫' => '𑣋',
  38247. '𑢬' => '𑣌',
  38248. '𑢭' => '�',
  38249. '𑢮' => '𑣎',
  38250. '𑢯' => '�',
  38251. '𑢰' => '�',
  38252. '𑢱' => '𑣑',
  38253. 'ð‘¢²' => 'ð‘£’',
  38254. '𑢳' => '𑣓',
  38255. 'ð‘¢´' => 'ð‘£”',
  38256. '𑢵' => '𑣕',
  38257. '𑢶' => '𑣖',
  38258. 'ð‘¢·' => 'ð‘£—',
  38259. '𑢸' => '𑣘',
  38260. 'ð‘¢¹' => 'ð‘£™',
  38261. '𑢺' => '𑣚',
  38262. 'ð‘¢»' => 'ð‘£›',
  38263. '𑢼' => '𑣜',
  38264. '𑢽' => '�',
  38265. '𑢾' => '𑣞',
  38266. '𑢿' => '𑣟',
  38267. );
  38268. $result =& $data;
  38269. unset($data);
  38270. return $result;
  38271. <?php
  38272. static $data = array (
  38273. 'a' => 'A',
  38274. 'b' => 'B',
  38275. 'c' => 'C',
  38276. 'd' => 'D',
  38277. 'e' => 'E',
  38278. 'f' => 'F',
  38279. 'g' => 'G',
  38280. 'h' => 'H',
  38281. 'i' => 'I',
  38282. 'j' => 'J',
  38283. 'k' => 'K',
  38284. 'l' => 'L',
  38285. 'm' => 'M',
  38286. 'n' => 'N',
  38287. 'o' => 'O',
  38288. 'p' => 'P',
  38289. 'q' => 'Q',
  38290. 'r' => 'R',
  38291. 's' => 'S',
  38292. 't' => 'T',
  38293. 'u' => 'U',
  38294. 'v' => 'V',
  38295. 'w' => 'W',
  38296. 'x' => 'X',
  38297. 'y' => 'Y',
  38298. 'z' => 'Z',
  38299. 'µ' => 'Μ',
  38300. 'à' => 'À',
  38301. 'á' => '�',
  38302. 'â' => 'Â',
  38303. 'ã' => 'Ã',
  38304. 'ä' => 'Ä',
  38305. 'Ã¥' => 'Ã…',
  38306. 'æ' => 'Æ',
  38307. 'ç' => 'Ç',
  38308. 'è' => 'È',
  38309. 'é' => 'É',
  38310. 'ê' => 'Ê',
  38311. 'ë' => 'Ë',
  38312. 'ì' => 'Ì',
  38313. 'í' => '�',
  38314. 'î' => 'Î',
  38315. 'ï' => '�',
  38316. 'ð' => '�',
  38317. 'ñ' => 'Ñ',
  38318. 'ò' => 'Ò',
  38319. 'ó' => 'Ó',
  38320. 'ô' => 'Ô',
  38321. 'õ' => 'Õ',
  38322. 'ö' => 'Ö',
  38323. 'ø' => 'Ø',
  38324. 'ù' => 'Ù',
  38325. 'ú' => 'Ú',
  38326. 'û' => 'Û',
  38327. 'ü' => 'Ü',
  38328. 'ý' => '�',
  38329. 'þ' => 'Þ',
  38330. 'ÿ' => 'Ÿ',
  38331. '�' => 'Ā',
  38332. 'ă' => 'Ă',
  38333. 'Ä…' => 'Ä„',
  38334. 'ć' => 'Ć',
  38335. 'ĉ' => 'Ĉ',
  38336. 'Ä‹' => 'ÄŠ',
  38337. '�' => 'Č',
  38338. '�' => 'Ď',
  38339. 'đ' => '�',
  38340. 'Ä“' => 'Ä’',
  38341. 'Ä•' => 'Ä”',
  38342. 'Ä—' => 'Ä–',
  38343. 'ę' => 'Ę',
  38344. 'Ä›' => 'Äš',
  38345. '�' => 'Ĝ',
  38346. 'ÄŸ' => 'Äž',
  38347. 'Ä¡' => 'Ä ',
  38348. 'Ä£' => 'Ä¢',
  38349. 'ĥ' => 'Ĥ',
  38350. 'ħ' => 'Ħ',
  38351. 'ĩ' => 'Ĩ',
  38352. 'ī' => 'Ī',
  38353. 'ĭ' => 'Ĭ',
  38354. 'į' => 'Į',
  38355. 'ı' => 'I',
  38356. 'ij' => 'IJ',
  38357. 'ĵ' => 'Ĵ',
  38358. 'ķ' => 'Ķ',
  38359. 'ĺ' => 'Ĺ',
  38360. 'ļ' => 'Ļ',
  38361. 'ľ' => 'Ľ',
  38362. 'Å€' => 'Ä¿',
  38363. 'ł' => '�',
  38364. 'ń' => 'Ń',
  38365. 'ņ' => 'Ņ',
  38366. 'ň' => 'Ň',
  38367. 'Å‹' => 'ÅŠ',
  38368. '�' => 'Ō',
  38369. '�' => 'Ŏ',
  38370. 'ő' => '�',
  38371. 'Å“' => 'Å’',
  38372. 'Å•' => 'Å”',
  38373. 'Å—' => 'Å–',
  38374. 'ř' => 'Ř',
  38375. 'Å›' => 'Åš',
  38376. '�' => 'Ŝ',
  38377. 'ÅŸ' => 'Åž',
  38378. 'Å¡' => 'Å ',
  38379. 'Å£' => 'Å¢',
  38380. 'ť' => 'Ť',
  38381. 'ŧ' => 'Ŧ',
  38382. 'ũ' => 'Ũ',
  38383. 'ū' => 'Ū',
  38384. 'ŭ' => 'Ŭ',
  38385. 'ů' => 'Ů',
  38386. 'ű' => 'Ű',
  38387. 'ų' => 'Ų',
  38388. 'ŵ' => 'Ŵ',
  38389. 'ŷ' => 'Ŷ',
  38390. 'ź' => 'Ź',
  38391. 'ż' => 'Ż',
  38392. 'ž' => 'Ž',
  38393. 'Å¿' => 'S',
  38394. 'ƀ' => 'Ƀ',
  38395. 'ƃ' => 'Ƃ',
  38396. 'Æ…' => 'Æ„',
  38397. 'ƈ' => 'Ƈ',
  38398. 'ƌ' => 'Ƌ',
  38399. 'Æ’' => 'Æ‘',
  38400. 'ƕ' => 'Ƕ',
  38401. 'ƙ' => 'Ƙ',
  38402. 'ƚ' => 'Ƚ',
  38403. 'Æž' => 'È ',
  38404. 'Æ¡' => 'Æ ',
  38405. 'Æ£' => 'Æ¢',
  38406. 'ƥ' => 'Ƥ',
  38407. 'ƨ' => 'Ƨ',
  38408. 'ƭ' => 'Ƭ',
  38409. 'ư' => 'Ư',
  38410. 'ƴ' => 'Ƴ',
  38411. 'ƶ' => 'Ƶ',
  38412. 'ƹ' => 'Ƹ',
  38413. 'ƽ' => 'Ƽ',
  38414. 'Æ¿' => 'Ç·',
  38415. 'Ç…' => 'Ç„',
  38416. 'dž' => 'DŽ',
  38417. 'Lj' => 'LJ',
  38418. 'lj' => 'LJ',
  38419. 'Ç‹' => 'ÇŠ',
  38420. 'nj' => 'NJ',
  38421. 'ǎ' => '�',
  38422. '�' => '�',
  38423. 'Ç’' => 'Ç‘',
  38424. 'Ç”' => 'Ç“',
  38425. 'Ç–' => 'Ç•',
  38426. 'ǘ' => 'Ǘ',
  38427. 'Çš' => 'Ç™',
  38428. 'ǜ' => 'Ǜ',
  38429. '�' => 'Ǝ',
  38430. 'ÇŸ' => 'Çž',
  38431. 'Ç¡' => 'Ç ',
  38432. 'Ç£' => 'Ç¢',
  38433. 'ǥ' => 'Ǥ',
  38434. 'ǧ' => 'Ǧ',
  38435. 'ǩ' => 'Ǩ',
  38436. 'ǫ' => 'Ǫ',
  38437. 'ǭ' => 'Ǭ',
  38438. 'ǯ' => 'Ǯ',
  38439. 'Dz' => 'DZ',
  38440. 'dz' => 'DZ',
  38441. 'ǵ' => 'Ǵ',
  38442. 'ǹ' => 'Ǹ',
  38443. 'ǻ' => 'Ǻ',
  38444. 'ǽ' => 'Ǽ',
  38445. 'ǿ' => 'Ǿ',
  38446. '�' => 'Ȁ',
  38447. 'ȃ' => 'Ȃ',
  38448. 'È…' => 'È„',
  38449. 'ȇ' => 'Ȇ',
  38450. 'ȉ' => 'Ȉ',
  38451. 'È‹' => 'ÈŠ',
  38452. '�' => 'Ȍ',
  38453. '�' => 'Ȏ',
  38454. 'ȑ' => '�',
  38455. 'È“' => 'È’',
  38456. 'È•' => 'È”',
  38457. 'È—' => 'È–',
  38458. 'ș' => 'Ș',
  38459. 'È›' => 'Èš',
  38460. '�' => 'Ȝ',
  38461. 'ÈŸ' => 'Èž',
  38462. 'È£' => 'È¢',
  38463. 'ȥ' => 'Ȥ',
  38464. 'ȧ' => 'Ȧ',
  38465. 'ȩ' => 'Ȩ',
  38466. 'ȫ' => 'Ȫ',
  38467. 'ȭ' => 'Ȭ',
  38468. 'ȯ' => 'Ȯ',
  38469. 'ȱ' => 'Ȱ',
  38470. 'ȳ' => 'Ȳ',
  38471. 'ȼ' => 'Ȼ',
  38472. 'È¿' => 'â±¾',
  38473. 'ɀ' => 'Ɀ',
  38474. 'ɂ' => '�',
  38475. 'ɇ' => 'Ɇ',
  38476. 'ɉ' => 'Ɉ',
  38477. 'É‹' => 'ÉŠ',
  38478. '�' => 'Ɍ',
  38479. '�' => 'Ɏ',
  38480. '�' => 'Ɐ',
  38481. 'É‘' => 'â±­',
  38482. 'É’' => 'â±°',
  38483. 'ɓ' => '�',
  38484. 'ɔ' => 'Ɔ',
  38485. 'ɖ' => 'Ɖ',
  38486. 'É—' => 'ÆŠ',
  38487. 'ə' => '�',
  38488. 'ɛ' => '�',
  38489. 'ɜ' => 'Ɜ',
  38490. 'É ' => 'Æ“',
  38491. 'ɡ' => 'Ɡ',
  38492. 'É£' => 'Æ”',
  38493. 'ɥ' => '�',
  38494. 'ɦ' => 'Ɦ',
  38495. 'ɨ' => 'Ɨ',
  38496. 'É©' => 'Æ–',
  38497. 'É«' => 'â±¢',
  38498. 'ɬ' => 'Ɬ',
  38499. 'ɯ' => 'Ɯ',
  38500. 'ɱ' => 'Ɱ',
  38501. 'ɲ' => '�',
  38502. 'ɵ' => 'Ɵ',
  38503. 'ɽ' => 'Ɽ',
  38504. 'ʀ' => 'Ʀ',
  38505. 'ʃ' => 'Ʃ',
  38506. 'ʇ' => 'Ʇ',
  38507. 'ʈ' => 'Ʈ',
  38508. 'ʉ' => 'Ʉ',
  38509. 'ʊ' => 'Ʊ',
  38510. 'ʋ' => 'Ʋ',
  38511. 'ʌ' => 'Ʌ',
  38512. 'Ê’' => 'Æ·',
  38513. 'Êž' => 'êž°',
  38514. 'ͅ' => 'Ι',
  38515. 'ͱ' => 'Ͱ',
  38516. 'ͳ' => 'Ͳ',
  38517. 'ͷ' => 'Ͷ',
  38518. 'ͻ' => 'Ͻ',
  38519. 'ͼ' => 'Ͼ',
  38520. 'ͽ' => 'Ͽ',
  38521. 'ά' => 'Ά',
  38522. 'έ' => 'Έ',
  38523. 'ή' => 'Ή',
  38524. 'ί' => 'Ί',
  38525. 'α' => 'Α',
  38526. 'β' => 'Β',
  38527. 'γ' => 'Γ',
  38528. 'δ' => 'Δ',
  38529. 'ε' => 'Ε',
  38530. 'ζ' => 'Ζ',
  38531. 'η' => 'Η',
  38532. 'θ' => 'Θ',
  38533. 'ι' => 'Ι',
  38534. 'κ' => 'Κ',
  38535. 'λ' => 'Λ',
  38536. 'μ' => 'Μ',
  38537. 'ν' => '�',
  38538. 'ξ' => 'Ξ',
  38539. 'ο' => 'Ο',
  38540. 'π' => 'Π',
  38541. '�' => 'Ρ',
  38542. 'ς' => 'Σ',
  38543. 'σ' => 'Σ',
  38544. 'τ' => 'Τ',
  38545. 'Ï…' => 'Î¥',
  38546. 'φ' => 'Φ',
  38547. 'χ' => 'Χ',
  38548. 'ψ' => 'Ψ',
  38549. 'ω' => 'Ω',
  38550. 'ϊ' => 'Ϊ',
  38551. 'ϋ' => 'Ϋ',
  38552. 'ό' => 'Ό',
  38553. '�' => 'Ύ',
  38554. 'ώ' => '�',
  38555. '�' => 'Β',
  38556. 'ϑ' => 'Θ',
  38557. 'ϕ' => 'Φ',
  38558. 'ϖ' => 'Π',
  38559. 'ϗ' => '�',
  38560. 'ϙ' => 'Ϙ',
  38561. 'Ï›' => 'Ïš',
  38562. '�' => 'Ϝ',
  38563. 'ÏŸ' => 'Ïž',
  38564. 'Ï¡' => 'Ï ',
  38565. 'Ï£' => 'Ï¢',
  38566. 'ϥ' => 'Ϥ',
  38567. 'ϧ' => 'Ϧ',
  38568. 'ϩ' => 'Ϩ',
  38569. 'ϫ' => 'Ϫ',
  38570. 'ϭ' => 'Ϭ',
  38571. 'ϯ' => 'Ϯ',
  38572. 'ϰ' => 'Κ',
  38573. 'ϱ' => 'Ρ',
  38574. 'ϲ' => 'Ϲ',
  38575. 'ϳ' => 'Ϳ',
  38576. 'ϵ' => 'Ε',
  38577. 'ϸ' => 'Ϸ',
  38578. 'ϻ' => 'Ϻ',
  38579. 'а' => '�',
  38580. 'б' => 'Б',
  38581. 'в' => 'В',
  38582. 'г' => 'Г',
  38583. 'д' => 'Д',
  38584. 'е' => 'Е',
  38585. 'ж' => 'Ж',
  38586. 'з' => 'З',
  38587. 'и' => 'И',
  38588. 'й' => 'Й',
  38589. 'к' => 'К',
  38590. 'л' => 'Л',
  38591. 'м' => 'М',
  38592. 'н' => '�',
  38593. 'о' => 'О',
  38594. 'п' => 'П',
  38595. 'р' => 'Р',
  38596. '�' => 'С',
  38597. 'т' => 'Т',
  38598. 'у' => 'У',
  38599. 'ф' => 'Ф',
  38600. 'Ñ…' => 'Ð¥',
  38601. 'ц' => 'Ц',
  38602. 'ч' => 'Ч',
  38603. 'ш' => 'Ш',
  38604. 'щ' => 'Щ',
  38605. 'ъ' => 'Ъ',
  38606. 'ы' => 'Ы',
  38607. 'ь' => 'Ь',
  38608. '�' => 'Э',
  38609. 'ю' => 'Ю',
  38610. '�' => 'Я',
  38611. '�' => 'Ѐ',
  38612. 'ё' => '�',
  38613. 'ђ' => 'Ђ',
  38614. 'ѓ' => 'Ѓ',
  38615. 'є' => 'Є',
  38616. 'Ñ•' => 'Ð…',
  38617. 'і' => 'І',
  38618. 'ї' => 'Ї',
  38619. 'ј' => 'Ј',
  38620. 'љ' => 'Љ',
  38621. 'њ' => 'Њ',
  38622. 'ћ' => 'Ћ',
  38623. 'ќ' => 'Ќ',
  38624. '�' => '�',
  38625. 'Ñž' => 'ÐŽ',
  38626. 'џ' => '�',
  38627. 'Ñ¡' => 'Ñ ',
  38628. 'Ñ£' => 'Ñ¢',
  38629. 'ѥ' => 'Ѥ',
  38630. 'ѧ' => 'Ѧ',
  38631. 'ѩ' => 'Ѩ',
  38632. 'ѫ' => 'Ѫ',
  38633. 'ѭ' => 'Ѭ',
  38634. 'ѯ' => 'Ѯ',
  38635. 'ѱ' => 'Ѱ',
  38636. 'ѳ' => 'Ѳ',
  38637. 'ѵ' => 'Ѵ',
  38638. 'ѷ' => 'Ѷ',
  38639. 'ѹ' => 'Ѹ',
  38640. 'ѻ' => 'Ѻ',
  38641. 'ѽ' => 'Ѽ',
  38642. 'ѿ' => 'Ѿ',
  38643. 'Ò�' => 'Ò€',
  38644. 'Ò‹' => 'ÒŠ',
  38645. '�' => 'Ҍ',
  38646. 'Ò�' => 'ÒŽ',
  38647. 'Ò‘' => 'Ò�',
  38648. 'Ò“' => 'Ò’',
  38649. 'Ò•' => 'Ò”',
  38650. 'Ò—' => 'Ò–',
  38651. 'Ò™' => 'Ò˜',
  38652. 'Ò›' => 'Òš',
  38653. '�' => 'Ҝ',
  38654. 'ÒŸ' => 'Òž',
  38655. 'Ò¡' => 'Ò ',
  38656. 'Ò£' => 'Ò¢',
  38657. 'Ò¥' => 'Ò¤',
  38658. 'Ò§' => 'Ò¦',
  38659. 'Ò©' => 'Ò¨',
  38660. 'Ò«' => 'Òª',
  38661. 'Ò­' => 'Ò¬',
  38662. 'Ò¯' => 'Ò®',
  38663. 'Ò±' => 'Ò°',
  38664. 'Ò³' => 'Ò²',
  38665. 'Òµ' => 'Ò´',
  38666. 'Ò·' => 'Ò¶',
  38667. 'Ò¹' => 'Ò¸',
  38668. 'Ò»' => 'Òº',
  38669. 'Ò½' => 'Ò¼',
  38670. 'Ò¿' => 'Ò¾',
  38671. 'Ó‚' => 'Ó�',
  38672. 'Ó„' => 'Óƒ',
  38673. 'Ó†' => 'Ó…',
  38674. 'Óˆ' => 'Ó‡',
  38675. 'ÓŠ' => 'Ó‰',
  38676. 'ӌ' => 'Ӌ',
  38677. 'ÓŽ' => 'Ó�',
  38678. 'Ó�' => 'Ó€',
  38679. 'Ó‘' => 'Ó�',
  38680. 'Ó“' => 'Ó’',
  38681. 'Ó•' => 'Ó”',
  38682. 'Ó—' => 'Ó–',
  38683. 'Ó™' => 'Ó˜',
  38684. 'Ó›' => 'Óš',
  38685. '�' => 'Ӝ',
  38686. 'ÓŸ' => 'Óž',
  38687. 'Ó¡' => 'Ó ',
  38688. 'Ó£' => 'Ó¢',
  38689. 'Ó¥' => 'Ó¤',
  38690. 'Ó§' => 'Ó¦',
  38691. 'Ó©' => 'Ó¨',
  38692. 'Ó«' => 'Óª',
  38693. 'Ó­' => 'Ó¬',
  38694. 'Ó¯' => 'Ó®',
  38695. 'Ó±' => 'Ó°',
  38696. 'Ó³' => 'Ó²',
  38697. 'Óµ' => 'Ó´',
  38698. 'Ó·' => 'Ó¶',
  38699. 'Ó¹' => 'Ó¸',
  38700. 'Ó»' => 'Óº',
  38701. 'Ó½' => 'Ó¼',
  38702. 'Ó¿' => 'Ó¾',
  38703. 'Ô�' => 'Ô€',
  38704. 'Ôƒ' => 'Ô‚',
  38705. 'Ô…' => 'Ô„',
  38706. 'Ô‡' => 'Ô†',
  38707. 'Ô‰' => 'Ôˆ',
  38708. 'Ô‹' => 'ÔŠ',
  38709. '�' => 'Ԍ',
  38710. 'Ô�' => 'ÔŽ',
  38711. 'Ô‘' => 'Ô�',
  38712. 'Ô“' => 'Ô’',
  38713. 'Ô•' => 'Ô”',
  38714. 'Ô—' => 'Ô–',
  38715. 'Ô™' => 'Ô˜',
  38716. 'Ô›' => 'Ôš',
  38717. '�' => 'Ԝ',
  38718. 'ÔŸ' => 'Ôž',
  38719. 'Ô¡' => 'Ô ',
  38720. 'Ô£' => 'Ô¢',
  38721. 'Ô¥' => 'Ô¤',
  38722. 'Ô§' => 'Ô¦',
  38723. 'Ô©' => 'Ô¨',
  38724. 'Ô«' => 'Ôª',
  38725. 'Ô­' => 'Ô¬',
  38726. 'Ô¯' => 'Ô®',
  38727. 'Õ¡' => 'Ô±',
  38728. 'Õ¢' => 'Ô²',
  38729. 'Õ£' => 'Ô³',
  38730. 'Õ¤' => 'Ô´',
  38731. 'Õ¥' => 'Ôµ',
  38732. 'Õ¦' => 'Ô¶',
  38733. 'Õ§' => 'Ô·',
  38734. 'Õ¨' => 'Ô¸',
  38735. 'Õ©' => 'Ô¹',
  38736. 'Õª' => 'Ôº',
  38737. 'Õ«' => 'Ô»',
  38738. 'Õ¬' => 'Ô¼',
  38739. 'Õ­' => 'Ô½',
  38740. 'Õ®' => 'Ô¾',
  38741. 'Õ¯' => 'Ô¿',
  38742. 'Õ°' => 'Õ€',
  38743. 'Õ±' => 'Õ�',
  38744. 'Õ²' => 'Õ‚',
  38745. 'Õ³' => 'Õƒ',
  38746. 'Õ´' => 'Õ„',
  38747. 'Õµ' => 'Õ…',
  38748. 'Õ¶' => 'Õ†',
  38749. 'Õ·' => 'Õ‡',
  38750. 'Õ¸' => 'Õˆ',
  38751. 'Õ¹' => 'Õ‰',
  38752. 'Õº' => 'ÕŠ',
  38753. 'Õ»' => 'Õ‹',
  38754. 'ռ' => 'Ռ',
  38755. 'Õ½' => 'Õ�',
  38756. 'Õ¾' => 'ÕŽ',
  38757. 'Õ¿' => 'Õ�',
  38758. 'Ö€' => 'Õ�',
  38759. 'Ö�' => 'Õ‘',
  38760. 'Ö‚' => 'Õ’',
  38761. 'Öƒ' => 'Õ“',
  38762. 'Ö„' => 'Õ”',
  38763. 'Ö…' => 'Õ•',
  38764. 'Ö†' => 'Õ–',
  38765. 'ᵹ' => '�',
  38766. 'áµ½' => 'â±£',
  38767. '�' => 'Ḁ',
  38768. 'ḃ' => 'Ḃ',
  38769. 'ḅ' => 'Ḅ',
  38770. 'ḇ' => 'Ḇ',
  38771. 'ḉ' => 'Ḉ',
  38772. 'ḋ' => 'Ḋ',
  38773. '�' => 'Ḍ',
  38774. '�' => 'Ḏ',
  38775. 'ḑ' => '�',
  38776. 'ḓ' => 'Ḓ',
  38777. 'ḕ' => 'Ḕ',
  38778. 'ḗ' => 'Ḗ',
  38779. 'ḙ' => 'Ḙ',
  38780. 'ḛ' => 'Ḛ',
  38781. '�' => 'Ḝ',
  38782. 'ḟ' => 'Ḟ',
  38783. 'ḡ' => 'Ḡ',
  38784. 'ḣ' => 'Ḣ',
  38785. 'ḥ' => 'Ḥ',
  38786. 'ḧ' => 'Ḧ',
  38787. 'ḩ' => 'Ḩ',
  38788. 'ḫ' => 'Ḫ',
  38789. 'ḭ' => 'Ḭ',
  38790. 'ḯ' => 'Ḯ',
  38791. 'ḱ' => 'Ḱ',
  38792. 'ḳ' => 'Ḳ',
  38793. 'ḵ' => 'Ḵ',
  38794. 'ḷ' => 'Ḷ',
  38795. 'ḹ' => 'Ḹ',
  38796. 'ḻ' => 'Ḻ',
  38797. 'ḽ' => 'Ḽ',
  38798. 'ḿ' => 'Ḿ',
  38799. '�' => 'Ṁ',
  38800. 'ṃ' => 'Ṃ',
  38801. 'ṅ' => 'Ṅ',
  38802. 'ṇ' => 'Ṇ',
  38803. 'ṉ' => 'Ṉ',
  38804. 'ṋ' => 'Ṋ',
  38805. '�' => 'Ṍ',
  38806. '�' => 'Ṏ',
  38807. 'ṑ' => '�',
  38808. 'ṓ' => 'Ṓ',
  38809. 'ṕ' => 'Ṕ',
  38810. 'á¹—' => 'á¹–',
  38811. 'ṙ' => 'Ṙ',
  38812. 'ṛ' => 'Ṛ',
  38813. '�' => 'Ṝ',
  38814. 'ṟ' => 'Ṟ',
  38815. 'ṡ' => 'Ṡ',
  38816. 'á¹£' => 'á¹¢',
  38817. 'ṥ' => 'Ṥ',
  38818. 'ṧ' => 'Ṧ',
  38819. 'ṩ' => 'Ṩ',
  38820. 'ṫ' => 'Ṫ',
  38821. 'ṭ' => 'Ṭ',
  38822. 'ṯ' => 'Ṯ',
  38823. 'á¹±' => 'á¹°',
  38824. 'á¹³' => 'á¹²',
  38825. 'á¹µ' => 'á¹´',
  38826. 'ṷ' => 'Ṷ',
  38827. 'ṹ' => 'Ṹ',
  38828. 'ṻ' => 'Ṻ',
  38829. 'á¹½' => 'á¹¼',
  38830. 'ṿ' => 'Ṿ',
  38831. '�' => 'Ẁ',
  38832. 'ẃ' => 'Ẃ',
  38833. 'ẅ' => 'Ẅ',
  38834. 'ẇ' => 'Ẇ',
  38835. 'ẉ' => 'Ẉ',
  38836. 'ẋ' => 'Ẋ',
  38837. '�' => 'Ẍ',
  38838. '�' => 'Ẏ',
  38839. 'ẑ' => '�',
  38840. 'ẓ' => 'Ẓ',
  38841. 'ẕ' => 'Ẕ',
  38842. 'ẛ' => 'Ṡ',
  38843. 'ạ' => 'Ạ',
  38844. 'ả' => 'Ả',
  38845. 'ấ' => 'Ấ',
  38846. 'ầ' => 'Ầ',
  38847. 'ẩ' => 'Ẩ',
  38848. 'ẫ' => 'Ẫ',
  38849. 'ậ' => 'Ậ',
  38850. 'ắ' => 'Ắ',
  38851. 'ằ' => 'Ằ',
  38852. 'ẳ' => 'Ẳ',
  38853. 'ẵ' => 'Ẵ',
  38854. 'ặ' => 'Ặ',
  38855. 'ẹ' => 'Ẹ',
  38856. 'ẻ' => 'Ẻ',
  38857. 'ẽ' => 'Ẽ',
  38858. 'ế' => 'Ế',
  38859. '�' => 'Ề',
  38860. 'ể' => 'Ể',
  38861. 'ễ' => 'Ễ',
  38862. 'ệ' => 'Ệ',
  38863. 'ỉ' => 'Ỉ',
  38864. 'ị' => 'Ị',
  38865. '�' => 'Ọ',
  38866. '�' => 'Ỏ',
  38867. 'ố' => '�',
  38868. 'ồ' => 'Ồ',
  38869. 'ổ' => 'Ổ',
  38870. 'á»—' => 'á»–',
  38871. 'ộ' => 'Ộ',
  38872. 'ớ' => 'Ớ',
  38873. '�' => 'Ờ',
  38874. 'ở' => 'Ở',
  38875. 'ỡ' => 'Ỡ',
  38876. 'ợ' => 'Ợ',
  38877. 'ụ' => 'Ụ',
  38878. 'ủ' => 'Ủ',
  38879. 'ứ' => 'Ứ',
  38880. 'ừ' => 'Ừ',
  38881. 'ử' => 'Ử',
  38882. 'ữ' => 'Ữ',
  38883. 'á»±' => 'á»°',
  38884. 'ỳ' => 'Ỳ',
  38885. 'ỵ' => 'Ỵ',
  38886. 'ỷ' => 'Ỷ',
  38887. 'ỹ' => 'Ỹ',
  38888. 'ỻ' => 'Ỻ',
  38889. 'ỽ' => 'Ỽ',
  38890. 'ỿ' => 'Ỿ',
  38891. 'ἀ' => 'Ἀ',
  38892. '�' => 'Ἁ',
  38893. 'ἂ' => 'Ἂ',
  38894. 'ἃ' => 'Ἃ',
  38895. 'ἄ' => 'Ἄ',
  38896. 'ἅ' => '�',
  38897. 'ἆ' => 'Ἆ',
  38898. 'ἇ' => '�',
  38899. '�' => 'Ἐ',
  38900. 'ἑ' => 'Ἑ',
  38901. 'ἒ' => 'Ἒ',
  38902. 'ἓ' => 'Ἓ',
  38903. 'ἔ' => 'Ἔ',
  38904. 'ἕ' => '�',
  38905. 'ἠ' => 'Ἠ',
  38906. 'ἡ' => 'Ἡ',
  38907. 'ἢ' => 'Ἢ',
  38908. 'ἣ' => 'Ἣ',
  38909. 'ἤ' => 'Ἤ',
  38910. 'á¼¥' => 'á¼­',
  38911. 'ἦ' => 'Ἦ',
  38912. 'ἧ' => 'Ἧ',
  38913. 'ἰ' => 'Ἰ',
  38914. 'á¼±' => 'á¼¹',
  38915. 'ἲ' => 'Ἲ',
  38916. 'á¼³' => 'á¼»',
  38917. 'á¼´' => 'á¼¼',
  38918. 'á¼µ' => 'á¼½',
  38919. 'ἶ' => 'Ἶ',
  38920. 'ἷ' => 'Ἷ',
  38921. 'ὀ' => 'Ὀ',
  38922. '�' => 'Ὁ',
  38923. 'ὂ' => 'Ὂ',
  38924. 'ὃ' => 'Ὃ',
  38925. 'ὄ' => 'Ὄ',
  38926. 'ὅ' => '�',
  38927. 'ὑ' => 'Ὑ',
  38928. 'ὓ' => 'Ὓ',
  38929. 'ὕ' => '�',
  38930. 'ὗ' => 'Ὗ',
  38931. 'ὠ' => 'Ὠ',
  38932. 'ὡ' => 'Ὡ',
  38933. 'ὢ' => 'Ὢ',
  38934. 'ὣ' => 'Ὣ',
  38935. 'ὤ' => 'Ὤ',
  38936. 'á½¥' => 'á½­',
  38937. 'ὦ' => 'Ὦ',
  38938. 'ὧ' => 'Ὧ',
  38939. 'ὰ' => 'Ὰ',
  38940. 'á½±' => 'á¾»',
  38941. 'ὲ' => 'Ὲ',
  38942. 'έ' => 'Έ',
  38943. 'á½´' => 'á¿Š',
  38944. 'á½µ' => 'á¿‹',
  38945. 'ὶ' => 'Ὶ',
  38946. 'á½·' => 'á¿›',
  38947. 'ὸ' => 'Ὸ',
  38948. 'ό' => 'Ό',
  38949. 'ὺ' => 'Ὺ',
  38950. 'á½»' => 'á¿«',
  38951. 'ὼ' => 'Ὼ',
  38952. 'á½½' => 'á¿»',
  38953. 'ᾀ' => 'ᾈ',
  38954. '�' => 'ᾉ',
  38955. 'ᾂ' => 'ᾊ',
  38956. 'ᾃ' => 'ᾋ',
  38957. 'ᾄ' => 'ᾌ',
  38958. 'ᾅ' => '�',
  38959. 'ᾆ' => 'ᾎ',
  38960. 'ᾇ' => '�',
  38961. '�' => 'ᾘ',
  38962. 'ᾑ' => 'ᾙ',
  38963. 'ᾒ' => 'ᾚ',
  38964. 'ᾓ' => 'ᾛ',
  38965. 'ᾔ' => 'ᾜ',
  38966. 'ᾕ' => '�',
  38967. 'ᾖ' => 'ᾞ',
  38968. 'ᾗ' => 'ᾟ',
  38969. 'ᾠ' => 'ᾨ',
  38970. 'ᾡ' => 'ᾩ',
  38971. 'ᾢ' => 'ᾪ',
  38972. 'ᾣ' => 'ᾫ',
  38973. 'ᾤ' => 'ᾬ',
  38974. 'á¾¥' => 'á¾­',
  38975. 'ᾦ' => 'ᾮ',
  38976. 'ᾧ' => 'ᾯ',
  38977. 'ᾰ' => 'Ᾰ',
  38978. 'á¾±' => 'á¾¹',
  38979. 'á¾³' => 'á¾¼',
  38980. 'ι' => 'Ι',
  38981. 'ῃ' => 'ῌ',
  38982. '�' => 'Ῐ',
  38983. 'á¿‘' => 'á¿™',
  38984. 'ῠ' => 'Ῠ',
  38985. 'á¿¡' => 'á¿©',
  38986. 'ῥ' => 'Ῥ',
  38987. 'ῳ' => 'ῼ',
  38988. 'ⅎ' => 'Ⅎ',
  38989. 'â…°' => 'â… ',
  38990. 'â…±' => 'â…¡',
  38991. 'â…²' => 'â…¢',
  38992. 'â…³' => 'â…£',
  38993. 'â…´' => 'â…¤',
  38994. 'â…µ' => 'â…¥',
  38995. 'â…¶' => 'â…¦',
  38996. 'â…·' => 'â…§',
  38997. 'â…¸' => 'â…¨',
  38998. 'â…¹' => 'â…©',
  38999. 'â…º' => 'â…ª',
  39000. 'â…»' => 'â…«',
  39001. 'â…¼' => 'â…¬',
  39002. 'â…½' => 'â…­',
  39003. 'â…¾' => 'â…®',
  39004. 'â…¿' => 'â…¯',
  39005. 'ↄ' => 'Ↄ',
  39006. '�' => 'Ⓐ',
  39007. 'â“‘' => 'â’·',
  39008. 'â“’' => 'â’¸',
  39009. 'â““' => 'â’¹',
  39010. 'â“”' => 'â’º',
  39011. 'â“•' => 'â’»',
  39012. 'â“–' => 'â’¼',
  39013. 'â“—' => 'â’½',
  39014. 'ⓘ' => 'Ⓘ',
  39015. 'â“™' => 'â’¿',
  39016. 'â“š' => 'â“€',
  39017. 'ⓛ' => '�',
  39018. 'ⓜ' => 'Ⓜ',
  39019. '�' => 'Ⓝ',
  39020. 'â“ž' => 'â“„',
  39021. 'â“Ÿ' => 'â“…',
  39022. 'ⓠ' => 'Ⓠ',
  39023. 'ⓡ' => 'Ⓡ',
  39024. 'ⓢ' => 'Ⓢ',
  39025. 'ⓣ' => 'Ⓣ',
  39026. 'ⓤ' => 'Ⓤ',
  39027. 'â“¥' => 'â“‹',
  39028. 'ⓦ' => 'Ⓦ',
  39029. 'ⓧ' => '�',
  39030. 'ⓨ' => 'Ⓨ',
  39031. 'ⓩ' => '�',
  39032. 'â°°' => 'â°€',
  39033. 'â°±' => 'â°�',
  39034. 'â°²' => 'â°‚',
  39035. 'â°³' => 'â°ƒ',
  39036. 'â°´' => 'â°„',
  39037. 'â°µ' => 'â°…',
  39038. 'â°¶' => 'â°†',
  39039. 'â°·' => 'â°‡',
  39040. 'â°¸' => 'â°ˆ',
  39041. 'â°¹' => 'â°‰',
  39042. 'â°º' => 'â°Š',
  39043. 'â°»' => 'â°‹',
  39044. 'ⰼ' => 'Ⰼ',
  39045. 'â°½' => 'â°�',
  39046. 'â°¾' => 'â°Ž',
  39047. 'â°¿' => 'â°�',
  39048. 'â±€' => 'â°�',
  39049. '�' => 'Ⱁ',
  39050. 'ⱂ' => 'Ⱂ',
  39051. 'ⱃ' => 'Ⱃ',
  39052. 'ⱄ' => 'Ⱄ',
  39053. 'â±…' => 'â°•',
  39054. 'ⱆ' => 'Ⱆ',
  39055. 'ⱇ' => 'Ⱇ',
  39056. 'ⱈ' => 'Ⱈ',
  39057. 'ⱉ' => 'Ⱉ',
  39058. 'ⱊ' => 'Ⱊ',
  39059. 'ⱋ' => 'Ⱋ',
  39060. 'ⱌ' => 'Ⱌ',
  39061. '�' => '�',
  39062. 'ⱎ' => 'Ⱎ',
  39063. '�' => 'Ⱏ',
  39064. '�' => 'Ⱐ',
  39065. 'ⱑ' => 'Ⱑ',
  39066. 'â±’' => 'â°¢',
  39067. 'ⱓ' => 'Ⱓ',
  39068. 'â±”' => 'â°¤',
  39069. 'ⱕ' => 'Ⱕ',
  39070. 'â±–' => 'â°¦',
  39071. 'â±—' => 'â°§',
  39072. 'ⱘ' => 'Ⱘ',
  39073. 'â±™' => 'â°©',
  39074. 'ⱚ' => 'Ⱚ',
  39075. 'â±›' => 'â°«',
  39076. 'ⱜ' => 'Ⱜ',
  39077. '�' => 'Ⱝ',
  39078. 'ⱞ' => 'Ⱞ',
  39079. 'ⱡ' => 'Ⱡ',
  39080. 'ⱥ' => 'Ⱥ',
  39081. 'ⱦ' => 'Ⱦ',
  39082. 'ⱨ' => 'Ⱨ',
  39083. 'ⱪ' => 'Ⱪ',
  39084. 'ⱬ' => 'Ⱬ',
  39085. 'â±³' => 'â±²',
  39086. 'ⱶ' => 'Ⱶ',
  39087. '�' => 'Ⲁ',
  39088. 'ⲃ' => 'Ⲃ',
  39089. 'ⲅ' => 'Ⲅ',
  39090. 'ⲇ' => 'Ⲇ',
  39091. 'ⲉ' => 'Ⲉ',
  39092. 'ⲋ' => 'Ⲋ',
  39093. '�' => 'Ⲍ',
  39094. '�' => 'Ⲏ',
  39095. 'ⲑ' => '�',
  39096. 'ⲓ' => 'Ⲓ',
  39097. 'ⲕ' => 'Ⲕ',
  39098. 'â²—' => 'â²–',
  39099. 'ⲙ' => 'Ⲙ',
  39100. 'ⲛ' => 'Ⲛ',
  39101. '�' => 'Ⲝ',
  39102. 'ⲟ' => 'Ⲟ',
  39103. 'ⲡ' => 'Ⲡ',
  39104. 'â²£' => 'â²¢',
  39105. 'ⲥ' => 'Ⲥ',
  39106. 'ⲧ' => 'Ⲧ',
  39107. 'ⲩ' => 'Ⲩ',
  39108. 'ⲫ' => 'Ⲫ',
  39109. 'ⲭ' => 'Ⲭ',
  39110. 'ⲯ' => 'Ⲯ',
  39111. 'â²±' => 'â²°',
  39112. 'â²³' => 'â²²',
  39113. 'â²µ' => 'â²´',
  39114. 'ⲷ' => 'Ⲷ',
  39115. 'ⲹ' => 'Ⲹ',
  39116. 'ⲻ' => 'Ⲻ',
  39117. 'â²½' => 'â²¼',
  39118. 'ⲿ' => 'Ⲿ',
  39119. '�' => 'Ⳁ',
  39120. 'ⳃ' => 'Ⳃ',
  39121. 'ⳅ' => 'Ⳅ',
  39122. 'ⳇ' => 'Ⳇ',
  39123. 'ⳉ' => 'Ⳉ',
  39124. 'ⳋ' => 'Ⳋ',
  39125. '�' => 'Ⳍ',
  39126. '�' => 'Ⳏ',
  39127. 'ⳑ' => '�',
  39128. 'ⳓ' => 'Ⳓ',
  39129. 'ⳕ' => 'Ⳕ',
  39130. 'â³—' => 'â³–',
  39131. 'ⳙ' => 'Ⳙ',
  39132. 'ⳛ' => 'Ⳛ',
  39133. '�' => 'Ⳝ',
  39134. 'ⳟ' => 'Ⳟ',
  39135. 'ⳡ' => 'Ⳡ',
  39136. 'â³£' => 'â³¢',
  39137. 'ⳬ' => 'Ⳬ',
  39138. 'â³®' => 'â³­',
  39139. 'â³³' => 'â³²',
  39140. 'â´€' => 'á‚ ',
  39141. 'â´�' => 'á‚¡',
  39142. 'â´‚' => 'á‚¢',
  39143. 'â´ƒ' => 'á‚£',
  39144. 'ⴄ' => 'Ⴄ',
  39145. 'â´…' => 'á‚¥',
  39146. 'ⴆ' => 'Ⴆ',
  39147. 'ⴇ' => 'Ⴇ',
  39148. 'ⴈ' => 'Ⴈ',
  39149. 'â´‰' => 'á‚©',
  39150. 'ⴊ' => 'Ⴊ',
  39151. 'â´‹' => 'á‚«',
  39152. 'ⴌ' => 'Ⴌ',
  39153. 'â´�' => 'á‚­',
  39154. 'â´Ž' => 'á‚®',
  39155. '�' => 'Ⴏ',
  39156. 'â´�' => 'á‚°',
  39157. 'ⴑ' => 'Ⴑ',
  39158. 'ⴒ' => 'Ⴒ',
  39159. 'ⴓ' => 'Ⴓ',
  39160. 'â´”' => 'á‚´',
  39161. 'ⴕ' => 'Ⴕ',
  39162. 'ⴖ' => 'Ⴖ',
  39163. 'â´—' => 'á‚·',
  39164. 'ⴘ' => 'Ⴘ',
  39165. 'ⴙ' => 'Ⴙ',
  39166. 'ⴚ' => 'Ⴚ',
  39167. 'â´›' => 'á‚»',
  39168. 'ⴜ' => 'Ⴜ',
  39169. '�' => 'Ⴝ',
  39170. 'ⴞ' => 'Ⴞ',
  39171. 'â´Ÿ' => 'á‚¿',
  39172. 'ⴠ' => 'Ⴠ',
  39173. 'ⴡ' => '�',
  39174. 'ⴢ' => 'Ⴢ',
  39175. 'ⴣ' => 'Ⴣ',
  39176. 'ⴤ' => 'Ⴤ',
  39177. 'ⴥ' => 'Ⴥ',
  39178. 'ⴧ' => 'Ⴧ',
  39179. 'ⴭ' => '�',
  39180. '�' => 'Ꙁ',
  39181. 'ꙃ' => 'Ꙃ',
  39182. 'ꙅ' => 'Ꙅ',
  39183. 'ꙇ' => 'Ꙇ',
  39184. 'ꙉ' => 'Ꙉ',
  39185. 'ꙋ' => 'Ꙋ',
  39186. '�' => 'Ꙍ',
  39187. '�' => 'Ꙏ',
  39188. 'ꙑ' => '�',
  39189. 'ꙓ' => 'Ꙓ',
  39190. 'ꙕ' => 'Ꙕ',
  39191. 'ê™—' => 'ê™–',
  39192. 'ꙙ' => 'Ꙙ',
  39193. 'ꙛ' => 'Ꙛ',
  39194. '�' => 'Ꙝ',
  39195. 'ꙟ' => 'Ꙟ',
  39196. 'ꙡ' => 'Ꙡ',
  39197. 'ꙣ' => 'Ꙣ',
  39198. 'ꙥ' => 'Ꙥ',
  39199. 'ꙧ' => 'Ꙧ',
  39200. 'ꙩ' => 'Ꙩ',
  39201. 'ꙫ' => 'Ꙫ',
  39202. 'ꙭ' => 'Ꙭ',
  39203. '�' => 'Ꚁ',
  39204. 'ꚃ' => 'Ꚃ',
  39205. 'êš…' => 'êš„',
  39206. 'ꚇ' => 'Ꚇ',
  39207. 'ꚉ' => 'Ꚉ',
  39208. 'ꚋ' => 'Ꚋ',
  39209. '�' => 'Ꚍ',
  39210. '�' => 'Ꚏ',
  39211. 'ꚑ' => '�',
  39212. 'êš“' => 'êš’',
  39213. 'êš•' => 'êš”',
  39214. 'êš—' => 'êš–',
  39215. 'ꚙ' => 'Ꚙ',
  39216. 'êš›' => 'êšš',
  39217. 'ꜣ' => 'Ꜣ',
  39218. 'ꜥ' => 'Ꜥ',
  39219. 'ꜧ' => 'Ꜧ',
  39220. 'ꜩ' => 'Ꜩ',
  39221. 'ꜫ' => 'Ꜫ',
  39222. 'ꜭ' => 'Ꜭ',
  39223. 'ꜯ' => 'Ꜯ',
  39224. 'ꜳ' => 'Ꜳ',
  39225. 'ꜵ' => 'Ꜵ',
  39226. 'ꜷ' => 'Ꜷ',
  39227. 'ꜹ' => 'Ꜹ',
  39228. 'ꜻ' => 'Ꜻ',
  39229. 'ꜽ' => 'Ꜽ',
  39230. 'ꜿ' => 'Ꜿ',
  39231. '�' => '�',
  39232. '�' => '�',
  39233. '�' => '�',
  39234. '�' => '�',
  39235. '�' => '�',
  39236. '�' => '�',
  39237. '�' => '�',
  39238. '�' => '�',
  39239. '�' => '�',
  39240. '�' => '�',
  39241. '�' => '�',
  39242. '�' => '�',
  39243. '�' => '�',
  39244. '�' => '�',
  39245. '�' => '�',
  39246. '�' => '�',
  39247. '�' => '�',
  39248. '�' => '�',
  39249. '�' => '�',
  39250. '�' => '�',
  39251. '�' => '�',
  39252. '�' => '�',
  39253. '�' => '�',
  39254. '�' => '�',
  39255. '�' => '�',
  39256. '�' => '�',
  39257. '�' => '�',
  39258. '�' => 'Ꞁ',
  39259. 'ꞃ' => 'Ꞃ',
  39260. 'êž…' => 'êž„',
  39261. 'ꞇ' => 'Ꞇ',
  39262. 'ꞌ' => 'Ꞌ',
  39263. 'ꞑ' => '�',
  39264. 'êž“' => 'êž’',
  39265. 'êž—' => 'êž–',
  39266. 'ꞙ' => 'Ꞙ',
  39267. 'êž›' => 'êžš',
  39268. '�' => 'Ꞝ',
  39269. 'ꞟ' => 'Ꞟ',
  39270. 'êž¡' => 'êž ',
  39271. 'ꞣ' => 'Ꞣ',
  39272. 'ꞥ' => 'Ꞥ',
  39273. 'ꞧ' => 'Ꞧ',
  39274. 'ꞩ' => 'Ꞩ',
  39275. '�' => 'A',
  39276. 'b' => 'B',
  39277. 'c' => 'C',
  39278. 'd' => 'D',
  39279. 'ï½…' => 'ï¼¥',
  39280. 'f' => 'F',
  39281. 'g' => 'G',
  39282. 'h' => 'H',
  39283. 'i' => 'I',
  39284. 'j' => 'J',
  39285. 'k' => 'K',
  39286. 'l' => 'L',
  39287. '�' => 'M',
  39288. 'n' => 'N',
  39289. '�' => 'O',
  39290. '�' => 'P',
  39291. 'q' => 'Q',
  39292. 'ï½’' => 'ï¼²',
  39293. 's' => 'S',
  39294. 'ï½”' => 'ï¼´',
  39295. 'u' => 'U',
  39296. 'v' => 'V',
  39297. 'ï½—' => 'ï¼·',
  39298. 'x' => 'X',
  39299. 'ï½™' => 'ï¼¹',
  39300. 'z' => 'Z',
  39301. '�' => '�',
  39302. '�' => '�',
  39303. '�' => '�',
  39304. '�' => '�',
  39305. '�' => '�',
  39306. '�' => '�',
  39307. '�' => '�',
  39308. '�' => '�',
  39309. '�' => '�',
  39310. '�' => '�',
  39311. '�' => '�',
  39312. '�' => '�',
  39313. '�' => '�',
  39314. '�' => '�',
  39315. '�' => '�',
  39316. '�' => '�',
  39317. '�' => '�',
  39318. '�' => '�',
  39319. '�' => '�',
  39320. '�' => '�',
  39321. '�' => '�',
  39322. '�' => '�',
  39323. '�' => '�',
  39324. '�' => '�',
  39325. '�' => '�',
  39326. '�' => '�',
  39327. '�' => '�',
  39328. '�' => '�',
  39329. '�' => '�',
  39330. '�' => '�',
  39331. '�' => '�',
  39332. '�' => '�',
  39333. '�' => '�',
  39334. '�' => '�',
  39335. '�' => '�',
  39336. '�' => '�',
  39337. '�' => '�',
  39338. '�' => '�',
  39339. '�' => '�',
  39340. '�' => '�',
  39341. 'ð‘£€' => 'ð‘¢ ',
  39342. '�' => '𑢡',
  39343. '𑣂' => '𑢢',
  39344. '𑣃' => '𑢣',
  39345. '𑣄' => '𑢤',
  39346. 'ð‘£…' => 'ð‘¢¥',
  39347. '𑣆' => '𑢦',
  39348. '𑣇' => '𑢧',
  39349. '𑣈' => '𑢨',
  39350. '𑣉' => '𑢩',
  39351. '𑣊' => '𑢪',
  39352. '𑣋' => '𑢫',
  39353. '𑣌' => '𑢬',
  39354. '�' => '𑢭',
  39355. '𑣎' => '𑢮',
  39356. '�' => '𑢯',
  39357. '�' => '𑢰',
  39358. '𑣑' => '𑢱',
  39359. 'ð‘£’' => 'ð‘¢²',
  39360. '𑣓' => '𑢳',
  39361. 'ð‘£”' => 'ð‘¢´',
  39362. '𑣕' => '𑢵',
  39363. '𑣖' => '𑢶',
  39364. 'ð‘£—' => 'ð‘¢·',
  39365. '𑣘' => '𑢸',
  39366. 'ð‘£™' => 'ð‘¢¹',
  39367. '𑣚' => '𑢺',
  39368. 'ð‘£›' => 'ð‘¢»',
  39369. '𑣜' => '𑢼',
  39370. '�' => '𑢽',
  39371. '𑣞' => '𑢾',
  39372. '𑣟' => '𑢿',
  39373. );
  39374. $result =& $data;
  39375. unset($data);
  39376. return $result;
  39377. <?php
  39378. use Symfony\Polyfill\Mbstring as p;
  39379. if (!function_exists('mb_strlen')) {
  39380. define('MB_CASE_UPPER', 0);
  39381. define('MB_CASE_LOWER', 1);
  39382. define('MB_CASE_TITLE', 2);
  39383. function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
  39384. function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
  39385. function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
  39386. function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
  39387. function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
  39388. function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
  39389. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  39390. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  39391. function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
  39392. function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
  39393. function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
  39394. function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
  39395. function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
  39396. function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
  39397. function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
  39398. function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
  39399. function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
  39400. function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
  39401. function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
  39402. function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
  39403. function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
  39404. function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
  39405. function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
  39406. function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
  39407. function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
  39408. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  39409. function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
  39410. function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
  39411. function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
  39412. function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
  39413. function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
  39414. function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $v0, $a, $b, $c, $d, $e, $f); }
  39415. }
  39416. <?php
  39417. namespace Symfony\Component\Process\Exception;
  39418. interface ExceptionInterface
  39419. {
  39420. }
  39421. <?php
  39422. namespace Symfony\Component\Process\Exception;
  39423. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  39424. {
  39425. }
  39426. <?php
  39427. namespace Symfony\Component\Process\Exception;
  39428. class LogicException extends \LogicException implements ExceptionInterface
  39429. {
  39430. }
  39431. <?php
  39432. namespace Symfony\Component\Process\Exception;
  39433. use Symfony\Component\Process\Process;
  39434. class ProcessFailedException extends RuntimeException
  39435. {
  39436. private $process;
  39437. public function __construct(Process $process)
  39438. {
  39439. if ($process->isSuccessful()) {
  39440. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  39441. }
  39442. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  39443. $process->getCommandLine(),
  39444. $process->getExitCode(),
  39445. $process->getExitCodeText(),
  39446. $process->getWorkingDirectory()
  39447. );
  39448. if (!$process->isOutputDisabled()) {
  39449. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  39450. $process->getOutput(),
  39451. $process->getErrorOutput()
  39452. );
  39453. }
  39454. parent::__construct($error);
  39455. $this->process = $process;
  39456. }
  39457. public function getProcess()
  39458. {
  39459. return $this->process;
  39460. }
  39461. }
  39462. <?php
  39463. namespace Symfony\Component\Process\Exception;
  39464. use Symfony\Component\Process\Process;
  39465. class ProcessTimedOutException extends RuntimeException
  39466. {
  39467. const TYPE_GENERAL = 1;
  39468. const TYPE_IDLE = 2;
  39469. private $process;
  39470. private $timeoutType;
  39471. public function __construct(Process $process, $timeoutType)
  39472. {
  39473. $this->process = $process;
  39474. $this->timeoutType = $timeoutType;
  39475. parent::__construct(sprintf(
  39476. 'The process "%s" exceeded the timeout of %s seconds.',
  39477. $process->getCommandLine(),
  39478. $this->getExceededTimeout()
  39479. ));
  39480. }
  39481. public function getProcess()
  39482. {
  39483. return $this->process;
  39484. }
  39485. public function isGeneralTimeout()
  39486. {
  39487. return $this->timeoutType === self::TYPE_GENERAL;
  39488. }
  39489. public function isIdleTimeout()
  39490. {
  39491. return $this->timeoutType === self::TYPE_IDLE;
  39492. }
  39493. public function getExceededTimeout()
  39494. {
  39495. switch ($this->timeoutType) {
  39496. case self::TYPE_GENERAL:
  39497. return $this->process->getTimeout();
  39498. case self::TYPE_IDLE:
  39499. return $this->process->getIdleTimeout();
  39500. default:
  39501. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  39502. }
  39503. }
  39504. }
  39505. <?php
  39506. namespace Symfony\Component\Process\Exception;
  39507. class RuntimeException extends \RuntimeException implements ExceptionInterface
  39508. {
  39509. }
  39510. <?php
  39511. namespace Symfony\Component\Process;
  39512. class ExecutableFinder
  39513. {
  39514. private $suffixes = array('.exe', '.bat', '.cmd', '.com');
  39515. public function setSuffixes(array $suffixes)
  39516. {
  39517. $this->suffixes = $suffixes;
  39518. }
  39519. public function addSuffix($suffix)
  39520. {
  39521. $this->suffixes[] = $suffix;
  39522. }
  39523. public function find($name, $default = null, array $extraDirs = array())
  39524. {
  39525. if (ini_get('open_basedir')) {
  39526. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  39527. $dirs = array();
  39528. foreach ($searchPath as $path) {
  39529. if (@is_dir($path)) {
  39530. $dirs[] = $path;
  39531. } else {
  39532. if (basename($path) == $name && @is_executable($path)) {
  39533. return $path;
  39534. }
  39535. }
  39536. }
  39537. } else {
  39538. $dirs = array_merge(
  39539. explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  39540. $extraDirs
  39541. );
  39542. }
  39543. $suffixes = array('');
  39544. if ('\\' === DIRECTORY_SEPARATOR) {
  39545. $pathExt = getenv('PATHEXT');
  39546. $suffixes = $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes;
  39547. }
  39548. foreach ($suffixes as $suffix) {
  39549. foreach ($dirs as $dir) {
  39550. if (is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
  39551. return $file;
  39552. }
  39553. }
  39554. }
  39555. return $default;
  39556. }
  39557. }
  39558. Copyright (c) 2004-2016 Fabien Potencier
  39559. Permission is hereby granted, free of charge, to any person obtaining a copy
  39560. of this software and associated documentation files (the "Software"), to deal
  39561. in the Software without restriction, including without limitation the rights
  39562. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  39563. copies of the Software, and to permit persons to whom the Software is furnished
  39564. to do so, subject to the following conditions:
  39565. The above copyright notice and this permission notice shall be included in all
  39566. copies or substantial portions of the Software.
  39567. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  39568. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  39569. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  39570. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  39571. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  39572. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  39573. THE SOFTWARE.
  39574. <?php
  39575. namespace Symfony\Component\Process;
  39576. class PhpExecutableFinder
  39577. {
  39578. private $executableFinder;
  39579. public function __construct()
  39580. {
  39581. $this->executableFinder = new ExecutableFinder();
  39582. }
  39583. public function find($includeArgs = true)
  39584. {
  39585. $args = $this->findArguments();
  39586. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  39587. if (defined('HHVM_VERSION')) {
  39588. return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
  39589. }
  39590. if (defined('PHP_BINARY') && PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg')) && is_file(PHP_BINARY)) {
  39591. return PHP_BINARY.$args;
  39592. }
  39593. if ($php = getenv('PHP_PATH')) {
  39594. if (!is_executable($php)) {
  39595. return false;
  39596. }
  39597. return $php;
  39598. }
  39599. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  39600. if (is_executable($php)) {
  39601. return $php;
  39602. }
  39603. }
  39604. $dirs = array(PHP_BINDIR);
  39605. if ('\\' === DIRECTORY_SEPARATOR) {
  39606. $dirs[] = 'C:\xampp\php\\';
  39607. }
  39608. return $this->executableFinder->find('php', false, $dirs);
  39609. }
  39610. public function findArguments()
  39611. {
  39612. $arguments = array();
  39613. if (defined('HHVM_VERSION')) {
  39614. $arguments[] = '--php';
  39615. } elseif ('phpdbg' === PHP_SAPI) {
  39616. $arguments[] = '-qrr';
  39617. }
  39618. return $arguments;
  39619. }
  39620. }
  39621. <?php
  39622. namespace Symfony\Component\Process;
  39623. use Symfony\Component\Process\Exception\RuntimeException;
  39624. class PhpProcess extends Process
  39625. {
  39626. public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
  39627. {
  39628. $executableFinder = new PhpExecutableFinder();
  39629. if (false === $php = $executableFinder->find()) {
  39630. $php = null;
  39631. }
  39632. if ('phpdbg' === PHP_SAPI) {
  39633. $file = tempnam(sys_get_temp_dir(), 'dbg');
  39634. file_put_contents($file, $script);
  39635. register_shutdown_function('unlink', $file);
  39636. $php .= ' '.ProcessUtils::escapeArgument($file);
  39637. $script = null;
  39638. }
  39639. if ('\\' !== DIRECTORY_SEPARATOR && null !== $php) {
  39640. $php = 'exec '.$php;
  39641. }
  39642. parent::__construct($php, $cwd, $env, $script, $timeout, $options);
  39643. }
  39644. public function setPhpBinary($php)
  39645. {
  39646. $this->setCommandLine($php);
  39647. }
  39648. public function start($callback = null)
  39649. {
  39650. if (null === $this->getCommandLine()) {
  39651. throw new RuntimeException('Unable to find the PHP executable.');
  39652. }
  39653. parent::start($callback);
  39654. }
  39655. }
  39656. <?php
  39657. namespace Symfony\Component\Process\Pipes;
  39658. abstract class AbstractPipes implements PipesInterface
  39659. {
  39660. public $pipes = array();
  39661. private $inputBuffer = '';
  39662. private $input;
  39663. private $blocked = true;
  39664. public function __construct($input)
  39665. {
  39666. if (is_resource($input)) {
  39667. $this->input = $input;
  39668. } elseif (is_string($input)) {
  39669. $this->inputBuffer = $input;
  39670. } else {
  39671. $this->inputBuffer = (string) $input;
  39672. }
  39673. }
  39674. public function close()
  39675. {
  39676. foreach ($this->pipes as $pipe) {
  39677. fclose($pipe);
  39678. }
  39679. $this->pipes = array();
  39680. }
  39681. protected function hasSystemCallBeenInterrupted()
  39682. {
  39683. $lastError = error_get_last();
  39684. return isset($lastError['message']) && false !== stripos($lastError['message'], 'interrupted system call');
  39685. }
  39686. protected function unblock()
  39687. {
  39688. if (!$this->blocked) {
  39689. return;
  39690. }
  39691. foreach ($this->pipes as $pipe) {
  39692. stream_set_blocking($pipe, 0);
  39693. }
  39694. if (null !== $this->input) {
  39695. stream_set_blocking($this->input, 0);
  39696. }
  39697. $this->blocked = false;
  39698. }
  39699. protected function write()
  39700. {
  39701. if (!isset($this->pipes[0])) {
  39702. return;
  39703. }
  39704. $input = $this->input;
  39705. $r = $e = array();
  39706. $w = array($this->pipes[0]);
  39707. if (false === $n = @stream_select($r, $w, $e, 0, 0)) {
  39708. return;
  39709. }
  39710. foreach ($w as $stdin) {
  39711. if (isset($this->inputBuffer[0])) {
  39712. $written = fwrite($stdin, $this->inputBuffer);
  39713. $this->inputBuffer = substr($this->inputBuffer, $written);
  39714. if (isset($this->inputBuffer[0])) {
  39715. return array($this->pipes[0]);
  39716. }
  39717. }
  39718. if ($input) {
  39719. for (;;) {
  39720. $data = fread($input, self::CHUNK_SIZE);
  39721. if (!isset($data[0])) {
  39722. break;
  39723. }
  39724. $written = fwrite($stdin, $data);
  39725. $data = substr($data, $written);
  39726. if (isset($data[0])) {
  39727. $this->inputBuffer = $data;
  39728. return array($this->pipes[0]);
  39729. }
  39730. }
  39731. if (feof($input)) {
  39732. $this->input = null;
  39733. }
  39734. }
  39735. }
  39736. if (null === $this->input && !isset($this->inputBuffer[0])) {
  39737. fclose($this->pipes[0]);
  39738. unset($this->pipes[0]);
  39739. } elseif (!$w) {
  39740. return array($this->pipes[0]);
  39741. }
  39742. }
  39743. }
  39744. <?php
  39745. namespace Symfony\Component\Process\Pipes;
  39746. interface PipesInterface
  39747. {
  39748. const CHUNK_SIZE = 16384;
  39749. public function getDescriptors();
  39750. public function getFiles();
  39751. public function readAndWrite($blocking, $close = false);
  39752. public function areOpen();
  39753. public function close();
  39754. }
  39755. <?php
  39756. namespace Symfony\Component\Process\Pipes;
  39757. use Symfony\Component\Process\Process;
  39758. class UnixPipes extends AbstractPipes
  39759. {
  39760. private $ttyMode;
  39761. private $ptyMode;
  39762. private $disableOutput;
  39763. public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
  39764. {
  39765. $this->ttyMode = (bool) $ttyMode;
  39766. $this->ptyMode = (bool) $ptyMode;
  39767. $this->disableOutput = (bool) $disableOutput;
  39768. parent::__construct($input);
  39769. }
  39770. public function __destruct()
  39771. {
  39772. $this->close();
  39773. }
  39774. public function getDescriptors()
  39775. {
  39776. if ($this->disableOutput) {
  39777. $nullstream = fopen('/dev/null', 'c');
  39778. return array(
  39779. array('pipe', 'r'),
  39780. $nullstream,
  39781. $nullstream,
  39782. );
  39783. }
  39784. if ($this->ttyMode) {
  39785. return array(
  39786. array('file', '/dev/tty', 'r'),
  39787. array('file', '/dev/tty', 'w'),
  39788. array('file', '/dev/tty', 'w'),
  39789. );
  39790. }
  39791. if ($this->ptyMode && Process::isPtySupported()) {
  39792. return array(
  39793. array('pty'),
  39794. array('pty'),
  39795. array('pty'),
  39796. );
  39797. }
  39798. return array(
  39799. array('pipe', 'r'),
  39800. array('pipe', 'w'),
  39801. array('pipe', 'w'),
  39802. );
  39803. }
  39804. public function getFiles()
  39805. {
  39806. return array();
  39807. }
  39808. public function readAndWrite($blocking, $close = false)
  39809. {
  39810. $this->unblock();
  39811. $w = $this->write();
  39812. $read = $e = array();
  39813. $r = $this->pipes;
  39814. unset($r[0]);
  39815. if (($r || $w) && false === $n = @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  39816. if (!$this->hasSystemCallBeenInterrupted()) {
  39817. $this->pipes = array();
  39818. }
  39819. return $read;
  39820. }
  39821. foreach ($r as $pipe) {
  39822. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  39823. do {
  39824. $data = fread($pipe, self::CHUNK_SIZE);
  39825. $read[$type] .= $data;
  39826. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  39827. if (!isset($read[$type][0])) {
  39828. unset($read[$type]);
  39829. }
  39830. if ($close && feof($pipe)) {
  39831. fclose($pipe);
  39832. unset($this->pipes[$type]);
  39833. }
  39834. }
  39835. return $read;
  39836. }
  39837. public function areOpen()
  39838. {
  39839. return (bool) $this->pipes;
  39840. }
  39841. public static function create(Process $process, $input)
  39842. {
  39843. return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
  39844. }
  39845. }
  39846. <?php
  39847. namespace Symfony\Component\Process\Pipes;
  39848. use Symfony\Component\Process\Process;
  39849. use Symfony\Component\Process\Exception\RuntimeException;
  39850. class WindowsPipes extends AbstractPipes
  39851. {
  39852. private $files = array();
  39853. private $fileHandles = array();
  39854. private $readBytes = array(
  39855. Process::STDOUT => 0,
  39856. Process::STDERR => 0,
  39857. );
  39858. private $disableOutput;
  39859. public function __construct($disableOutput, $input)
  39860. {
  39861. $this->disableOutput = (bool) $disableOutput;
  39862. if (!$this->disableOutput) {
  39863. $pipes = array(
  39864. Process::STDOUT => Process::OUT,
  39865. Process::STDERR => Process::ERR,
  39866. );
  39867. $tmpCheck = false;
  39868. $tmpDir = sys_get_temp_dir();
  39869. $lastError = 'unknown reason';
  39870. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  39871. for ($i = 0;; ++$i) {
  39872. foreach ($pipes as $pipe => $name) {
  39873. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  39874. if (file_exists($file) && !unlink($file)) {
  39875. continue 2;
  39876. }
  39877. $h = fopen($file, 'xb');
  39878. if (!$h) {
  39879. $error = $lastError;
  39880. if ($tmpCheck || $tmpCheck = unlink(tempnam(false, 'sf_check_'))) {
  39881. continue;
  39882. }
  39883. restore_error_handler();
  39884. throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $error));
  39885. }
  39886. if (!$h || !$this->fileHandles[$pipe] = fopen($file, 'rb')) {
  39887. continue 2;
  39888. }
  39889. if (isset($this->files[$pipe])) {
  39890. unlink($this->files[$pipe]);
  39891. }
  39892. $this->files[$pipe] = $file;
  39893. }
  39894. break;
  39895. }
  39896. restore_error_handler();
  39897. }
  39898. parent::__construct($input);
  39899. }
  39900. public function __destruct()
  39901. {
  39902. $this->close();
  39903. $this->removeFiles();
  39904. }
  39905. public function getDescriptors()
  39906. {
  39907. if ($this->disableOutput) {
  39908. $nullstream = fopen('NUL', 'c');
  39909. return array(
  39910. array('pipe', 'r'),
  39911. $nullstream,
  39912. $nullstream,
  39913. );
  39914. }
  39915. return array(
  39916. array('pipe', 'r'),
  39917. array('file', 'NUL', 'w'),
  39918. array('file', 'NUL', 'w'),
  39919. );
  39920. }
  39921. public function getFiles()
  39922. {
  39923. return $this->files;
  39924. }
  39925. public function readAndWrite($blocking, $close = false)
  39926. {
  39927. $this->unblock();
  39928. $w = $this->write();
  39929. $read = $r = $e = array();
  39930. if ($blocking) {
  39931. if ($w) {
  39932. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  39933. } elseif ($this->fileHandles) {
  39934. usleep(Process::TIMEOUT_PRECISION * 1E6);
  39935. }
  39936. }
  39937. foreach ($this->fileHandles as $type => $fileHandle) {
  39938. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  39939. if (isset($data[0])) {
  39940. $this->readBytes[$type] += strlen($data);
  39941. $read[$type] = $data;
  39942. }
  39943. if ($close) {
  39944. fclose($fileHandle);
  39945. unset($this->fileHandles[$type]);
  39946. }
  39947. }
  39948. return $read;
  39949. }
  39950. public function areOpen()
  39951. {
  39952. return $this->pipes && $this->fileHandles;
  39953. }
  39954. public function close()
  39955. {
  39956. parent::close();
  39957. foreach ($this->fileHandles as $handle) {
  39958. fclose($handle);
  39959. }
  39960. $this->fileHandles = array();
  39961. }
  39962. public static function create(Process $process, $input)
  39963. {
  39964. return new static($process->isOutputDisabled(), $input);
  39965. }
  39966. private function removeFiles()
  39967. {
  39968. foreach ($this->files as $filename) {
  39969. if (file_exists($filename)) {
  39970. @unlink($filename);
  39971. }
  39972. }
  39973. $this->files = array();
  39974. }
  39975. }
  39976. <?php
  39977. namespace Symfony\Component\Process;
  39978. use Symfony\Component\Process\Exception\InvalidArgumentException;
  39979. use Symfony\Component\Process\Exception\LogicException;
  39980. use Symfony\Component\Process\Exception\ProcessFailedException;
  39981. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  39982. use Symfony\Component\Process\Exception\RuntimeException;
  39983. use Symfony\Component\Process\Pipes\PipesInterface;
  39984. use Symfony\Component\Process\Pipes\UnixPipes;
  39985. use Symfony\Component\Process\Pipes\WindowsPipes;
  39986. class Process
  39987. {
  39988. const ERR = 'err';
  39989. const OUT = 'out';
  39990. const STATUS_READY = 'ready';
  39991. const STATUS_STARTED = 'started';
  39992. const STATUS_TERMINATED = 'terminated';
  39993. const STDIN = 0;
  39994. const STDOUT = 1;
  39995. const STDERR = 2;
  39996. const TIMEOUT_PRECISION = 0.2;
  39997. private $callback;
  39998. private $commandline;
  39999. private $cwd;
  40000. private $env;
  40001. private $input;
  40002. private $starttime;
  40003. private $lastOutputTime;
  40004. private $timeout;
  40005. private $idleTimeout;
  40006. private $options;
  40007. private $exitcode;
  40008. private $fallbackStatus = array();
  40009. private $processInformation;
  40010. private $outputDisabled = false;
  40011. private $stdout;
  40012. private $stderr;
  40013. private $enhanceWindowsCompatibility = true;
  40014. private $enhanceSigchildCompatibility;
  40015. private $process;
  40016. private $status = self::STATUS_READY;
  40017. private $incrementalOutputOffset = 0;
  40018. private $incrementalErrorOutputOffset = 0;
  40019. private $tty;
  40020. private $pty;
  40021. private $useFileHandles = false;
  40022. private $processPipes;
  40023. private $latestSignal;
  40024. private static $sigchild;
  40025. public static $exitCodes = array(
  40026. 0 => 'OK',
  40027. 1 => 'General error',
  40028. 2 => 'Misuse of shell builtins',
  40029. 126 => 'Invoked command cannot execute',
  40030. 127 => 'Command not found',
  40031. 128 => 'Invalid exit argument',
  40032. 129 => 'Hangup',
  40033. 130 => 'Interrupt',
  40034. 131 => 'Quit and dump core',
  40035. 132 => 'Illegal instruction',
  40036. 133 => 'Trace/breakpoint trap',
  40037. 134 => 'Process aborted',
  40038. 135 => 'Bus error: "access to undefined portion of memory object"',
  40039. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  40040. 137 => 'Kill (terminate immediately)',
  40041. 138 => 'User-defined 1',
  40042. 139 => 'Segmentation violation',
  40043. 140 => 'User-defined 2',
  40044. 141 => 'Write to pipe with no one reading',
  40045. 142 => 'Signal raised by alarm',
  40046. 143 => 'Termination (request to terminate)',
  40047. 145 => 'Child process terminated, stopped (or continued*)',
  40048. 146 => 'Continue if stopped',
  40049. 147 => 'Stop executing temporarily',
  40050. 148 => 'Terminal stop signal',
  40051. 149 => 'Background process attempting to read from tty ("in")',
  40052. 150 => 'Background process attempting to write to tty ("out")',
  40053. 151 => 'Urgent data available on socket',
  40054. 152 => 'CPU time limit exceeded',
  40055. 153 => 'File size limit exceeded',
  40056. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  40057. 155 => 'Profiling timer expired',
  40058. 157 => 'Pollable event',
  40059. 159 => 'Bad syscall',
  40060. );
  40061. public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  40062. {
  40063. if (!function_exists('proc_open')) {
  40064. throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  40065. }
  40066. $this->commandline = $commandline;
  40067. $this->cwd = $cwd;
  40068. if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || '\\' === DIRECTORY_SEPARATOR)) {
  40069. $this->cwd = getcwd();
  40070. }
  40071. if (null !== $env) {
  40072. $this->setEnv($env);
  40073. }
  40074. $this->setInput($input);
  40075. $this->setTimeout($timeout);
  40076. $this->useFileHandles = '\\' === DIRECTORY_SEPARATOR;
  40077. $this->pty = false;
  40078. $this->enhanceWindowsCompatibility = true;
  40079. $this->enhanceSigchildCompatibility = '\\' !== DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
  40080. $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
  40081. }
  40082. public function __destruct()
  40083. {
  40084. $this->stop(0);
  40085. }
  40086. public function __clone()
  40087. {
  40088. $this->resetProcessData();
  40089. }
  40090. public function run($callback = null)
  40091. {
  40092. $this->start($callback);
  40093. return $this->wait();
  40094. }
  40095. public function mustRun($callback = null)
  40096. {
  40097. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  40098. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  40099. }
  40100. if (0 !== $this->run($callback)) {
  40101. throw new ProcessFailedException($this);
  40102. }
  40103. return $this;
  40104. }
  40105. public function start($callback = null)
  40106. {
  40107. if ($this->isRunning()) {
  40108. throw new RuntimeException('Process is already running');
  40109. }
  40110. if ($this->outputDisabled && null !== $callback) {
  40111. throw new LogicException('Output has been disabled, enable it to allow the use of a callback.');
  40112. }
  40113. $this->resetProcessData();
  40114. $this->starttime = $this->lastOutputTime = microtime(true);
  40115. $this->callback = $this->buildCallback($callback);
  40116. $descriptors = $this->getDescriptors();
  40117. $commandline = $this->commandline;
  40118. if ('\\' === DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
  40119. $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
  40120. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  40121. $commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
  40122. }
  40123. $commandline .= '"';
  40124. if (!isset($this->options['bypass_shell'])) {
  40125. $this->options['bypass_shell'] = true;
  40126. }
  40127. } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  40128. $descriptors[3] = array('pipe', 'w');
  40129. $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  40130. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  40131. $ptsWorkaround = fopen(__FILE__, 'r');
  40132. }
  40133. $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
  40134. if (!is_resource($this->process)) {
  40135. throw new RuntimeException('Unable to launch a new process.');
  40136. }
  40137. $this->status = self::STATUS_STARTED;
  40138. if (isset($descriptors[3])) {
  40139. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  40140. }
  40141. if ($this->tty) {
  40142. return;
  40143. }
  40144. $this->updateStatus(false);
  40145. $this->checkTimeout();
  40146. }
  40147. public function restart($callback = null)
  40148. {
  40149. if ($this->isRunning()) {
  40150. throw new RuntimeException('Process is already running');
  40151. }
  40152. $process = clone $this;
  40153. $process->start($callback);
  40154. return $process;
  40155. }
  40156. public function wait($callback = null)
  40157. {
  40158. $this->requireProcessIsStarted(__FUNCTION__);
  40159. $this->updateStatus(false);
  40160. if (null !== $callback) {
  40161. $this->callback = $this->buildCallback($callback);
  40162. }
  40163. do {
  40164. $this->checkTimeout();
  40165. $running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  40166. $this->readPipes($running, '\\' !== DIRECTORY_SEPARATOR || !$running);
  40167. } while ($running);
  40168. while ($this->isRunning()) {
  40169. usleep(1000);
  40170. }
  40171. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  40172. throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
  40173. }
  40174. return $this->exitcode;
  40175. }
  40176. public function getPid()
  40177. {
  40178. return $this->isRunning() ? $this->processInformation['pid'] : null;
  40179. }
  40180. public function signal($signal)
  40181. {
  40182. $this->doSignal($signal, true);
  40183. return $this;
  40184. }
  40185. public function disableOutput()
  40186. {
  40187. if ($this->isRunning()) {
  40188. throw new RuntimeException('Disabling output while the process is running is not possible.');
  40189. }
  40190. if (null !== $this->idleTimeout) {
  40191. throw new LogicException('Output can not be disabled while an idle timeout is set.');
  40192. }
  40193. $this->outputDisabled = true;
  40194. return $this;
  40195. }
  40196. public function enableOutput()
  40197. {
  40198. if ($this->isRunning()) {
  40199. throw new RuntimeException('Enabling output while the process is running is not possible.');
  40200. }
  40201. $this->outputDisabled = false;
  40202. return $this;
  40203. }
  40204. public function isOutputDisabled()
  40205. {
  40206. return $this->outputDisabled;
  40207. }
  40208. public function getOutput()
  40209. {
  40210. $this->readPipesForOutput(__FUNCTION__);
  40211. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  40212. return '';
  40213. }
  40214. return $ret;
  40215. }
  40216. public function getIncrementalOutput()
  40217. {
  40218. $this->readPipesForOutput(__FUNCTION__);
  40219. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  40220. $this->incrementalOutputOffset = ftell($this->stdout);
  40221. if (false === $latest) {
  40222. return '';
  40223. }
  40224. return $latest;
  40225. }
  40226. public function clearOutput()
  40227. {
  40228. ftruncate($this->stdout, 0);
  40229. fseek($this->stdout, 0);
  40230. $this->incrementalOutputOffset = 0;
  40231. return $this;
  40232. }
  40233. public function getErrorOutput()
  40234. {
  40235. $this->readPipesForOutput(__FUNCTION__);
  40236. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  40237. return '';
  40238. }
  40239. return $ret;
  40240. }
  40241. public function getIncrementalErrorOutput()
  40242. {
  40243. $this->readPipesForOutput(__FUNCTION__);
  40244. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  40245. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  40246. if (false === $latest) {
  40247. return '';
  40248. }
  40249. return $latest;
  40250. }
  40251. public function clearErrorOutput()
  40252. {
  40253. ftruncate($this->stderr, 0);
  40254. fseek($this->stderr, 0);
  40255. $this->incrementalErrorOutputOffset = 0;
  40256. return $this;
  40257. }
  40258. public function getExitCode()
  40259. {
  40260. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  40261. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  40262. }
  40263. $this->updateStatus(false);
  40264. return $this->exitcode;
  40265. }
  40266. public function getExitCodeText()
  40267. {
  40268. if (null === $exitcode = $this->getExitCode()) {
  40269. return;
  40270. }
  40271. return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
  40272. }
  40273. public function isSuccessful()
  40274. {
  40275. return 0 === $this->getExitCode();
  40276. }
  40277. public function hasBeenSignaled()
  40278. {
  40279. $this->requireProcessIsTerminated(__FUNCTION__);
  40280. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  40281. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  40282. }
  40283. return $this->processInformation['signaled'];
  40284. }
  40285. public function getTermSignal()
  40286. {
  40287. $this->requireProcessIsTerminated(__FUNCTION__);
  40288. if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
  40289. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  40290. }
  40291. return $this->processInformation['termsig'];
  40292. }
  40293. public function hasBeenStopped()
  40294. {
  40295. $this->requireProcessIsTerminated(__FUNCTION__);
  40296. return $this->processInformation['stopped'];
  40297. }
  40298. public function getStopSignal()
  40299. {
  40300. $this->requireProcessIsTerminated(__FUNCTION__);
  40301. return $this->processInformation['stopsig'];
  40302. }
  40303. public function isRunning()
  40304. {
  40305. if (self::STATUS_STARTED !== $this->status) {
  40306. return false;
  40307. }
  40308. $this->updateStatus(false);
  40309. return $this->processInformation['running'];
  40310. }
  40311. public function isStarted()
  40312. {
  40313. return $this->status != self::STATUS_READY;
  40314. }
  40315. public function isTerminated()
  40316. {
  40317. $this->updateStatus(false);
  40318. return $this->status == self::STATUS_TERMINATED;
  40319. }
  40320. public function getStatus()
  40321. {
  40322. $this->updateStatus(false);
  40323. return $this->status;
  40324. }
  40325. public function stop($timeout = 10, $signal = null)
  40326. {
  40327. $timeoutMicro = microtime(true) + $timeout;
  40328. if ($this->isRunning()) {
  40329. $this->doSignal(15, false);
  40330. do {
  40331. usleep(1000);
  40332. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  40333. if ($this->isRunning()) {
  40334. $this->doSignal($signal ?: 9, false);
  40335. }
  40336. }
  40337. if ($this->isRunning()) {
  40338. if (isset($this->fallbackStatus['pid'])) {
  40339. unset($this->fallbackStatus['pid']);
  40340. return $this->stop(0, $signal);
  40341. }
  40342. $this->close();
  40343. }
  40344. return $this->exitcode;
  40345. }
  40346. public function addOutput($line)
  40347. {
  40348. $this->lastOutputTime = microtime(true);
  40349. fseek($this->stdout, 0, SEEK_END);
  40350. fwrite($this->stdout, $line);
  40351. fseek($this->stdout, $this->incrementalOutputOffset);
  40352. }
  40353. public function addErrorOutput($line)
  40354. {
  40355. $this->lastOutputTime = microtime(true);
  40356. fseek($this->stderr, 0, SEEK_END);
  40357. fwrite($this->stderr, $line);
  40358. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  40359. }
  40360. public function getCommandLine()
  40361. {
  40362. return $this->commandline;
  40363. }
  40364. public function setCommandLine($commandline)
  40365. {
  40366. $this->commandline = $commandline;
  40367. return $this;
  40368. }
  40369. public function getTimeout()
  40370. {
  40371. return $this->timeout;
  40372. }
  40373. public function getIdleTimeout()
  40374. {
  40375. return $this->idleTimeout;
  40376. }
  40377. public function setTimeout($timeout)
  40378. {
  40379. $this->timeout = $this->validateTimeout($timeout);
  40380. return $this;
  40381. }
  40382. public function setIdleTimeout($timeout)
  40383. {
  40384. if (null !== $timeout && $this->outputDisabled) {
  40385. throw new LogicException('Idle timeout can not be set while the output is disabled.');
  40386. }
  40387. $this->idleTimeout = $this->validateTimeout($timeout);
  40388. return $this;
  40389. }
  40390. public function setTty($tty)
  40391. {
  40392. if ('\\' === DIRECTORY_SEPARATOR && $tty) {
  40393. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  40394. }
  40395. if ($tty && (!file_exists('/dev/tty') || !is_readable('/dev/tty'))) {
  40396. throw new RuntimeException('TTY mode requires /dev/tty to be readable.');
  40397. }
  40398. $this->tty = (bool) $tty;
  40399. return $this;
  40400. }
  40401. public function isTty()
  40402. {
  40403. return $this->tty;
  40404. }
  40405. public function setPty($bool)
  40406. {
  40407. $this->pty = (bool) $bool;
  40408. return $this;
  40409. }
  40410. public function isPty()
  40411. {
  40412. return $this->pty;
  40413. }
  40414. public function getWorkingDirectory()
  40415. {
  40416. if (null === $this->cwd) {
  40417. return getcwd() ?: null;
  40418. }
  40419. return $this->cwd;
  40420. }
  40421. public function setWorkingDirectory($cwd)
  40422. {
  40423. $this->cwd = $cwd;
  40424. return $this;
  40425. }
  40426. public function getEnv()
  40427. {
  40428. return $this->env;
  40429. }
  40430. public function setEnv(array $env)
  40431. {
  40432. $env = array_filter($env, function ($value) {
  40433. return !is_array($value);
  40434. });
  40435. $this->env = array();
  40436. foreach ($env as $key => $value) {
  40437. $this->env[$key] = (string) $value;
  40438. }
  40439. return $this;
  40440. }
  40441. public function getStdin()
  40442. {
  40443. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the getInput() method instead.', E_USER_DEPRECATED);
  40444. return $this->getInput();
  40445. }
  40446. public function getInput()
  40447. {
  40448. return $this->input;
  40449. }
  40450. public function setStdin($stdin)
  40451. {
  40452. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the setInput() method instead.', E_USER_DEPRECATED);
  40453. return $this->setInput($stdin);
  40454. }
  40455. public function setInput($input)
  40456. {
  40457. if ($this->isRunning()) {
  40458. throw new LogicException('Input can not be set while the process is running.');
  40459. }
  40460. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  40461. return $this;
  40462. }
  40463. public function getOptions()
  40464. {
  40465. return $this->options;
  40466. }
  40467. public function setOptions(array $options)
  40468. {
  40469. $this->options = $options;
  40470. return $this;
  40471. }
  40472. public function getEnhanceWindowsCompatibility()
  40473. {
  40474. return $this->enhanceWindowsCompatibility;
  40475. }
  40476. public function setEnhanceWindowsCompatibility($enhance)
  40477. {
  40478. $this->enhanceWindowsCompatibility = (bool) $enhance;
  40479. return $this;
  40480. }
  40481. public function getEnhanceSigchildCompatibility()
  40482. {
  40483. return $this->enhanceSigchildCompatibility;
  40484. }
  40485. public function setEnhanceSigchildCompatibility($enhance)
  40486. {
  40487. $this->enhanceSigchildCompatibility = (bool) $enhance;
  40488. return $this;
  40489. }
  40490. public function checkTimeout()
  40491. {
  40492. if ($this->status !== self::STATUS_STARTED) {
  40493. return;
  40494. }
  40495. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  40496. $this->stop(0);
  40497. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  40498. }
  40499. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  40500. $this->stop(0);
  40501. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  40502. }
  40503. }
  40504. public static function isPtySupported()
  40505. {
  40506. static $result;
  40507. if (null !== $result) {
  40508. return $result;
  40509. }
  40510. if ('\\' === DIRECTORY_SEPARATOR) {
  40511. return $result = false;
  40512. }
  40513. return $result = (bool) @proc_open('echo 1', array(array('pty'), array('pty'), array('pty')), $pipes);
  40514. }
  40515. private function getDescriptors()
  40516. {
  40517. if ('\\' === DIRECTORY_SEPARATOR) {
  40518. $this->processPipes = WindowsPipes::create($this, $this->input);
  40519. } else {
  40520. $this->processPipes = UnixPipes::create($this, $this->input);
  40521. }
  40522. return $this->processPipes->getDescriptors();
  40523. }
  40524. protected function buildCallback($callback)
  40525. {
  40526. $that = $this;
  40527. $out = self::OUT;
  40528. $callback = function ($type, $data) use ($that, $callback, $out) {
  40529. if ($out == $type) {
  40530. $that->addOutput($data);
  40531. } else {
  40532. $that->addErrorOutput($data);
  40533. }
  40534. if (null !== $callback) {
  40535. call_user_func($callback, $type, $data);
  40536. }
  40537. };
  40538. return $callback;
  40539. }
  40540. protected function updateStatus($blocking)
  40541. {
  40542. if (self::STATUS_STARTED !== $this->status) {
  40543. return;
  40544. }
  40545. $this->processInformation = proc_get_status($this->process);
  40546. $running = $this->processInformation['running'];
  40547. $this->readPipes($running && $blocking, '\\' !== DIRECTORY_SEPARATOR || !$running);
  40548. if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  40549. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  40550. }
  40551. if (!$running) {
  40552. $this->close();
  40553. }
  40554. }
  40555. protected function isSigchildEnabled()
  40556. {
  40557. if (null !== self::$sigchild) {
  40558. return self::$sigchild;
  40559. }
  40560. if (!function_exists('phpinfo') || defined('HHVM_VERSION')) {
  40561. return self::$sigchild = false;
  40562. }
  40563. ob_start();
  40564. phpinfo(INFO_GENERAL);
  40565. return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  40566. }
  40567. private function readPipesForOutput($caller)
  40568. {
  40569. if ($this->outputDisabled) {
  40570. throw new LogicException('Output has been disabled.');
  40571. }
  40572. $this->requireProcessIsStarted($caller);
  40573. $this->updateStatus(false);
  40574. }
  40575. private function validateTimeout($timeout)
  40576. {
  40577. $timeout = (float) $timeout;
  40578. if (0.0 === $timeout) {
  40579. $timeout = null;
  40580. } elseif ($timeout < 0) {
  40581. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  40582. }
  40583. return $timeout;
  40584. }
  40585. private function readPipes($blocking, $close)
  40586. {
  40587. $result = $this->processPipes->readAndWrite($blocking, $close);
  40588. $callback = $this->callback;
  40589. foreach ($result as $type => $data) {
  40590. if (3 !== $type) {
  40591. $callback($type === self::STDOUT ? self::OUT : self::ERR, $data);
  40592. } elseif (!isset($this->fallbackStatus['signaled'])) {
  40593. $this->fallbackStatus['exitcode'] = (int) $data;
  40594. }
  40595. }
  40596. }
  40597. private function close()
  40598. {
  40599. $this->processPipes->close();
  40600. if (is_resource($this->process)) {
  40601. proc_close($this->process);
  40602. }
  40603. $this->exitcode = $this->processInformation['exitcode'];
  40604. $this->status = self::STATUS_TERMINATED;
  40605. if (-1 === $this->exitcode) {
  40606. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  40607. $this->exitcode = 128 + $this->processInformation['termsig'];
  40608. } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  40609. $this->processInformation['signaled'] = true;
  40610. $this->processInformation['termsig'] = -1;
  40611. }
  40612. }
  40613. $this->callback = null;
  40614. return $this->exitcode;
  40615. }
  40616. private function resetProcessData()
  40617. {
  40618. $this->starttime = null;
  40619. $this->callback = null;
  40620. $this->exitcode = null;
  40621. $this->fallbackStatus = array();
  40622. $this->processInformation = null;
  40623. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
  40624. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
  40625. $this->process = null;
  40626. $this->latestSignal = null;
  40627. $this->status = self::STATUS_READY;
  40628. $this->incrementalOutputOffset = 0;
  40629. $this->incrementalErrorOutputOffset = 0;
  40630. }
  40631. private function doSignal($signal, $throwException)
  40632. {
  40633. if (null === $pid = $this->getPid()) {
  40634. if ($throwException) {
  40635. throw new LogicException('Can not send signal on a non running process.');
  40636. }
  40637. return false;
  40638. }
  40639. if ('\\' === DIRECTORY_SEPARATOR) {
  40640. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  40641. if ($exitCode && $this->isRunning()) {
  40642. if ($throwException) {
  40643. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  40644. }
  40645. return false;
  40646. }
  40647. } else {
  40648. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  40649. $ok = @proc_terminate($this->process, $signal);
  40650. } elseif (function_exists('posix_kill')) {
  40651. $ok = @posix_kill($pid, $signal);
  40652. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  40653. $ok = false === fgets($pipes[2]);
  40654. }
  40655. if (!$ok) {
  40656. if ($throwException) {
  40657. throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
  40658. }
  40659. return false;
  40660. }
  40661. }
  40662. $this->latestSignal = (int) $signal;
  40663. $this->fallbackStatus['signaled'] = true;
  40664. $this->fallbackStatus['exitcode'] = -1;
  40665. $this->fallbackStatus['termsig'] = $this->latestSignal;
  40666. return true;
  40667. }
  40668. private function requireProcessIsStarted($functionName)
  40669. {
  40670. if (!$this->isStarted()) {
  40671. throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
  40672. }
  40673. }
  40674. private function requireProcessIsTerminated($functionName)
  40675. {
  40676. if (!$this->isTerminated()) {
  40677. throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
  40678. }
  40679. }
  40680. }
  40681. <?php
  40682. namespace Symfony\Component\Process;
  40683. use Symfony\Component\Process\Exception\InvalidArgumentException;
  40684. use Symfony\Component\Process\Exception\LogicException;
  40685. class ProcessBuilder
  40686. {
  40687. private $arguments;
  40688. private $cwd;
  40689. private $env = array();
  40690. private $input;
  40691. private $timeout = 60;
  40692. private $options = array();
  40693. private $inheritEnv = true;
  40694. private $prefix = array();
  40695. private $outputDisabled = false;
  40696. public function __construct(array $arguments = array())
  40697. {
  40698. $this->arguments = $arguments;
  40699. }
  40700. public static function create(array $arguments = array())
  40701. {
  40702. return new static($arguments);
  40703. }
  40704. public function add($argument)
  40705. {
  40706. $this->arguments[] = $argument;
  40707. return $this;
  40708. }
  40709. public function setPrefix($prefix)
  40710. {
  40711. $this->prefix = is_array($prefix) ? $prefix : array($prefix);
  40712. return $this;
  40713. }
  40714. public function setArguments(array $arguments)
  40715. {
  40716. $this->arguments = $arguments;
  40717. return $this;
  40718. }
  40719. public function setWorkingDirectory($cwd)
  40720. {
  40721. $this->cwd = $cwd;
  40722. return $this;
  40723. }
  40724. public function inheritEnvironmentVariables($inheritEnv = true)
  40725. {
  40726. $this->inheritEnv = $inheritEnv;
  40727. return $this;
  40728. }
  40729. public function setEnv($name, $value)
  40730. {
  40731. $this->env[$name] = $value;
  40732. return $this;
  40733. }
  40734. public function addEnvironmentVariables(array $variables)
  40735. {
  40736. $this->env = array_replace($this->env, $variables);
  40737. return $this;
  40738. }
  40739. public function setInput($input)
  40740. {
  40741. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  40742. return $this;
  40743. }
  40744. public function setTimeout($timeout)
  40745. {
  40746. if (null === $timeout) {
  40747. $this->timeout = null;
  40748. return $this;
  40749. }
  40750. $timeout = (float) $timeout;
  40751. if ($timeout < 0) {
  40752. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  40753. }
  40754. $this->timeout = $timeout;
  40755. return $this;
  40756. }
  40757. public function setOption($name, $value)
  40758. {
  40759. $this->options[$name] = $value;
  40760. return $this;
  40761. }
  40762. public function disableOutput()
  40763. {
  40764. $this->outputDisabled = true;
  40765. return $this;
  40766. }
  40767. public function enableOutput()
  40768. {
  40769. $this->outputDisabled = false;
  40770. return $this;
  40771. }
  40772. public function getProcess()
  40773. {
  40774. if (0 === count($this->prefix) && 0 === count($this->arguments)) {
  40775. throw new LogicException('You must add() command arguments before calling getProcess().');
  40776. }
  40777. $options = $this->options;
  40778. $arguments = array_merge($this->prefix, $this->arguments);
  40779. $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
  40780. if ($this->inheritEnv) {
  40781. $env = array_replace($_ENV, $_SERVER, $this->env);
  40782. } else {
  40783. $env = $this->env;
  40784. }
  40785. $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  40786. if ($this->outputDisabled) {
  40787. $process->disableOutput();
  40788. }
  40789. return $process;
  40790. }
  40791. }
  40792. <?php
  40793. namespace Symfony\Component\Process;
  40794. use Symfony\Component\Process\Exception\InvalidArgumentException;
  40795. class ProcessUtils
  40796. {
  40797. private function __construct()
  40798. {
  40799. }
  40800. public static function escapeArgument($argument)
  40801. {
  40802. if ('\\' === DIRECTORY_SEPARATOR) {
  40803. if ('' === $argument) {
  40804. return escapeshellarg($argument);
  40805. }
  40806. $escapedArgument = '';
  40807. $quote = false;
  40808. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  40809. if ('"' === $part) {
  40810. $escapedArgument .= '\\"';
  40811. } elseif (self::isSurroundedBy($part, '%')) {
  40812. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  40813. } else {
  40814. if ('\\' === substr($part, -1)) {
  40815. $part .= '\\';
  40816. }
  40817. $quote = true;
  40818. $escapedArgument .= $part;
  40819. }
  40820. }
  40821. if ($quote) {
  40822. $escapedArgument = '"'.$escapedArgument.'"';
  40823. }
  40824. return $escapedArgument;
  40825. }
  40826. return escapeshellarg($argument);
  40827. }
  40828. public static function validateInput($caller, $input)
  40829. {
  40830. if (null !== $input) {
  40831. if (is_resource($input)) {
  40832. return $input;
  40833. }
  40834. if (is_string($input)) {
  40835. return $input;
  40836. }
  40837. if (is_scalar($input)) {
  40838. return (string) $input;
  40839. }
  40840. if (is_object($input) && method_exists($input, '__toString')) {
  40841. @trigger_error('Passing an object as an input is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  40842. return (string) $input;
  40843. }
  40844. throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
  40845. }
  40846. return $input;
  40847. }
  40848. private static function isSurroundedBy($arg, $char)
  40849. {
  40850. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  40851. }
  40852. }
  40853. Copyright (c) 2011 Jordi Boggiano
  40854. Permission is hereby granted, free of charge, to any person obtaining a copy
  40855. of this software and associated documentation files (the "Software"), to deal
  40856. in the Software without restriction, including without limitation the rights
  40857. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  40858. copies of the Software, and to permit persons to whom the Software is furnished
  40859. to do so, subject to the following conditions:
  40860. The above copyright notice and this permission notice shall be included in all
  40861. copies or substantial portions of the Software.
  40862. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  40863. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  40864. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  40865. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  40866. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  40867. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  40868. THE SOFTWARE.
  40869. <?php
  40870. namespace Seld\JsonLint;
  40871. class DuplicateKeyException extends ParsingException
  40872. {
  40873. public function __construct($message, $key, array $details = array())
  40874. {
  40875. $details['key'] = $key;
  40876. parent::__construct($message, $details);
  40877. }
  40878. public function getKey()
  40879. {
  40880. return $this->details['key'];
  40881. }
  40882. }
  40883. <?php
  40884. namespace Seld\JsonLint;
  40885. use stdClass;
  40886. class JsonParser
  40887. {
  40888. const DETECT_KEY_CONFLICTS = 1;
  40889. const ALLOW_DUPLICATE_KEYS = 2;
  40890. const PARSE_TO_ASSOC = 4;
  40891. private $lexer;
  40892. private $flags;
  40893. private $stack;
  40894. private $vstack;
  40895. private $lstack;
  40896. private $symbols = array(
  40897. 'error' => 2,
  40898. 'JSONString' => 3,
  40899. 'STRING' => 4,
  40900. 'JSONNumber' => 5,
  40901. 'NUMBER' => 6,
  40902. 'JSONNullLiteral' => 7,
  40903. 'NULL' => 8,
  40904. 'JSONBooleanLiteral' => 9,
  40905. 'TRUE' => 10,
  40906. 'FALSE' => 11,
  40907. 'JSONText' => 12,
  40908. 'JSONValue' => 13,
  40909. 'EOF' => 14,
  40910. 'JSONObject' => 15,
  40911. 'JSONArray' => 16,
  40912. '{' => 17,
  40913. '}' => 18,
  40914. 'JSONMemberList' => 19,
  40915. 'JSONMember' => 20,
  40916. ':' => 21,
  40917. ',' => 22,
  40918. '[' => 23,
  40919. ']' => 24,
  40920. 'JSONElementList' => 25,
  40921. '$accept' => 0,
  40922. '$end' => 1,
  40923. );
  40924. private $terminals_ = array(
  40925. 2 => "error",
  40926. 4 => "STRING",
  40927. 6 => "NUMBER",
  40928. 8 => "NULL",
  40929. 10 => "TRUE",
  40930. 11 => "FALSE",
  40931. 14 => "EOF",
  40932. 17 => "{",
  40933. 18 => "}",
  40934. 21 => ":",
  40935. 22 => ",",
  40936. 23 => "[",
  40937. 24 => "]",
  40938. );
  40939. private $productions_ = array(
  40940. 0,
  40941. array(3, 1),
  40942. array(5, 1),
  40943. array(7, 1),
  40944. array(9, 1),
  40945. array(9, 1),
  40946. array(12, 2),
  40947. array(13, 1),
  40948. array(13, 1),
  40949. array(13, 1),
  40950. array(13, 1),
  40951. array(13, 1),
  40952. array(13, 1),
  40953. array(15, 2),
  40954. array(15, 3),
  40955. array(20, 3),
  40956. array(19, 1),
  40957. array(19, 3),
  40958. array(16, 2),
  40959. array(16, 3),
  40960. array(25, 1),
  40961. array(25, 3)
  40962. );
  40963. private $table = array(array(3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 12 => 1, 13 => 2, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 1 => array(3)), array( 14 => array(1,16)), array( 14 => array(2,7), 18 => array(2,7), 22 => array(2,7), 24 => array(2,7)), array( 14 => array(2,8), 18 => array(2,8), 22 => array(2,8), 24 => array(2,8)), array( 14 => array(2,9), 18 => array(2,9), 22 => array(2,9), 24 => array(2,9)), array( 14 => array(2,10), 18 => array(2,10), 22 => array(2,10), 24 => array(2,10)), array( 14 => array(2,11), 18 => array(2,11), 22 => array(2,11), 24 => array(2,11)), array( 14 => array(2,12), 18 => array(2,12), 22 => array(2,12), 24 => array(2,12)), array( 14 => array(2,3), 18 => array(2,3), 22 => array(2,3), 24 => array(2,3)), array( 14 => array(2,4), 18 => array(2,4), 22 => array(2,4), 24 => array(2,4)), array( 14 => array(2,5), 18 => array(2,5), 22 => array(2,5), 24 => array(2,5)), array( 14 => array(2,1), 18 => array(2,1), 21 => array(2,1), 22 => array(2,1), 24 => array(2,1)), array( 14 => array(2,2), 18 => array(2,2), 22 => array(2,2), 24 => array(2,2)), array( 3 => 20, 4 => array(1,12), 18 => array(1,17), 19 => 18, 20 => 19 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 23, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15), 24 => array(1,21), 25 => 22 ), array( 1 => array(2,6)), array( 14 => array(2,13), 18 => array(2,13), 22 => array(2,13), 24 => array(2,13)), array( 18 => array(1,24), 22 => array(1,25)), array( 18 => array(2,16), 22 => array(2,16)), array( 21 => array(1,26)), array( 14 => array(2,18), 18 => array(2,18), 22 => array(2,18), 24 => array(2,18)), array( 22 => array(1,28), 24 => array(1,27)), array( 22 => array(2,20), 24 => array(2,20)), array( 14 => array(2,14), 18 => array(2,14), 22 => array(2,14), 24 => array(2,14)), array( 3 => 20, 4 => array(1,12), 20 => 29 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 30, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 14 => array(2,19), 18 => array(2,19), 22 => array(2,19), 24 => array(2,19)), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 31, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 18 => array(2,17), 22 => array(2,17)), array( 18 => array(2,15), 22 => array(2,15)), array( 22 => array(2,21), 24 => array(2,21)),
  40964. );
  40965. private $defaultActions = array(
  40966. 16 => array(2, 6)
  40967. );
  40968. public function lint($input)
  40969. {
  40970. try {
  40971. $this->parse($input);
  40972. } catch (ParsingException $e) {
  40973. return $e;
  40974. }
  40975. }
  40976. public function parse($input, $flags = 0)
  40977. {
  40978. $this->failOnBOM($input);
  40979. $this->flags = $flags;
  40980. $this->stack = array(0);
  40981. $this->vstack = array(null);
  40982. $this->lstack = array();
  40983. $yytext = '';
  40984. $yylineno = 0;
  40985. $yyleng = 0;
  40986. $recovering = 0;
  40987. $TERROR = 2;
  40988. $EOF = 1;
  40989. $this->lexer = new Lexer();
  40990. $this->lexer->setInput($input);
  40991. $yyloc = $this->lexer->yylloc;
  40992. $this->lstack[] = $yyloc;
  40993. $symbol = null;
  40994. $preErrorSymbol = null;
  40995. $state = null;
  40996. $action = null;
  40997. $a = null;
  40998. $r = null;
  40999. $yyval = new stdClass;
  41000. $p = null;
  41001. $len = null;
  41002. $newState = null;
  41003. $expected = null;
  41004. $errStr = null;
  41005. while (true) {
  41006. $state = $this->stack[count($this->stack)-1];
  41007. if (isset($this->defaultActions[$state])) {
  41008. $action = $this->defaultActions[$state];
  41009. } else {
  41010. if ($symbol == null) {
  41011. $symbol = $this->lex();
  41012. }
  41013. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  41014. }
  41015. if (!$action || !$action[0]) {
  41016. if (!$recovering) {
  41017. $expected = array();
  41018. foreach ($this->table[$state] as $p => $ignore) {
  41019. if (isset($this->terminals_[$p]) && $p > 2) {
  41020. $expected[] = "'" . $this->terminals_[$p] . "'";
  41021. }
  41022. }
  41023. $message = null;
  41024. if (in_array("'STRING'", $expected) && in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  41025. $message = "Invalid string";
  41026. if ("'" === substr($this->lexer->match, 0, 1)) {
  41027. $message .= ", it appears you used single quotes instead of double quotes";
  41028. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u])}', $this->lexer->getUpcomingInput(), $match)) {
  41029. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  41030. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getUpcomingInput())) {
  41031. $message .= ", it appears you forgot to terminated the string, or attempted to write a multiline string which is invalid";
  41032. }
  41033. }
  41034. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  41035. $errStr .= $this->lexer->showPosition() . "\n";
  41036. if ($message) {
  41037. $errStr .= $message;
  41038. } else {
  41039. $errStr .= (count($expected) > 1) ? "Expected one of: " : "Expected: ";
  41040. $errStr .= implode(', ', $expected);
  41041. }
  41042. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  41043. $errStr .= " - It appears you have an extra trailing comma";
  41044. }
  41045. $this->parseError($errStr, array(
  41046. 'text' => $this->lexer->match,
  41047. 'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  41048. 'line' => $this->lexer->yylineno,
  41049. 'loc' => $yyloc,
  41050. 'expected' => $expected,
  41051. ));
  41052. }
  41053. if ($recovering == 3) {
  41054. if ($symbol == $EOF) {
  41055. throw new ParsingException($errStr ?: 'Parsing halted.');
  41056. }
  41057. $yyleng = $this->lexer->yyleng;
  41058. $yytext = $this->lexer->yytext;
  41059. $yylineno = $this->lexer->yylineno;
  41060. $yyloc = $this->lexer->yylloc;
  41061. $symbol = $this->lex();
  41062. }
  41063. while (true) {
  41064. if (array_key_exists($TERROR, $this->table[$state])) {
  41065. break;
  41066. }
  41067. if ($state == 0) {
  41068. throw new ParsingException($errStr ?: 'Parsing halted.');
  41069. }
  41070. $this->popStack(1);
  41071. $state = $this->stack[count($this->stack)-1];
  41072. }
  41073. $preErrorSymbol = $symbol;
  41074. $symbol = $TERROR;
  41075. $state = $this->stack[count($this->stack)-1];
  41076. $action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
  41077. $recovering = 3;
  41078. }
  41079. if (is_array($action[0]) && count($action) > 1) {
  41080. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  41081. }
  41082. switch ($action[0]) {
  41083. case 1:
  41084. $this->stack[] = $symbol;
  41085. $this->vstack[] = $this->lexer->yytext;
  41086. $this->lstack[] = $this->lexer->yylloc;
  41087. $this->stack[] = $action[1];
  41088. $symbol = null;
  41089. if (!$preErrorSymbol) {
  41090. $yyleng = $this->lexer->yyleng;
  41091. $yytext = $this->lexer->yytext;
  41092. $yylineno = $this->lexer->yylineno;
  41093. $yyloc = $this->lexer->yylloc;
  41094. if ($recovering > 0) {
  41095. $recovering--;
  41096. }
  41097. } else {
  41098. $symbol = $preErrorSymbol;
  41099. $preErrorSymbol = null;
  41100. }
  41101. break;
  41102. case 2:
  41103. $len = $this->productions_[$action[1]][1];
  41104. $yyval->token = $this->vstack[count($this->vstack) - $len];
  41105. $yyval->store = array(
  41106. 'first_line' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_line'],
  41107. 'last_line' => $this->lstack[count($this->lstack) - 1]['last_line'],
  41108. 'first_column' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_column'],
  41109. 'last_column' => $this->lstack[count($this->lstack) - 1]['last_column'],
  41110. );
  41111. $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack);
  41112. if (!$r instanceof Undefined) {
  41113. return $r;
  41114. }
  41115. if ($len) {
  41116. $this->popStack($len);
  41117. }
  41118. $this->stack[] = $this->productions_[$action[1]][0];
  41119. $this->vstack[] = $yyval->token;
  41120. $this->lstack[] = $yyval->store;
  41121. $newState = $this->table[$this->stack[count($this->stack)-2]][$this->stack[count($this->stack)-1]];
  41122. $this->stack[] = $newState;
  41123. break;
  41124. case 3:
  41125. return true;
  41126. }
  41127. }
  41128. return true;
  41129. }
  41130. protected function parseError($str, $hash)
  41131. {
  41132. throw new ParsingException($str, $hash);
  41133. }
  41134. private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
  41135. {
  41136. $len = count($tokens) - 1;
  41137. switch ($yystate) {
  41138. case 1:
  41139. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  41140. $yyval->token = $yytext;
  41141. break;
  41142. case 2:
  41143. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  41144. $yyval->token = floatval($yytext);
  41145. } else {
  41146. $yyval->token = strpos($yytext, '.') === false ? intval($yytext) : floatval($yytext);
  41147. }
  41148. break;
  41149. case 3:
  41150. $yyval->token = null;
  41151. break;
  41152. case 4:
  41153. $yyval->token = true;
  41154. break;
  41155. case 5:
  41156. $yyval->token = false;
  41157. break;
  41158. case 6:
  41159. return $yyval->token = $tokens[$len-1];
  41160. case 13:
  41161. if ($this->flags & self::PARSE_TO_ASSOC) {
  41162. $yyval->token = array();
  41163. } else {
  41164. $yyval->token = new stdClass;
  41165. }
  41166. break;
  41167. case 14:
  41168. $yyval->token = $tokens[$len-1];
  41169. break;
  41170. case 15:
  41171. $yyval->token = array($tokens[$len-2], $tokens[$len]);
  41172. break;
  41173. case 16:
  41174. $property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  41175. if ($this->flags & self::PARSE_TO_ASSOC) {
  41176. $yyval->token = array();
  41177. $yyval->token[$property] = $tokens[$len][1];
  41178. } else {
  41179. $yyval->token = new stdClass;
  41180. $yyval->token->$property = $tokens[$len][1];
  41181. }
  41182. break;
  41183. case 17:
  41184. if ($this->flags & self::PARSE_TO_ASSOC) {
  41185. $yyval->token =& $tokens[$len-2];
  41186. $key = $tokens[$len][0];
  41187. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2][$key])) {
  41188. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  41189. $errStr .= $this->lexer->showPosition() . "\n";
  41190. $errStr .= "Duplicate key: ".$tokens[$len][0];
  41191. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  41192. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2][$key])) {
  41193. $duplicateCount = 1;
  41194. do {
  41195. $duplicateKey = $key . '.' . $duplicateCount++;
  41196. } while (isset($tokens[$len-2][$duplicateKey]));
  41197. $key = $duplicateKey;
  41198. }
  41199. $tokens[$len-2][$key] = $tokens[$len][1];
  41200. } else {
  41201. $yyval->token = $tokens[$len-2];
  41202. $key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  41203. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
  41204. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  41205. $errStr .= $this->lexer->showPosition() . "\n";
  41206. $errStr .= "Duplicate key: ".$tokens[$len][0];
  41207. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  41208. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
  41209. $duplicateCount = 1;
  41210. do {
  41211. $duplicateKey = $key . '.' . $duplicateCount++;
  41212. } while (isset($tokens[$len-2]->$duplicateKey));
  41213. $key = $duplicateKey;
  41214. }
  41215. $tokens[$len-2]->$key = $tokens[$len][1];
  41216. }
  41217. break;
  41218. case 18:
  41219. $yyval->token = array();
  41220. break;
  41221. case 19:
  41222. $yyval->token = $tokens[$len-1];
  41223. break;
  41224. case 20:
  41225. $yyval->token = array($tokens[$len]);
  41226. break;
  41227. case 21:
  41228. $tokens[$len-2][] = $tokens[$len];
  41229. $yyval->token = $tokens[$len-2];
  41230. break;
  41231. }
  41232. return new Undefined();
  41233. }
  41234. private function stringInterpolation($match)
  41235. {
  41236. switch ($match[0]) {
  41237. case '\\\\':
  41238. return '\\';
  41239. case '\"':
  41240. return '"';
  41241. case '\b':
  41242. return chr(8);
  41243. case '\f':
  41244. return chr(12);
  41245. case '\n':
  41246. return "\n";
  41247. case '\r':
  41248. return "\r";
  41249. case '\t':
  41250. return "\t";
  41251. case '\/':
  41252. return "/";
  41253. default:
  41254. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', 0, 'UTF-8');
  41255. }
  41256. }
  41257. private function popStack($n)
  41258. {
  41259. $this->stack = array_slice($this->stack, 0, - (2 * $n));
  41260. $this->vstack = array_slice($this->vstack, 0, - $n);
  41261. $this->lstack = array_slice($this->lstack, 0, - $n);
  41262. }
  41263. private function lex()
  41264. {
  41265. $token = $this->lexer->lex() ?: 1;
  41266. if (!is_numeric($token)) {
  41267. $token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
  41268. }
  41269. return $token;
  41270. }
  41271. private function failOnBOM($input)
  41272. {
  41273. $bom = "\xEF\xBB\xBF";
  41274. if (substr($input, 0, 3) === $bom) {
  41275. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array());
  41276. }
  41277. }
  41278. }
  41279. <?php
  41280. namespace Seld\JsonLint;
  41281. class Lexer
  41282. {
  41283. private $EOF = 1;
  41284. private $rules = array(
  41285. 0 => '/^\s+/',
  41286. 1 => '/^-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  41287. 2 => '{^"(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x09\x0a-\x1f\\\\"]+)*"}',
  41288. 3 => '/^\{/',
  41289. 4 => '/^\}/',
  41290. 5 => '/^\[/',
  41291. 6 => '/^\]/',
  41292. 7 => '/^,/',
  41293. 8 => '/^:/',
  41294. 9 => '/^true\b/',
  41295. 10 => '/^false\b/',
  41296. 11 => '/^null\b/',
  41297. 12 => '/^$/',
  41298. 13 => '/^./',
  41299. );
  41300. private $conditions = array(
  41301. "INITIAL" => array(
  41302. "rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
  41303. "inclusive" => true,
  41304. ),
  41305. );
  41306. private $conditionStack;
  41307. private $input;
  41308. private $more;
  41309. private $done;
  41310. private $matched;
  41311. public $match;
  41312. public $yylineno;
  41313. public $yyleng;
  41314. public $yytext;
  41315. public $yylloc;
  41316. public function lex()
  41317. {
  41318. $r = $this->next();
  41319. if (!$r instanceof Undefined) {
  41320. return $r;
  41321. }
  41322. return $this->lex();
  41323. }
  41324. public function setInput($input)
  41325. {
  41326. $this->input = $input;
  41327. $this->more = false;
  41328. $this->done = false;
  41329. $this->yylineno = $this->yyleng = 0;
  41330. $this->yytext = $this->matched = $this->match = '';
  41331. $this->conditionStack = array('INITIAL');
  41332. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  41333. return $this;
  41334. }
  41335. public function showPosition()
  41336. {
  41337. $pre = str_replace("\n", '', $this->getPastInput());
  41338. $c = str_repeat('-', max(0, strlen($pre) - 1));
  41339. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  41340. }
  41341. public function getPastInput()
  41342. {
  41343. $past = substr($this->matched, 0, strlen($this->matched) - strlen($this->match));
  41344. return (strlen($past) > 20 ? '...' : '') . substr($past, -20);
  41345. }
  41346. public function getUpcomingInput()
  41347. {
  41348. $next = $this->match;
  41349. if (strlen($next) < 20) {
  41350. $next .= substr($this->input, 0, 20 - strlen($next));
  41351. }
  41352. return substr($next, 0, 20) . (strlen($next) > 20 ? '...' : '');
  41353. }
  41354. protected function parseError($str, $hash)
  41355. {
  41356. throw new \Exception($str);
  41357. }
  41358. private function next()
  41359. {
  41360. if ($this->done) {
  41361. return $this->EOF;
  41362. }
  41363. if (!$this->input) {
  41364. $this->done = true;
  41365. }
  41366. $token = null;
  41367. $match = null;
  41368. $col = null;
  41369. $lines = null;
  41370. if (!$this->more) {
  41371. $this->yytext = '';
  41372. $this->match = '';
  41373. }
  41374. $rules = $this->getCurrentRules();
  41375. $rulesLen = count($rules);
  41376. for ($i=0; $i < $rulesLen; $i++) {
  41377. if (preg_match($this->rules[$rules[$i]], $this->input, $match)) {
  41378. preg_match_all('/\n.*/', $match[0], $lines);
  41379. $lines = $lines[0];
  41380. if ($lines) {
  41381. $this->yylineno += count($lines);
  41382. }
  41383. $this->yylloc = array(
  41384. 'first_line' => $this->yylloc['last_line'],
  41385. 'last_line' => $this->yylineno+1,
  41386. 'first_column' => $this->yylloc['last_column'],
  41387. 'last_column' => $lines ? strlen($lines[count($lines) - 1]) - 1 : $this->yylloc['last_column'] + strlen($match[0]),
  41388. );
  41389. $this->yytext .= $match[0];
  41390. $this->match .= $match[0];
  41391. $this->yyleng = strlen($this->yytext);
  41392. $this->more = false;
  41393. $this->input = substr($this->input, strlen($match[0]));
  41394. $this->matched .= $match[0];
  41395. $token = $this->performAction($rules[$i], $this->conditionStack[count($this->conditionStack)-1]);
  41396. if ($token) {
  41397. return $token;
  41398. }
  41399. return new Undefined();
  41400. }
  41401. }
  41402. if ($this->input === "") {
  41403. return $this->EOF;
  41404. }
  41405. $this->parseError(
  41406. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
  41407. array(
  41408. 'text' => "",
  41409. 'token' => null,
  41410. 'line' => $this->yylineno,
  41411. )
  41412. );
  41413. }
  41414. private function getCurrentRules()
  41415. {
  41416. return $this->conditions[$this->conditionStack[count($this->conditionStack)-1]]['rules'];
  41417. }
  41418. private function performAction($avoiding_name_collisions, $YY_START)
  41419. {
  41420. switch ($avoiding_name_collisions) {
  41421. case 0:
  41422. break;
  41423. case 1:
  41424. return 6;
  41425. break;
  41426. case 2:
  41427. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  41428. return 4;
  41429. case 3:
  41430. return 17;
  41431. case 4:
  41432. return 18;
  41433. case 5:
  41434. return 23;
  41435. case 6:
  41436. return 24;
  41437. case 7:
  41438. return 22;
  41439. case 8:
  41440. return 21;
  41441. case 9:
  41442. return 10;
  41443. case 10:
  41444. return 11;
  41445. case 11:
  41446. return 8;
  41447. case 12:
  41448. return 14;
  41449. case 13:
  41450. return 'INVALID';
  41451. }
  41452. }
  41453. }
  41454. <?php
  41455. namespace Seld\JsonLint;
  41456. class ParsingException extends \Exception
  41457. {
  41458. protected $details;
  41459. public function __construct($message, $details = array())
  41460. {
  41461. $this->details = $details;
  41462. parent::__construct($message);
  41463. }
  41464. public function getDetails()
  41465. {
  41466. return $this->details;
  41467. }
  41468. }
  41469. <?php
  41470. namespace Seld\JsonLint;
  41471. class Undefined
  41472. {
  41473. }
  41474. Copyright (c) 2015 Jordi Boggiano
  41475. Permission is hereby granted, free of charge, to any person obtaining a copy
  41476. of this software and associated documentation files (the "Software"), to deal
  41477. in the Software without restriction, including without limitation the rights
  41478. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  41479. copies of the Software, and to permit persons to whom the Software is furnished
  41480. to do so, subject to the following conditions:
  41481. The above copyright notice and this permission notice shall be included in all
  41482. copies or substantial portions of the Software.
  41483. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  41484. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  41485. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  41486. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  41487. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  41488. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  41489. THE SOFTWARE.
  41490. <?php
  41491. require __DIR__.'/../vendor/autoload.php';
  41492. echo 'Say hello (visible): ';
  41493. $answer = Seld\CliPrompt\CliPrompt::prompt();
  41494. echo 'You answered: '.$answer . PHP_EOL;
  41495. echo 'Say hello (hidden): ';
  41496. $answer = Seld\CliPrompt\CliPrompt::hiddenPrompt();
  41497. echo 'You answered: '.$answer . PHP_EOL;
  41498. <?php
  41499. namespace Seld\CliPrompt;
  41500. class CliPrompt
  41501. {
  41502. public static function prompt()
  41503. {
  41504. $stdin = fopen('php://stdin', 'r');
  41505. $answer = self::trimAnswer(fgets($stdin, 4096));
  41506. fclose($stdin);
  41507. return $answer;
  41508. }
  41509. public static function hiddenPrompt($allowFallback = false)
  41510. {
  41511. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  41512. $exe = __DIR__.'\\..\\res\\hiddeninput.exe';
  41513. if ('phar:' === substr(__FILE__, 0, 5)) {
  41514. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  41515. $source = fopen($exe, 'r');
  41516. $target = fopen($tmpExe, 'w+');
  41517. stream_copy_to_stream($source, $target);
  41518. fclose($source);
  41519. fclose($target);
  41520. unset($source, $target);
  41521. $exe = $tmpExe;
  41522. }
  41523. $answer = self::trimAnswer(shell_exec($exe));
  41524. if (isset($tmpExe)) {
  41525. unlink($tmpExe);
  41526. }
  41527. echo PHP_EOL;
  41528. return $answer;
  41529. }
  41530. if (file_exists('/usr/bin/env')) {
  41531. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  41532. foreach (array('bash', 'zsh', 'ksh', 'csh', 'sh') as $sh) {
  41533. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  41534. $shell = $sh;
  41535. break;
  41536. }
  41537. }
  41538. if (isset($shell)) {
  41539. $readCmd = ($shell === 'csh') ? 'set mypassword = $<' : 'read -r mypassword';
  41540. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  41541. $value = self::trimAnswer(shell_exec($command));
  41542. echo PHP_EOL;
  41543. return $value;
  41544. }
  41545. }
  41546. if (!$allowFallback) {
  41547. throw new \RuntimeException('Could not prompt for input in a secure fashion, aborting');
  41548. }
  41549. return self::prompt();
  41550. }
  41551. private static function trimAnswer($str)
  41552. {
  41553. return preg_replace('{\r?\n$}D', '', $str);
  41554. }
  41555. }
  41556. MIT License
  41557. Copyright (c) 2016
  41558. Permission is hereby granted, free of charge, to any person obtaining a copy
  41559. of this software and associated documentation files (the "Software"), to deal
  41560. in the Software without restriction, including without limitation the rights
  41561. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  41562. copies of the Software, and to permit persons to whom the Software is
  41563. furnished to do so, subject to the following conditions:
  41564. The above copyright notice and this permission notice shall be included in all
  41565. copies or substantial portions of the Software.
  41566. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  41567. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  41568. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  41569. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  41570. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  41571. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  41572. SOFTWARE.
  41573. <?php
  41574. namespace JsonSchema\Constraints;
  41575. class CollectionConstraint extends Constraint
  41576. {
  41577. public function check($value, $schema = null, $path = null, $i = null)
  41578. {
  41579. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  41580. $this->addError($path, "There must be a minimum of " . $schema->minItems . " items in the array", 'minItems', array('minItems' => $schema->minItems,));
  41581. }
  41582. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  41583. $this->addError($path, "There must be a maximum of " . $schema->maxItems . " items in the array", 'maxItems', array('maxItems' => $schema->maxItems,));
  41584. }
  41585. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  41586. $unique = $value;
  41587. if (is_array($value) && count($value)) {
  41588. $unique = array_map(function($e) { return var_export($e, true); }, $value);
  41589. }
  41590. if (count(array_unique($unique)) != count($value)) {
  41591. $this->addError($path, "There are no duplicates allowed in the array", 'uniqueItems');
  41592. }
  41593. }
  41594. if (isset($schema->items)) {
  41595. $this->validateItems($value, $schema, $path, $i);
  41596. }
  41597. }
  41598. protected function validateItems($value, $schema = null, $path = null, $i = null)
  41599. {
  41600. if (is_object($schema->items)) {
  41601. foreach ($value as $k => $v) {
  41602. $initErrors = $this->getErrors();
  41603. $this->checkUndefined($v, $schema->items, $path, $k);
  41604. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  41605. $secondErrors = $this->getErrors();
  41606. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  41607. }
  41608. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  41609. $this->errors = $secondErrors;
  41610. } else if (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  41611. $this->errors = $initErrors;
  41612. }
  41613. }
  41614. } else {
  41615. foreach ($value as $k => $v) {
  41616. if (array_key_exists($k, $schema->items)) {
  41617. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  41618. } else {
  41619. if (property_exists($schema, 'additionalItems')) {
  41620. if ($schema->additionalItems !== false) {
  41621. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  41622. } else {
  41623. $this->addError(
  41624. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems,));
  41625. }
  41626. } else {
  41627. $this->checkUndefined($v, new \stdClass(), $path, $k);
  41628. }
  41629. }
  41630. }
  41631. if(count($value) > 0) {
  41632. for ($k = count($value); $k < count($schema->items); $k++) {
  41633. $this->checkUndefined(new UndefinedConstraint(), $schema->items[$k], $path, $k);
  41634. }
  41635. }
  41636. }
  41637. }
  41638. }
  41639. <?php
  41640. namespace JsonSchema\Constraints;
  41641. use JsonSchema\Uri\UriRetriever;
  41642. abstract class Constraint implements ConstraintInterface
  41643. {
  41644. protected $checkMode = self::CHECK_MODE_NORMAL;
  41645. protected $uriRetriever;
  41646. protected $errors = array();
  41647. protected $inlineSchemaProperty = '$schema';
  41648. const CHECK_MODE_NORMAL = 1;
  41649. const CHECK_MODE_TYPE_CAST = 2;
  41650. private $factory;
  41651. public function __construct($checkMode = self::CHECK_MODE_NORMAL, UriRetriever $uriRetriever = null, Factory $factory = null)
  41652. {
  41653. $this->checkMode = $checkMode;
  41654. $this->uriRetriever = $uriRetriever;
  41655. $this->factory = $factory;
  41656. }
  41657. public function getUriRetriever()
  41658. {
  41659. if (is_null($this->uriRetriever))
  41660. {
  41661. $this->setUriRetriever(new UriRetriever);
  41662. }
  41663. return $this->uriRetriever;
  41664. }
  41665. public function getFactory()
  41666. {
  41667. if (!$this->factory) {
  41668. $this->factory = new Factory($this->getUriRetriever());
  41669. }
  41670. return $this->factory;
  41671. }
  41672. public function setUriRetriever(UriRetriever $uriRetriever)
  41673. {
  41674. $this->uriRetriever = $uriRetriever;
  41675. }
  41676. public function addError($path, $message, $constraint='', array $more=null)
  41677. {
  41678. $error = array(
  41679. 'property' => $path,
  41680. 'message' => $message,
  41681. 'constraint' => $constraint,
  41682. );
  41683. if (is_array($more) && count($more) > 0)
  41684. {
  41685. $error += $more;
  41686. }
  41687. $this->errors[] = $error;
  41688. }
  41689. public function addErrors(array $errors)
  41690. {
  41691. $this->errors = array_merge($this->errors, $errors);
  41692. }
  41693. public function getErrors()
  41694. {
  41695. return $this->errors;
  41696. }
  41697. public function isValid()
  41698. {
  41699. return !$this->getErrors();
  41700. }
  41701. public function reset()
  41702. {
  41703. $this->errors = array();
  41704. }
  41705. protected function incrementPath($path, $i)
  41706. {
  41707. if ($path !== '') {
  41708. if (is_int($i)) {
  41709. $path .= '[' . $i . ']';
  41710. } elseif ($i == '') {
  41711. $path .= '';
  41712. } else {
  41713. $path .= '.' . $i;
  41714. }
  41715. } else {
  41716. $path = $i;
  41717. }
  41718. return $path;
  41719. }
  41720. protected function checkArray($value, $schema = null, $path = null, $i = null)
  41721. {
  41722. $validator = $this->getFactory()->createInstanceFor('collection');
  41723. $validator->check($value, $schema, $path, $i);
  41724. $this->addErrors($validator->getErrors());
  41725. }
  41726. protected function checkObject($value, $schema = null, $path = null, $i = null, $patternProperties = null)
  41727. {
  41728. $validator = $this->getFactory()->createInstanceFor('object');
  41729. $validator->check($value, $schema, $path, $i, $patternProperties);
  41730. $this->addErrors($validator->getErrors());
  41731. }
  41732. protected function checkType($value, $schema = null, $path = null, $i = null)
  41733. {
  41734. $validator = $this->getFactory()->createInstanceFor('type');
  41735. $validator->check($value, $schema, $path, $i);
  41736. $this->addErrors($validator->getErrors());
  41737. }
  41738. protected function checkUndefined($value, $schema = null, $path = null, $i = null)
  41739. {
  41740. $validator = $this->getFactory()->createInstanceFor('undefined');
  41741. $validator->check($value, $schema, $path, $i);
  41742. $this->addErrors($validator->getErrors());
  41743. }
  41744. protected function checkString($value, $schema = null, $path = null, $i = null)
  41745. {
  41746. $validator = $this->getFactory()->createInstanceFor('string');
  41747. $validator->check($value, $schema, $path, $i);
  41748. $this->addErrors($validator->getErrors());
  41749. }
  41750. protected function checkNumber($value, $schema = null, $path = null, $i = null)
  41751. {
  41752. $validator = $this->getFactory()->createInstanceFor('number');
  41753. $validator->check($value, $schema, $path, $i);
  41754. $this->addErrors($validator->getErrors());
  41755. }
  41756. protected function checkEnum($value, $schema = null, $path = null, $i = null)
  41757. {
  41758. $validator = $this->getFactory()->createInstanceFor('enum');
  41759. $validator->check($value, $schema, $path, $i);
  41760. $this->addErrors($validator->getErrors());
  41761. }
  41762. protected function checkFormat($value, $schema = null, $path = null, $i = null)
  41763. {
  41764. $validator = $this->getFactory()->createInstanceFor('format');
  41765. $validator->check($value, $schema, $path, $i);
  41766. $this->addErrors($validator->getErrors());
  41767. }
  41768. protected function retrieveUri($uri)
  41769. {
  41770. if (null === $this->uriRetriever) {
  41771. $this->setUriRetriever(new UriRetriever);
  41772. }
  41773. $jsonSchema = $this->uriRetriever->retrieve($uri);
  41774. return $jsonSchema;
  41775. }
  41776. }
  41777. <?php
  41778. namespace JsonSchema\Constraints;
  41779. interface ConstraintInterface
  41780. {
  41781. public function getErrors();
  41782. public function addErrors(array $errors);
  41783. public function addError($path, $message, $constraint='', array $more=null);
  41784. public function isValid();
  41785. public function check($value, $schema = null, $path = null, $i = null);
  41786. }<?php
  41787. namespace JsonSchema\Constraints;
  41788. class EnumConstraint extends Constraint
  41789. {
  41790. public function check($element, $schema = null, $path = null, $i = null)
  41791. {
  41792. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  41793. return;
  41794. }
  41795. foreach ($schema->enum as $enum) {
  41796. $type = gettype($element);
  41797. if ($type === gettype($enum)) {
  41798. if ($type == "object") {
  41799. if ($element == $enum)
  41800. return;
  41801. } else {
  41802. if ($element === $enum)
  41803. return;
  41804. }
  41805. }
  41806. }
  41807. $this->addError($path, "Does not have a value in the enumeration " . json_encode($schema->enum), 'enum', array('enum' => $schema->enum,));
  41808. }
  41809. }
  41810. <?php
  41811. namespace JsonSchema\Constraints;
  41812. use JsonSchema\Exception\InvalidArgumentException;
  41813. use JsonSchema\Uri\UriRetriever;
  41814. use JsonSchema\Validator;
  41815. class Factory
  41816. {
  41817. protected $uriRetriever;
  41818. protected $constraintMap = array(
  41819. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  41820. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  41821. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  41822. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  41823. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  41824. 'string' => 'JsonSchema\Constraints\StringConstraint',
  41825. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  41826. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  41827. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  41828. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  41829. 'validator' => 'JsonSchema\Validator',
  41830. );
  41831. public function __construct(UriRetriever $uriRetriever = null)
  41832. {
  41833. if (!$uriRetriever) {
  41834. $uriRetriever = new UriRetriever();
  41835. }
  41836. $this->uriRetriever = $uriRetriever;
  41837. }
  41838. public function getUriRetriever()
  41839. {
  41840. return $this->uriRetriever;
  41841. }
  41842. public function setConstraintClass($name, $class)
  41843. {
  41844. if (!class_exists($class)) {
  41845. throw new InvalidArgumentException('Unknown constraint ' . $name);
  41846. }
  41847. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  41848. throw new InvalidArgumentException('Invalid class ' . $name);
  41849. }
  41850. $this->constraintMap[$name] = $class;
  41851. return $this;
  41852. }
  41853. public function createInstanceFor($constraintName)
  41854. {
  41855. if (array_key_exists($constraintName, $this->constraintMap)) {
  41856. return new $this->constraintMap[$constraintName](Constraint::CHECK_MODE_NORMAL, $this->uriRetriever, $this);
  41857. }
  41858. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  41859. }
  41860. }
  41861. <?php
  41862. namespace JsonSchema\Constraints;
  41863. use JsonSchema\Rfc3339;
  41864. class FormatConstraint extends Constraint
  41865. {
  41866. public function check($element, $schema = null, $path = null, $i = null)
  41867. {
  41868. if (!isset($schema->format)) {
  41869. return;
  41870. }
  41871. switch ($schema->format) {
  41872. case 'date':
  41873. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  41874. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format,));
  41875. }
  41876. break;
  41877. case 'time':
  41878. if (!$this->validateDateTime($element, 'H:i:s')) {
  41879. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format,));
  41880. }
  41881. break;
  41882. case 'date-time':
  41883. if (null === Rfc3339::createFromString($element)) {
  41884. $this->addError($path, sprintf('Invalid date-time %s, expected format YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DDThh:mm:ss+hh:mm', json_encode($element)), 'format', array('format' => $schema->format,));
  41885. }
  41886. break;
  41887. case 'utc-millisec':
  41888. if (!$this->validateDateTime($element, 'U')) {
  41889. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format,));
  41890. }
  41891. break;
  41892. case 'regex':
  41893. if (!$this->validateRegex($element)) {
  41894. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format,));
  41895. }
  41896. break;
  41897. case 'color':
  41898. if (!$this->validateColor($element)) {
  41899. $this->addError($path, "Invalid color", 'format', array('format' => $schema->format,));
  41900. }
  41901. break;
  41902. case 'style':
  41903. if (!$this->validateStyle($element)) {
  41904. $this->addError($path, "Invalid style", 'format', array('format' => $schema->format,));
  41905. }
  41906. break;
  41907. case 'phone':
  41908. if (!$this->validatePhone($element)) {
  41909. $this->addError($path, "Invalid phone number", 'format', array('format' => $schema->format,));
  41910. }
  41911. break;
  41912. case 'uri':
  41913. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  41914. $this->addError($path, "Invalid URL format", 'format', array('format' => $schema->format,));
  41915. }
  41916. break;
  41917. case 'email':
  41918. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE)) {
  41919. $this->addError($path, "Invalid email", 'format', array('format' => $schema->format,));
  41920. }
  41921. break;
  41922. case 'ip-address':
  41923. case 'ipv4':
  41924. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  41925. $this->addError($path, "Invalid IP address", 'format', array('format' => $schema->format,));
  41926. }
  41927. break;
  41928. case 'ipv6':
  41929. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  41930. $this->addError($path, "Invalid IP address", 'format', array('format' => $schema->format,));
  41931. }
  41932. break;
  41933. case 'host-name':
  41934. case 'hostname':
  41935. if (!$this->validateHostname($element)) {
  41936. $this->addError($path, "Invalid hostname", 'format', array('format' => $schema->format,));
  41937. }
  41938. break;
  41939. default:
  41940. break;
  41941. }
  41942. }
  41943. protected function validateDateTime($datetime, $format)
  41944. {
  41945. $dt = \DateTime::createFromFormat($format, $datetime);
  41946. if (!$dt) {
  41947. return false;
  41948. }
  41949. return $datetime === $dt->format($format);
  41950. }
  41951. protected function validateRegex($regex)
  41952. {
  41953. return false !== @preg_match('/' . $regex . '/', '');
  41954. }
  41955. protected function validateColor($color)
  41956. {
  41957. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  41958. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  41959. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  41960. return true;
  41961. }
  41962. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  41963. }
  41964. protected function validateStyle($style)
  41965. {
  41966. $properties = explode(';', rtrim($style, ';'));
  41967. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  41968. return empty($invalidEntries);
  41969. }
  41970. protected function validatePhone($phone)
  41971. {
  41972. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  41973. }
  41974. protected function validateHostname($host)
  41975. {
  41976. return preg_match('/^[_a-z]+\.([_a-z]+\.?)+$/i', $host);
  41977. }
  41978. }
  41979. <?php
  41980. namespace JsonSchema\Constraints;
  41981. class NumberConstraint extends Constraint
  41982. {
  41983. public function check($element, $schema = null, $path = null, $i = null)
  41984. {
  41985. if (isset($schema->exclusiveMinimum)) {
  41986. if (isset($schema->minimum)) {
  41987. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  41988. $this->addError($path, "Must have a minimum value of " . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum,));
  41989. } else if ($element < $schema->minimum) {
  41990. $this->addError($path, "Must have a minimum value of " . $schema->minimum, 'minimum', array('minimum' => $schema->minimum,));
  41991. }
  41992. } else {
  41993. $this->addError($path, "Use of exclusiveMinimum requires presence of minimum", 'missingMinimum');
  41994. }
  41995. } else if (isset($schema->minimum) && $element < $schema->minimum) {
  41996. $this->addError($path, "Must have a minimum value of " . $schema->minimum, 'minimum', array('minimum' => $schema->minimum,));
  41997. }
  41998. if (isset($schema->exclusiveMaximum)) {
  41999. if (isset($schema->maximum)) {
  42000. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  42001. $this->addError($path, "Must have a maximum value of " . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum,));
  42002. } else if ($element > $schema->maximum) {
  42003. $this->addError($path, "Must have a maximum value of " . $schema->maximum, 'maximum', array('maximum' => $schema->maximum,));
  42004. }
  42005. } else {
  42006. $this->addError($path, "Use of exclusiveMaximum requires presence of maximum", 'missingMaximum');
  42007. }
  42008. } else if (isset($schema->maximum) && $element > $schema->maximum) {
  42009. $this->addError($path, "Must have a maximum value of " . $schema->maximum, 'maximum', array('maximum' => $schema->maximum,));
  42010. }
  42011. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  42012. $this->addError($path, "Is not divisible by " . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy,));
  42013. }
  42014. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  42015. $this->addError($path, "Must be a multiple of " . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf,));
  42016. }
  42017. $this->checkFormat($element, $schema, $path, $i);
  42018. }
  42019. private function fmod($number1, $number2)
  42020. {
  42021. $modulus = fmod($number1, $number2);
  42022. $precision = abs(0.0000000001);
  42023. $diff = (float)($modulus - $number2);
  42024. if (-$precision < $diff && $diff < $precision) {
  42025. return 0.0;
  42026. }
  42027. $decimals1 = mb_strpos($number1, ".") ? mb_strlen($number1) - mb_strpos($number1, ".") - 1 : 0;
  42028. $decimals2 = mb_strpos($number2, ".") ? mb_strlen($number2) - mb_strpos($number2, ".") - 1 : 0;
  42029. return (float)round($modulus, max($decimals1, $decimals2));
  42030. }
  42031. }
  42032. <?php
  42033. namespace JsonSchema\Constraints;
  42034. class ObjectConstraint extends Constraint
  42035. {
  42036. function check($element, $definition = null, $path = null, $additionalProp = null, $patternProperties = null)
  42037. {
  42038. if ($element instanceof UndefinedConstraint) {
  42039. return;
  42040. }
  42041. $matches = array();
  42042. if ($patternProperties) {
  42043. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  42044. }
  42045. if ($definition) {
  42046. $this->validateDefinition($element, $definition, $path);
  42047. }
  42048. $this->validateElement($element, $matches, $definition, $path, $additionalProp);
  42049. }
  42050. public function validatePatternProperties($element, $path, $patternProperties)
  42051. {
  42052. $try = array('/','#','+','~','%');
  42053. $matches = array();
  42054. foreach ($patternProperties as $pregex => $schema) {
  42055. $delimiter = '/';
  42056. foreach ($try as $delimiter) {
  42057. if (strpos($pregex, $delimiter) === false) {
  42058. break;
  42059. }
  42060. }
  42061. if (@preg_match($delimiter. $pregex . $delimiter, '') === false) {
  42062. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex,));
  42063. continue;
  42064. }
  42065. foreach ($element as $i => $value) {
  42066. if (preg_match($delimiter . $pregex . $delimiter, $i)) {
  42067. $matches[] = $i;
  42068. $this->checkUndefined($value, $schema ? : new \stdClass(), $path, $i);
  42069. }
  42070. }
  42071. }
  42072. return $matches;
  42073. }
  42074. public function validateElement($element, $matches, $objectDefinition = null, $path = null, $additionalProp = null)
  42075. {
  42076. $this->validateMinMaxConstraint($element, $objectDefinition, $path);
  42077. foreach ($element as $i => $value) {
  42078. $definition = $this->getProperty($objectDefinition, $i);
  42079. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  42080. $this->addError($path, "The property " . $i . " is not defined and the definition does not allow additional properties", 'additionalProp');
  42081. }
  42082. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  42083. if ($additionalProp === true) {
  42084. $this->checkUndefined($value, null, $path, $i);
  42085. } else {
  42086. $this->checkUndefined($value, $additionalProp, $path, $i);
  42087. }
  42088. }
  42089. $require = $this->getProperty($definition, 'requires');
  42090. if ($require && !$this->getProperty($element, $require)) {
  42091. $this->addError($path, "The presence of the property " . $i . " requires that " . $require . " also be present", 'requires');
  42092. }
  42093. if (!$definition) {
  42094. $this->checkUndefined($value, new \stdClass(), $path, $i);
  42095. }
  42096. $property = $this->getProperty($element, $i, new UndefinedConstraint());
  42097. if (is_object($property)) {
  42098. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  42099. }
  42100. }
  42101. }
  42102. public function validateDefinition($element, $objectDefinition = null, $path = null)
  42103. {
  42104. foreach ($objectDefinition as $i => $value) {
  42105. $property = $this->getProperty($element, $i, new UndefinedConstraint());
  42106. $definition = $this->getProperty($objectDefinition, $i);
  42107. $this->checkUndefined($property, $definition, $path, $i);
  42108. }
  42109. }
  42110. protected function getProperty($element, $property, $fallback = null)
  42111. {
  42112. if (is_array($element) ) {
  42113. return array_key_exists($property, $element) ? $element[$property] : $fallback;
  42114. } elseif (is_object($element)) {
  42115. return property_exists($element, $property) ? $element->$property : $fallback;
  42116. }
  42117. return $fallback;
  42118. }
  42119. protected function validateMinMaxConstraint($element, $objectDefinition, $path) {
  42120. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  42121. if (count(get_object_vars($element)) < $objectDefinition->minProperties) {
  42122. $this->addError($path, "Must contain a minimum of " . $objectDefinition->minProperties . " properties", 'minProperties', array('minProperties' => $objectDefinition->minProperties,));
  42123. }
  42124. }
  42125. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  42126. if (count(get_object_vars($element)) > $objectDefinition->maxProperties) {
  42127. $this->addError($path, "Must contain no more than " . $objectDefinition->maxProperties . " properties", 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties,));
  42128. }
  42129. }
  42130. }
  42131. }
  42132. <?php
  42133. namespace JsonSchema\Constraints;
  42134. use JsonSchema\Exception\InvalidArgumentException;
  42135. class SchemaConstraint extends Constraint
  42136. {
  42137. public function check($element, $schema = null, $path = null, $i = null)
  42138. {
  42139. if ($schema !== null) {
  42140. $this->checkUndefined($element, $schema, '', '');
  42141. } elseif (property_exists($element, $this->inlineSchemaProperty)) {
  42142. $this->checkUndefined($element, $element->{$this->inlineSchemaProperty}, '', '');
  42143. } else {
  42144. throw new InvalidArgumentException('no schema found to verify against');
  42145. }
  42146. }
  42147. }<?php
  42148. namespace JsonSchema\Constraints;
  42149. class StringConstraint extends Constraint
  42150. {
  42151. public function check($element, $schema = null, $path = null, $i = null)
  42152. {
  42153. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  42154. $this->addError($path, "Must be at most " . $schema->maxLength . " characters long", 'maxLength', array(
  42155. 'maxLength' => $schema->maxLength,
  42156. ));
  42157. }
  42158. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  42159. $this->addError($path, "Must be at least " . $schema->minLength . " characters long", 'minLength', array(
  42160. 'minLength' => $schema->minLength,
  42161. ));
  42162. }
  42163. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#', $element)) {
  42164. $this->addError($path, "Does not match the regex pattern " . $schema->pattern, 'pattern', array(
  42165. 'pattern' => $schema->pattern,
  42166. ));
  42167. }
  42168. $this->checkFormat($element, $schema, $path, $i);
  42169. }
  42170. private function strlen($string)
  42171. {
  42172. if (extension_loaded('mbstring')) {
  42173. return mb_strlen($string, mb_detect_encoding($string));
  42174. } else {
  42175. return strlen($string);
  42176. }
  42177. }
  42178. }
  42179. <?php
  42180. namespace JsonSchema\Constraints;
  42181. use JsonSchema\Exception\InvalidArgumentException;
  42182. use UnexpectedValueException as StandardUnexpectedValueException;
  42183. class TypeConstraint extends Constraint
  42184. {
  42185. static $wording = array(
  42186. 'integer' => 'an integer',
  42187. 'number' => 'a number',
  42188. 'boolean' => 'a boolean',
  42189. 'object' => 'an object',
  42190. 'array' => 'an array',
  42191. 'string' => 'a string',
  42192. 'null' => 'a null',
  42193. 'any' => NULL,
  42194. 0 => NULL,
  42195. );
  42196. public function check($value = null, $schema = null, $path = null, $i = null)
  42197. {
  42198. $type = isset($schema->type) ? $schema->type : null;
  42199. $isValid = true;
  42200. if (is_array($type)) {
  42201. $validatedOneType = false;
  42202. $errors = array();
  42203. foreach ($type as $tp) {
  42204. $validator = new TypeConstraint($this->checkMode);
  42205. $subSchema = new \stdClass();
  42206. $subSchema->type = $tp;
  42207. $validator->check($value, $subSchema, $path, null);
  42208. $error = $validator->getErrors();
  42209. if (!count($error)) {
  42210. $validatedOneType = true;
  42211. break;
  42212. }
  42213. $errors = $error;
  42214. }
  42215. if (!$validatedOneType) {
  42216. $this->addErrors($errors);
  42217. return;
  42218. }
  42219. } elseif (is_object($type)) {
  42220. $this->checkUndefined($value, $type, $path);
  42221. } else {
  42222. $isValid = $this->validateType($value, $type);
  42223. }
  42224. if ($isValid === false) {
  42225. if (!isset(self::$wording[$type])) {
  42226. throw new StandardUnexpectedValueException(
  42227. sprintf(
  42228. "No wording for %s available, expected wordings are: [%s]",
  42229. var_export($type, true),
  42230. implode(', ', array_filter(self::$wording)))
  42231. );
  42232. }
  42233. $this->addError($path, ucwords(gettype($value)) . " value found, but " . self::$wording[$type] . " is required", 'type');
  42234. }
  42235. }
  42236. protected function validateType($value, $type)
  42237. {
  42238. if (!$type) {
  42239. return true;
  42240. }
  42241. if ('integer' === $type) {
  42242. return is_int($value);
  42243. }
  42244. if ('number' === $type) {
  42245. return is_numeric($value) && !is_string($value);
  42246. }
  42247. if ('boolean' === $type) {
  42248. return is_bool($value);
  42249. }
  42250. if ('object' === $type) {
  42251. return is_object($value);
  42252. }
  42253. if ('array' === $type) {
  42254. return is_array($value);
  42255. }
  42256. if ('string' === $type) {
  42257. return is_string($value);
  42258. }
  42259. if ('email' === $type) {
  42260. return is_string($value);
  42261. }
  42262. if ('null' === $type) {
  42263. return is_null($value);
  42264. }
  42265. if ('any' === $type) {
  42266. return true;
  42267. }
  42268. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  42269. }
  42270. }
  42271. <?php
  42272. namespace JsonSchema\Constraints;
  42273. use JsonSchema\Exception\InvalidArgumentException;
  42274. use JsonSchema\Uri\UriResolver;
  42275. class UndefinedConstraint extends Constraint
  42276. {
  42277. public function check($value, $schema = null, $path = null, $i = null)
  42278. {
  42279. if (is_null($schema) || !is_object($schema)) {
  42280. return;
  42281. }
  42282. $i = is_null($i) ? "" : $i;
  42283. $path = $this->incrementPath($path, $i);
  42284. $this->validateCommonProperties($value, $schema, $path);
  42285. $this->validateOfProperties($value, $schema, $path);
  42286. $this->validateTypes($value, $schema, $path, $i);
  42287. }
  42288. public function validateTypes($value, $schema = null, $path = null, $i = null)
  42289. {
  42290. if (is_array($value)) {
  42291. $this->checkArray($value, $schema, $path, $i);
  42292. }
  42293. if (is_object($value)) {
  42294. $this->checkObject(
  42295. $value,
  42296. isset($schema->properties) ? $schema->properties : $schema,
  42297. $path,
  42298. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  42299. isset($schema->patternProperties) ? $schema->patternProperties : null
  42300. );
  42301. }
  42302. if (is_string($value)) {
  42303. $this->checkString($value, $schema, $path, $i);
  42304. }
  42305. if (is_numeric($value)) {
  42306. $this->checkNumber($value, $schema, $path, $i);
  42307. }
  42308. if (isset($schema->enum)) {
  42309. $this->checkEnum($value, $schema, $path, $i);
  42310. }
  42311. }
  42312. protected function validateCommonProperties($value, $schema = null, $path = null, $i = "")
  42313. {
  42314. if (isset($schema->extends)) {
  42315. if (is_string($schema->extends)) {
  42316. $schema->extends = $this->validateUri($schema, $schema->extends);
  42317. }
  42318. if (is_array($schema->extends)) {
  42319. foreach ($schema->extends as $extends) {
  42320. $this->checkUndefined($value, $extends, $path, $i);
  42321. }
  42322. } else {
  42323. $this->checkUndefined($value, $schema->extends, $path, $i);
  42324. }
  42325. }
  42326. if (is_object($value)) {
  42327. if (!($value instanceof UndefinedConstraint) && isset($schema->required) && is_array($schema->required) ) {
  42328. foreach ($schema->required as $required) {
  42329. if (!property_exists($value, $required)) {
  42330. $this->addError((!$path) ? $required : "$path.$required", "The property " . $required . " is required", 'required');
  42331. }
  42332. }
  42333. } else if (isset($schema->required) && !is_array($schema->required)) {
  42334. if ( $schema->required && $value instanceof UndefinedConstraint) {
  42335. $this->addError($path, "Is missing and it is required", 'required');
  42336. }
  42337. }
  42338. }
  42339. if (!($value instanceof UndefinedConstraint)) {
  42340. $this->checkType($value, $schema, $path);
  42341. }
  42342. if (isset($schema->disallow)) {
  42343. $initErrors = $this->getErrors();
  42344. $typeSchema = new \stdClass();
  42345. $typeSchema->type = $schema->disallow;
  42346. $this->checkType($value, $typeSchema, $path);
  42347. if (count($this->getErrors()) == count($initErrors)) {
  42348. $this->addError($path, "Disallowed value was matched", 'disallow');
  42349. } else {
  42350. $this->errors = $initErrors;
  42351. }
  42352. }
  42353. if (isset($schema->not)) {
  42354. $initErrors = $this->getErrors();
  42355. $this->checkUndefined($value, $schema->not, $path, $i);
  42356. if (count($this->getErrors()) == count($initErrors)) {
  42357. $this->addError($path, "Matched a schema which it should not", 'not');
  42358. } else {
  42359. $this->errors = $initErrors;
  42360. }
  42361. }
  42362. if (is_object($value) && isset($schema->dependencies)) {
  42363. $this->validateDependencies($value, $schema->dependencies, $path);
  42364. }
  42365. }
  42366. protected function validateOfProperties($value, $schema, $path, $i = "")
  42367. {
  42368. if ($value instanceof UndefinedConstraint) {
  42369. return;
  42370. }
  42371. if (isset($schema->allOf)) {
  42372. $isValid = true;
  42373. foreach ($schema->allOf as $allOf) {
  42374. $initErrors = $this->getErrors();
  42375. $this->checkUndefined($value, $allOf, $path, $i);
  42376. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  42377. }
  42378. if (!$isValid) {
  42379. $this->addError($path, "Failed to match all schemas", 'allOf');
  42380. }
  42381. }
  42382. if (isset($schema->anyOf)) {
  42383. $isValid = false;
  42384. $startErrors = $this->getErrors();
  42385. foreach ($schema->anyOf as $anyOf) {
  42386. $initErrors = $this->getErrors();
  42387. $this->checkUndefined($value, $anyOf, $path, $i);
  42388. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  42389. break;
  42390. }
  42391. }
  42392. if (!$isValid) {
  42393. $this->addError($path, "Failed to match at least one schema", 'anyOf');
  42394. } else {
  42395. $this->errors = $startErrors;
  42396. }
  42397. }
  42398. if (isset($schema->oneOf)) {
  42399. $allErrors = array();
  42400. $matchedSchemas = 0;
  42401. $startErrors = $this->getErrors();
  42402. foreach ($schema->oneOf as $oneOf) {
  42403. $this->errors = array();
  42404. $this->checkUndefined($value, $oneOf, $path, $i);
  42405. if (count($this->getErrors()) == 0) {
  42406. $matchedSchemas++;
  42407. }
  42408. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  42409. }
  42410. if ($matchedSchemas !== 1) {
  42411. $this->addErrors(
  42412. array_merge(
  42413. $allErrors,
  42414. array(array(
  42415. 'property' => $path,
  42416. 'message' => "Failed to match exactly one schema",
  42417. 'constraint' => 'oneOf',
  42418. ),),
  42419. $startErrors
  42420. )
  42421. );
  42422. } else {
  42423. $this->errors = $startErrors;
  42424. }
  42425. }
  42426. }
  42427. protected function validateDependencies($value, $dependencies, $path, $i = "")
  42428. {
  42429. foreach ($dependencies as $key => $dependency) {
  42430. if (property_exists($value, $key)) {
  42431. if (is_string($dependency)) {
  42432. if (!property_exists($value, $dependency)) {
  42433. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  42434. }
  42435. } else if (is_array($dependency)) {
  42436. foreach ($dependency as $d) {
  42437. if (!property_exists($value, $d)) {
  42438. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  42439. }
  42440. }
  42441. } else if (is_object($dependency)) {
  42442. $this->checkUndefined($value, $dependency, $path, $i);
  42443. }
  42444. }
  42445. }
  42446. }
  42447. protected function validateUri($schema, $schemaUri = null)
  42448. {
  42449. $resolver = new UriResolver();
  42450. $retriever = $this->getUriRetriever();
  42451. $jsonSchema = null;
  42452. if ($resolver->isValid($schemaUri)) {
  42453. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  42454. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  42455. }
  42456. return $jsonSchema;
  42457. }
  42458. }
  42459. <?php
  42460. namespace JsonSchema\Entity;
  42461. class JsonPointer
  42462. {
  42463. private $filename;
  42464. private $propertyPaths = array();
  42465. public function __construct($value)
  42466. {
  42467. if (!is_string($value)) {
  42468. throw new \InvalidArgumentException('Ref value must be a string');
  42469. }
  42470. $splitRef = explode('#', $value, 2);
  42471. $this->filename = $splitRef[0];
  42472. if (array_key_exists(1, $splitRef)) {
  42473. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  42474. }
  42475. }
  42476. private function decodePropertyPaths($propertyPathString)
  42477. {
  42478. $paths = array();
  42479. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  42480. $path = $this->decodePath($path);
  42481. if (is_string($path) && '' !== $path) {
  42482. $paths[] = $path;
  42483. }
  42484. }
  42485. return $paths;
  42486. }
  42487. private function encodePropertyPaths()
  42488. {
  42489. return array_map(
  42490. array($this, 'encodePath'),
  42491. $this->getPropertyPaths()
  42492. );
  42493. }
  42494. private function decodePath($path)
  42495. {
  42496. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  42497. }
  42498. private function encodePath($path)
  42499. {
  42500. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  42501. }
  42502. public function getFilename()
  42503. {
  42504. return $this->filename;
  42505. }
  42506. public function getPropertyPaths()
  42507. {
  42508. return $this->propertyPaths;
  42509. }
  42510. public function getPropertyPathAsString()
  42511. {
  42512. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  42513. }
  42514. public function __toString()
  42515. {
  42516. return $this->getFilename() . $this->getPropertyPathAsString();
  42517. }
  42518. }
  42519. <?php
  42520. namespace JsonSchema\Exception;
  42521. class InvalidArgumentException extends \InvalidArgumentException
  42522. {
  42523. }<?php
  42524. namespace JsonSchema\Exception;
  42525. class InvalidSchemaMediaTypeException extends \RuntimeException
  42526. {
  42527. }<?php
  42528. namespace JsonSchema\Exception;
  42529. class InvalidSourceUriException extends InvalidArgumentException
  42530. {
  42531. }
  42532. <?php
  42533. namespace JsonSchema\Exception;
  42534. class JsonDecodingException extends \RuntimeException
  42535. {
  42536. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  42537. {
  42538. switch ($code) {
  42539. case JSON_ERROR_DEPTH:
  42540. $message = 'The maximum stack depth has been exceeded';
  42541. break;
  42542. case JSON_ERROR_STATE_MISMATCH:
  42543. $message = 'Invalid or malformed JSON';
  42544. break;
  42545. case JSON_ERROR_CTRL_CHAR:
  42546. $message = 'Control character error, possibly incorrectly encoded';
  42547. break;
  42548. case JSON_ERROR_UTF8:
  42549. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  42550. break;
  42551. case JSON_ERROR_SYNTAX:
  42552. $message = 'JSON syntax is malformed';
  42553. break;
  42554. default:
  42555. $message = 'Syntax error';
  42556. }
  42557. parent::__construct($message, $code, $previous);
  42558. }
  42559. }<?php
  42560. namespace JsonSchema\Exception;
  42561. class ResourceNotFoundException extends \RuntimeException
  42562. {
  42563. }<?php
  42564. namespace JsonSchema\Exception;
  42565. class UnresolvableJsonPointerException extends \InvalidArgumentException
  42566. {
  42567. }
  42568. <?php
  42569. namespace JsonSchema\Exception;
  42570. class UriResolverException extends \RuntimeException
  42571. {
  42572. }<?php
  42573. namespace JsonSchema\Iterator;
  42574. class ObjectIterator implements \Iterator, \Countable
  42575. {
  42576. private $object;
  42577. private $position = 0;
  42578. private $data = array();
  42579. private $initialized = false;
  42580. public function __construct($object)
  42581. {
  42582. $this->object = $object;
  42583. }
  42584. public function current()
  42585. {
  42586. $this->initialize();
  42587. return $this->data[$this->position];
  42588. }
  42589. public function next()
  42590. {
  42591. $this->initialize();
  42592. $this->position++;
  42593. }
  42594. public function key()
  42595. {
  42596. $this->initialize();
  42597. return $this->position;
  42598. }
  42599. public function valid()
  42600. {
  42601. $this->initialize();
  42602. return isset($this->data[$this->position]);
  42603. }
  42604. public function rewind()
  42605. {
  42606. $this->initialize();
  42607. $this->position = 0;
  42608. }
  42609. public function count()
  42610. {
  42611. $this->initialize();
  42612. return count($this->data);
  42613. }
  42614. private function initialize()
  42615. {
  42616. if (!$this->initialized) {
  42617. $this->data = $this->buildDataFromObject($this->object);
  42618. $this->initialized = true;
  42619. }
  42620. }
  42621. private function buildDataFromObject($object)
  42622. {
  42623. $result = array();
  42624. $stack = new \SplStack();
  42625. $stack->push($object);
  42626. while (!$stack->isEmpty()) {
  42627. $current = $stack->pop();
  42628. if (is_object($current)) {
  42629. array_push($result, $current);
  42630. }
  42631. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  42632. if (is_object($propertyValue) || is_array($propertyValue)) {
  42633. $stack->push($propertyValue);
  42634. }
  42635. }
  42636. }
  42637. return $result;
  42638. }
  42639. private function getDataFromItem($item)
  42640. {
  42641. if (!is_object($item) && !is_array($item)) {
  42642. return array();
  42643. }
  42644. return is_object($item) ? get_object_vars($item) : $item;
  42645. }
  42646. }
  42647. <?php
  42648. namespace JsonSchema;
  42649. use JsonSchema\Exception\UnresolvableJsonPointerException;
  42650. use JsonSchema\Iterator\ObjectIterator;
  42651. use JsonSchema\Entity\JsonPointer;
  42652. class RefResolver
  42653. {
  42654. private $uriRetriever;
  42655. private $uriResolver;
  42656. public function __construct(UriRetrieverInterface $retriever, UriResolverInterface $uriResolver)
  42657. {
  42658. $this->uriRetriever = $retriever;
  42659. $this->uriResolver = $uriResolver;
  42660. }
  42661. public function resolve($sourceUri)
  42662. {
  42663. return $this->resolveCached($sourceUri, array());
  42664. }
  42665. private function resolveCached($sourceUri, array $paths)
  42666. {
  42667. $jsonPointer = new JsonPointer($sourceUri);
  42668. $fileName = $jsonPointer->getFilename();
  42669. if (!array_key_exists($fileName, $paths)) {
  42670. $schema = $this->uriRetriever->retrieve($jsonPointer->getFilename());
  42671. $paths[$jsonPointer->getFilename()] = $schema;
  42672. $this->resolveSchemas($schema, $jsonPointer->getFilename(), $paths);
  42673. }
  42674. $schema = $paths[$fileName];
  42675. return $this->getRefSchema($jsonPointer, $schema);
  42676. }
  42677. private function resolveSchemas($unresolvedSchema, $fileName, array $paths)
  42678. {
  42679. $objectIterator = new ObjectIterator($unresolvedSchema);
  42680. foreach ($objectIterator as $toResolveSchema) {
  42681. if (property_exists($toResolveSchema, '$ref') && is_string($toResolveSchema->{'$ref'})) {
  42682. $jsonPointer = new JsonPointer($this->uriResolver->resolve($toResolveSchema->{'$ref'}, $fileName));
  42683. $refSchema = $this->resolveCached((string) $jsonPointer, $paths);
  42684. $this->unionSchemas($refSchema, $toResolveSchema, $fileName, $paths);
  42685. }
  42686. }
  42687. }
  42688. private function getRefSchema(JsonPointer $jsonPointer, $refSchema)
  42689. {
  42690. foreach ($jsonPointer->getPropertyPaths() as $path) {
  42691. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  42692. $refSchema = $refSchema->{$path};
  42693. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  42694. $refSchema = $refSchema[$path];
  42695. } else {
  42696. throw new UnresolvableJsonPointerException(sprintf(
  42697. 'File: %s is found, but could not resolve fragment: %s',
  42698. $jsonPointer->getFilename(),
  42699. $jsonPointer->getPropertyPathAsString()
  42700. ));
  42701. }
  42702. }
  42703. return $refSchema;
  42704. }
  42705. private function unionSchemas($refSchema, $schema, $fileName, array $paths)
  42706. {
  42707. if (property_exists($refSchema, '$ref')) {
  42708. $jsonPointer = new JsonPointer($this->uriResolver->resolve($refSchema->{'$ref'}, $fileName));
  42709. $newSchema = $this->resolveCached((string) $jsonPointer, $paths);
  42710. $this->unionSchemas($newSchema, $refSchema, $fileName, $paths);
  42711. }
  42712. unset($schema->{'$ref'});
  42713. if (!$this->hasSubSchemas($schema)) {
  42714. foreach (get_object_vars($refSchema) as $prop => $value) {
  42715. $schema->$prop = $value;
  42716. }
  42717. } else {
  42718. $newSchema = new \stdClass();
  42719. foreach (get_object_vars($schema) as $prop => $value) {
  42720. $newSchema->$prop = $value;
  42721. unset($schema->$prop);
  42722. }
  42723. $schema->allOf = array($newSchema, $refSchema);
  42724. }
  42725. }
  42726. private function hasSubSchemas($schema)
  42727. {
  42728. foreach (array_keys(get_object_vars($schema)) as $propertyName) {
  42729. if (in_array($propertyName, $this->getReservedKeysWhichAreInFactSubSchemas())) {
  42730. return true;
  42731. }
  42732. }
  42733. return false;
  42734. }
  42735. private function getReservedKeysWhichAreInFactSubSchemas()
  42736. {
  42737. return array(
  42738. 'additionalItems',
  42739. 'additionalProperties',
  42740. 'extends',
  42741. 'items',
  42742. 'disallow',
  42743. 'extends',
  42744. 'items',
  42745. 'type',
  42746. 'allOf',
  42747. 'anyOf',
  42748. 'oneOf',
  42749. 'dependencies',
  42750. 'patternProperties',
  42751. 'properties'
  42752. );
  42753. }
  42754. }
  42755. <?php
  42756. namespace JsonSchema;
  42757. class Rfc3339
  42758. {
  42759. const REGEX = '/(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))/';
  42760. public static function createFromString($string)
  42761. {
  42762. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  42763. return null;
  42764. }
  42765. $dateAndTime = $matches[1];
  42766. $microseconds = $matches[2] ?: '.000000';
  42767. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  42768. $dateTime = \DateTime::createFromFormat('Y-m-d\TH:i:s.uP', $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  42769. return $dateTime ?: null;
  42770. }
  42771. }
  42772. <?php
  42773. namespace JsonSchema\Uri\Retrievers;
  42774. abstract class AbstractRetriever implements UriRetrieverInterface
  42775. {
  42776. protected $contentType;
  42777. public function getContentType()
  42778. {
  42779. return $this->contentType;
  42780. }
  42781. }
  42782. <?php
  42783. namespace JsonSchema\Uri\Retrievers;
  42784. use JsonSchema\Validator;
  42785. class Curl extends AbstractRetriever
  42786. {
  42787. protected $messageBody;
  42788. public function __construct()
  42789. {
  42790. if (!function_exists('curl_init')) {
  42791. throw new \RuntimeException("cURL not installed");
  42792. }
  42793. }
  42794. public function retrieve($uri)
  42795. {
  42796. $ch = curl_init();
  42797. curl_setopt($ch, CURLOPT_URL, $uri);
  42798. curl_setopt($ch, CURLOPT_HEADER, true);
  42799. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  42800. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  42801. $response = curl_exec($ch);
  42802. if (false === $response) {
  42803. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  42804. }
  42805. $this->fetchMessageBody($response);
  42806. $this->fetchContentType($response);
  42807. curl_close($ch);
  42808. return $this->messageBody;
  42809. }
  42810. private function fetchMessageBody($response)
  42811. {
  42812. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  42813. $this->messageBody = $match[1];
  42814. }
  42815. protected function fetchContentType($response)
  42816. {
  42817. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  42818. $this->contentType = trim($match[1]);
  42819. return true;
  42820. }
  42821. return false;
  42822. }
  42823. }<?php
  42824. namespace JsonSchema\Uri\Retrievers;
  42825. use JsonSchema\Exception\ResourceNotFoundException;
  42826. use JsonSchema\Validator;
  42827. class FileGetContents extends AbstractRetriever
  42828. {
  42829. protected $messageBody;
  42830. public function retrieve($uri)
  42831. {
  42832. $errorMessage = null;
  42833. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  42834. $errorMessage = $errstr;
  42835. });
  42836. $response = file_get_contents($uri);
  42837. restore_error_handler();
  42838. if ($errorMessage) {
  42839. throw new ResourceNotFoundException($errorMessage);
  42840. }
  42841. if (false === $response) {
  42842. throw new ResourceNotFoundException('JSON schema not found at '.$uri);
  42843. }
  42844. if ($response == ''
  42845. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  42846. ) {
  42847. throw new ResourceNotFoundException('JSON schema not found at '.$uri);
  42848. }
  42849. $this->messageBody = $response;
  42850. if (!empty($http_response_header)) {
  42851. $this->fetchContentType($http_response_header);
  42852. } else {
  42853. $this->contentType = null;
  42854. }
  42855. return $this->messageBody;
  42856. }
  42857. private function fetchContentType(array $headers)
  42858. {
  42859. foreach ($headers as $header) {
  42860. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  42861. return true;
  42862. }
  42863. }
  42864. return false;
  42865. }
  42866. protected static function getContentTypeMatchInHeader($header)
  42867. {
  42868. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  42869. return trim($match[1]);
  42870. }
  42871. }
  42872. }
  42873. <?php
  42874. namespace JsonSchema\Uri\Retrievers;
  42875. use JsonSchema\Validator;
  42876. class PredefinedArray extends AbstractRetriever
  42877. {
  42878. private $schemas;
  42879. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  42880. {
  42881. $this->schemas = $schemas;
  42882. $this->contentType = $contentType;
  42883. }
  42884. public function retrieve($uri)
  42885. {
  42886. if (!array_key_exists($uri, $this->schemas)) {
  42887. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  42888. 'The JSON schema "%s" was not found.',
  42889. $uri
  42890. ));
  42891. }
  42892. return $this->schemas[$uri];
  42893. }
  42894. }
  42895. <?php
  42896. namespace JsonSchema\Uri\Retrievers;
  42897. interface UriRetrieverInterface
  42898. {
  42899. public function retrieve($uri);
  42900. public function getContentType();
  42901. }<?php
  42902. namespace JsonSchema\Uri;
  42903. use JsonSchema\Exception\UriResolverException;
  42904. use JsonSchema\UriResolverInterface;
  42905. class UriResolver implements UriResolverInterface
  42906. {
  42907. public function parse($uri)
  42908. {
  42909. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  42910. $components = array();
  42911. if (5 < count($match)) {
  42912. $components = array(
  42913. 'scheme' => $match[2],
  42914. 'authority' => $match[4],
  42915. 'path' => $match[5]
  42916. );
  42917. }
  42918. if (7 < count($match)) {
  42919. $components['query'] = $match[7];
  42920. }
  42921. if (9 < count($match)) {
  42922. $components['fragment'] = $match[9];
  42923. }
  42924. return $components;
  42925. }
  42926. public function generate(array $components)
  42927. {
  42928. $uri = $components['scheme'] . '://'
  42929. . $components['authority']
  42930. . $components['path'];
  42931. if (array_key_exists('query', $components)) {
  42932. $uri .= $components['query'];
  42933. }
  42934. if (array_key_exists('fragment', $components)) {
  42935. $uri .= '#' . $components['fragment'];
  42936. }
  42937. return $uri;
  42938. }
  42939. public function resolve($uri, $baseUri = null)
  42940. {
  42941. if ($uri == '') {
  42942. return $baseUri;
  42943. }
  42944. $components = $this->parse($uri);
  42945. $path = $components['path'];
  42946. if (! empty($components['scheme'])) {
  42947. return $uri;
  42948. }
  42949. $baseComponents = $this->parse($baseUri);
  42950. $basePath = $baseComponents['path'];
  42951. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  42952. if (isset($components['fragment'])) {
  42953. $baseComponents['fragment'] = $components['fragment'];
  42954. }
  42955. return $this->generate($baseComponents);
  42956. }
  42957. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  42958. {
  42959. $relativePath = self::normalizePath($relativePath);
  42960. if ($relativePath == '') {
  42961. return $basePath;
  42962. }
  42963. if ($relativePath{0} == '/') {
  42964. return $relativePath;
  42965. }
  42966. $basePathSegments = explode('/', $basePath);
  42967. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  42968. $numLevelUp = strlen($match[0]) /3 + 1;
  42969. if ($numLevelUp >= count($basePathSegments)) {
  42970. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  42971. }
  42972. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  42973. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  42974. return implode('/', $basePathSegments) . '/' . $path;
  42975. }
  42976. private static function normalizePath($path)
  42977. {
  42978. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  42979. $path = preg_replace('|//|', '/', $path);
  42980. return $path;
  42981. }
  42982. public function isValid($uri)
  42983. {
  42984. $components = $this->parse($uri);
  42985. return !empty($components);
  42986. }
  42987. }
  42988. <?php
  42989. namespace JsonSchema\Uri;
  42990. use JsonSchema\Uri\Retrievers\FileGetContents;
  42991. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  42992. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  42993. use JsonSchema\Validator;
  42994. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  42995. use JsonSchema\Exception\JsonDecodingException;
  42996. use JsonSchema\Exception\ResourceNotFoundException;
  42997. class UriRetriever implements BaseUriRetrieverInterface
  42998. {
  42999. protected $uriRetriever = null;
  43000. private $schemaCache = array();
  43001. public function confirmMediaType($uriRetriever, $uri)
  43002. {
  43003. $contentType = $uriRetriever->getContentType();
  43004. if (is_null($contentType)) {
  43005. return;
  43006. }
  43007. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  43008. return;
  43009. }
  43010. if (substr($uri, 0, 23) == 'http://json-schema.org/') {
  43011. return true;
  43012. }
  43013. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  43014. }
  43015. public function getUriRetriever()
  43016. {
  43017. if (is_null($this->uriRetriever)) {
  43018. $this->setUriRetriever(new FileGetContents);
  43019. }
  43020. return $this->uriRetriever;
  43021. }
  43022. public function resolvePointer($jsonSchema, $uri)
  43023. {
  43024. $resolver = new UriResolver();
  43025. $parsed = $resolver->parse($uri);
  43026. if (empty($parsed['fragment'])) {
  43027. return $jsonSchema;
  43028. }
  43029. $path = explode('/', $parsed['fragment']);
  43030. while ($path) {
  43031. $pathElement = array_shift($path);
  43032. if (! empty($pathElement)) {
  43033. $pathElement = str_replace('~1', '/', $pathElement);
  43034. $pathElement = str_replace('~0', '~', $pathElement);
  43035. if (! empty($jsonSchema->$pathElement)) {
  43036. $jsonSchema = $jsonSchema->$pathElement;
  43037. } else {
  43038. throw new ResourceNotFoundException(
  43039. 'Fragment "' . $parsed['fragment'] . '" not found'
  43040. . ' in ' . $uri
  43041. );
  43042. }
  43043. if (! is_object($jsonSchema)) {
  43044. throw new ResourceNotFoundException(
  43045. 'Fragment part "' . $pathElement . '" is no object '
  43046. . ' in ' . $uri
  43047. );
  43048. }
  43049. }
  43050. }
  43051. return $jsonSchema;
  43052. }
  43053. public function retrieve($uri, $baseUri = null)
  43054. {
  43055. $resolver = new UriResolver();
  43056. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  43057. $arParts = $resolver->parse($resolvedUri);
  43058. if (isset($arParts['fragment'])) {
  43059. unset($arParts['fragment']);
  43060. $fetchUri = $resolver->generate($arParts);
  43061. }
  43062. $jsonSchema = $this->loadSchema($fetchUri);
  43063. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  43064. if ($jsonSchema instanceof \stdClass) {
  43065. $jsonSchema->id = $resolvedUri;
  43066. }
  43067. return $jsonSchema;
  43068. }
  43069. protected function loadSchema($fetchUri)
  43070. {
  43071. if (isset($this->schemaCache[$fetchUri])) {
  43072. return $this->schemaCache[$fetchUri];
  43073. }
  43074. $uriRetriever = $this->getUriRetriever();
  43075. $contents = $this->uriRetriever->retrieve($fetchUri);
  43076. $this->confirmMediaType($uriRetriever, $fetchUri);
  43077. $jsonSchema = json_decode($contents);
  43078. if (JSON_ERROR_NONE < $error = json_last_error()) {
  43079. throw new JsonDecodingException($error);
  43080. }
  43081. $this->schemaCache[$fetchUri] = $jsonSchema;
  43082. return $jsonSchema;
  43083. }
  43084. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  43085. {
  43086. $this->uriRetriever = $uriRetriever;
  43087. return $this;
  43088. }
  43089. public function parse($uri)
  43090. {
  43091. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  43092. $components = array();
  43093. if (5 < count($match)) {
  43094. $components = array(
  43095. 'scheme' => $match[2],
  43096. 'authority' => $match[4],
  43097. 'path' => $match[5]
  43098. );
  43099. }
  43100. if (7 < count($match)) {
  43101. $components['query'] = $match[7];
  43102. }
  43103. if (9 < count($match)) {
  43104. $components['fragment'] = $match[9];
  43105. }
  43106. return $components;
  43107. }
  43108. public function generate(array $components)
  43109. {
  43110. $uri = $components['scheme'] . '://'
  43111. . $components['authority']
  43112. . $components['path'];
  43113. if (array_key_exists('query', $components)) {
  43114. $uri .= $components['query'];
  43115. }
  43116. if (array_key_exists('fragment', $components)) {
  43117. $uri .= $components['fragment'];
  43118. }
  43119. return $uri;
  43120. }
  43121. public function resolve($uri, $baseUri = null)
  43122. {
  43123. $components = $this->parse($uri);
  43124. $path = $components['path'];
  43125. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  43126. return $uri;
  43127. }
  43128. $baseComponents = $this->parse($baseUri);
  43129. $basePath = $baseComponents['path'];
  43130. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  43131. return $this->generate($baseComponents);
  43132. }
  43133. public function isValid($uri)
  43134. {
  43135. $components = $this->parse($uri);
  43136. return !empty($components);
  43137. }
  43138. }
  43139. <?php
  43140. namespace JsonSchema;
  43141. interface UriResolverInterface
  43142. {
  43143. public function resolve($uri, $baseUri = null);
  43144. }
  43145. <?php
  43146. namespace JsonSchema;
  43147. interface UriRetrieverInterface
  43148. {
  43149. public function retrieve($uri, $baseUri = null);
  43150. }
  43151. <?php
  43152. namespace JsonSchema;
  43153. use JsonSchema\Constraints\SchemaConstraint;
  43154. use JsonSchema\Constraints\Constraint;
  43155. class Validator extends Constraint
  43156. {
  43157. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  43158. public function check($value, $schema = null, $path = null, $i = null)
  43159. {
  43160. $validator = $this->getFactory()->createInstanceFor('schema');
  43161. $validator->check($value, $schema);
  43162. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  43163. }
  43164. }
  43165. Copyright (C) 2015 Composer
  43166. Permission is hereby granted, free of charge, to any person obtaining a copy of
  43167. this software and associated documentation files (the "Software"), to deal in
  43168. the Software without restriction, including without limitation the rights to
  43169. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  43170. of the Software, and to permit persons to whom the Software is furnished to do
  43171. so, subject to the following conditions:
  43172. The above copyright notice and this permission notice shall be included in all
  43173. copies or substantial portions of the Software.
  43174. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  43175. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  43176. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  43177. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  43178. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  43179. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  43180. SOFTWARE.
  43181. <?php
  43182. namespace Composer\Spdx;
  43183. class SpdxLicenses
  43184. {
  43185. const LICENSES_FILE = 'spdx-licenses.json';
  43186. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  43187. private $licenses;
  43188. private $licensesExpression;
  43189. private $exceptions;
  43190. private $exceptionsExpression;
  43191. public function __construct()
  43192. {
  43193. $this->loadLicenses();
  43194. $this->loadExceptions();
  43195. }
  43196. public function getLicenseByIdentifier($identifier)
  43197. {
  43198. if (!isset($this->licenses[$identifier])) {
  43199. return;
  43200. }
  43201. $license = $this->licenses[$identifier];
  43202. $license[] = 'https://spdx.org/licenses/' . $identifier . '.html#licenseText';
  43203. return $license;
  43204. }
  43205. public function getExceptionByIdentifier($identifier)
  43206. {
  43207. if (!isset($this->exceptions[$identifier])) {
  43208. return;
  43209. }
  43210. $license = $this->exceptions[$identifier];
  43211. $license[] = 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText';
  43212. return $license;
  43213. }
  43214. public function getIdentifierByName($name)
  43215. {
  43216. foreach ($this->licenses as $identifier => $licenseData) {
  43217. if ($licenseData[0] === $name) {
  43218. return $identifier;
  43219. }
  43220. }
  43221. foreach ($this->exceptions as $identifier => $licenseData) {
  43222. if ($licenseData[0] === $name) {
  43223. return $identifier;
  43224. }
  43225. }
  43226. }
  43227. public function isOsiApprovedByIdentifier($identifier)
  43228. {
  43229. return $this->licenses[$identifier][1];
  43230. }
  43231. public function validate($license)
  43232. {
  43233. if (is_array($license)) {
  43234. $count = count($license);
  43235. if ($count !== count(array_filter($license, 'is_string'))) {
  43236. throw new \InvalidArgumentException('Array of strings expected.');
  43237. }
  43238. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  43239. }
  43240. if (!is_string($license)) {
  43241. throw new \InvalidArgumentException(sprintf(
  43242. 'Array or String expected, %s given.',
  43243. gettype($license)
  43244. ));
  43245. }
  43246. return $this->isValidLicenseString($license);
  43247. }
  43248. public static function getResourcesDir()
  43249. {
  43250. return dirname(__DIR__) . '/res';
  43251. }
  43252. private function loadLicenses()
  43253. {
  43254. if (null === $this->licenses) {
  43255. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  43256. $this->licenses = json_decode($json, true);
  43257. }
  43258. }
  43259. private function loadExceptions()
  43260. {
  43261. if (null === $this->exceptions) {
  43262. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  43263. $this->exceptions = json_decode($json, true);
  43264. }
  43265. }
  43266. private function getLicensesExpression()
  43267. {
  43268. if (null === $this->licensesExpression) {
  43269. $licenses = array_map('preg_quote', array_keys($this->licenses));
  43270. rsort($licenses);
  43271. $licenses = implode('|', $licenses);
  43272. $this->licensesExpression = $licenses;
  43273. }
  43274. return $this->licensesExpression;
  43275. }
  43276. private function getExceptionsExpression()
  43277. {
  43278. if (null === $this->exceptionsExpression) {
  43279. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  43280. rsort($exceptions);
  43281. $exceptions = implode('|', $exceptions);
  43282. $this->exceptionsExpression = $exceptions;
  43283. }
  43284. return $this->exceptionsExpression;
  43285. }
  43286. private function isValidLicenseString($license)
  43287. {
  43288. if (isset($this->licenses[$license])) {
  43289. return true;
  43290. }
  43291. $licenses = $this->getLicensesExpression();
  43292. $exceptions = $this->getExceptionsExpression();
  43293. $regex = <<<REGEX
  43294. {
  43295. (?(DEFINE)
  43296. # idstring: 1*( ALPHA / DIGIT / - / . )
  43297. (?<idstring>[\pL\pN.-]{1,})
  43298. # license-id: taken from list
  43299. (?<licenseid>${licenses})
  43300. # license-exception-id: taken from list
  43301. (?<licenseexceptionid>${exceptions})
  43302. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  43303. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  43304. # simple-expresssion: license-id / license-id+ / license-ref
  43305. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  43306. # compound-expression: 1*(
  43307. # simple-expression /
  43308. # simple-expression WITH license-exception-id /
  43309. # compound-expression AND compound-expression /
  43310. # compound-expression OR compound-expression
  43311. # ) / ( compound-expression ) )
  43312. (?<compound_head>
  43313. (?&simple_expression) ( \s+ (?:with|WITH) \s+ (?&licenseexceptionid))?
  43314. | \( \s* (?&compound_expression) \s* \)
  43315. )
  43316. (?<compound_expression>
  43317. (?&compound_head) (?: \s+ (?:and|AND|or|OR) \s+ (?&compound_expression))?
  43318. )
  43319. # license-expression: 1*1(simple-expression / compound-expression)
  43320. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  43321. ) # end of define
  43322. ^(NONE | NOASSERTION | (?&license_expression))$
  43323. }x
  43324. REGEX;
  43325. $match = preg_match($regex, $license);
  43326. if (0 === $match) {
  43327. return false;
  43328. }
  43329. if (false === $match) {
  43330. throw new \RuntimeException('Regex failed to compile/run.');
  43331. }
  43332. return true;
  43333. }
  43334. }
  43335. Copyright (C) 2015 Composer
  43336. Permission is hereby granted, free of charge, to any person obtaining a copy of
  43337. this software and associated documentation files (the "Software"), to deal in
  43338. the Software without restriction, including without limitation the rights to
  43339. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  43340. of the Software, and to permit persons to whom the Software is furnished to do
  43341. so, subject to the following conditions:
  43342. The above copyright notice and this permission notice shall be included in all
  43343. copies or substantial portions of the Software.
  43344. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  43345. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  43346. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  43347. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  43348. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  43349. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  43350. SOFTWARE.
  43351. <?php
  43352. namespace Composer\Semver;
  43353. use Composer\Semver\Constraint\Constraint;
  43354. class Comparator
  43355. {
  43356. public static function greaterThan($version1, $version2)
  43357. {
  43358. return self::compare($version1, '>', $version2);
  43359. }
  43360. public static function greaterThanOrEqualTo($version1, $version2)
  43361. {
  43362. return self::compare($version1, '>=', $version2);
  43363. }
  43364. public static function lessThan($version1, $version2)
  43365. {
  43366. return self::compare($version1, '<', $version2);
  43367. }
  43368. public static function lessThanOrEqualTo($version1, $version2)
  43369. {
  43370. return self::compare($version1, '<=', $version2);
  43371. }
  43372. public static function equalTo($version1, $version2)
  43373. {
  43374. return self::compare($version1, '==', $version2);
  43375. }
  43376. public static function notEqualTo($version1, $version2)
  43377. {
  43378. return self::compare($version1, '!=', $version2);
  43379. }
  43380. public static function compare($version1, $operator, $version2)
  43381. {
  43382. $constraint = new Constraint($operator, $version2);
  43383. return $constraint->matches(new Constraint('==', $version1));
  43384. }
  43385. }
  43386. <?php
  43387. namespace Composer\Semver\Constraint;
  43388. trigger_error('The ' . __CLASS__ . ' abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED);
  43389. abstract class AbstractConstraint implements ConstraintInterface
  43390. {
  43391. protected $prettyString;
  43392. public function matches(ConstraintInterface $provider)
  43393. {
  43394. if ($provider instanceof $this) {
  43395. return $this->matchSpecific($provider);
  43396. }
  43397. return $provider->matches($this);
  43398. }
  43399. public function setPrettyString($prettyString)
  43400. {
  43401. $this->prettyString = $prettyString;
  43402. }
  43403. public function getPrettyString()
  43404. {
  43405. if ($this->prettyString) {
  43406. return $this->prettyString;
  43407. }
  43408. return $this->__toString();
  43409. }
  43410. }
  43411. <?php
  43412. namespace Composer\Semver\Constraint;
  43413. class Constraint implements ConstraintInterface
  43414. {
  43415. const OP_EQ = 0;
  43416. const OP_LT = 1;
  43417. const OP_LE = 2;
  43418. const OP_GT = 3;
  43419. const OP_GE = 4;
  43420. const OP_NE = 5;
  43421. private static $transOpStr = array(
  43422. '=' => self::OP_EQ,
  43423. '==' => self::OP_EQ,
  43424. '<' => self::OP_LT,
  43425. '<=' => self::OP_LE,
  43426. '>' => self::OP_GT,
  43427. '>=' => self::OP_GE,
  43428. '<>' => self::OP_NE,
  43429. '!=' => self::OP_NE,
  43430. );
  43431. private static $transOpInt = array(
  43432. self::OP_EQ => '==',
  43433. self::OP_LT => '<',
  43434. self::OP_LE => '<=',
  43435. self::OP_GT => '>',
  43436. self::OP_GE => '>=',
  43437. self::OP_NE => '!=',
  43438. );
  43439. protected $operator;
  43440. protected $version;
  43441. protected $prettyString;
  43442. public function matches(ConstraintInterface $provider)
  43443. {
  43444. if ($provider instanceof $this) {
  43445. return $this->matchSpecific($provider);
  43446. }
  43447. return $provider->matches($this);
  43448. }
  43449. public function setPrettyString($prettyString)
  43450. {
  43451. $this->prettyString = $prettyString;
  43452. }
  43453. public function getPrettyString()
  43454. {
  43455. if ($this->prettyString) {
  43456. return $this->prettyString;
  43457. }
  43458. return $this->__toString();
  43459. }
  43460. public static function getSupportedOperators()
  43461. {
  43462. return array_keys(self::$transOpStr);
  43463. }
  43464. public function __construct($operator, $version)
  43465. {
  43466. if (!isset(self::$transOpStr[$operator])) {
  43467. throw new \InvalidArgumentException(sprintf(
  43468. 'Invalid operator "%s" given, expected one of: %s',
  43469. $operator,
  43470. implode(', ', self::getSupportedOperators())
  43471. ));
  43472. }
  43473. $this->operator = self::$transOpStr[$operator];
  43474. $this->version = $version;
  43475. }
  43476. public function versionCompare($a, $b, $operator, $compareBranches = false)
  43477. {
  43478. if (!isset(self::$transOpStr[$operator])) {
  43479. throw new \InvalidArgumentException(sprintf(
  43480. 'Invalid operator "%s" given, expected one of: %s',
  43481. $operator,
  43482. implode(', ', self::getSupportedOperators())
  43483. ));
  43484. }
  43485. $aIsBranch = 'dev-' === substr($a, 0, 4);
  43486. $bIsBranch = 'dev-' === substr($b, 0, 4);
  43487. if ($aIsBranch && $bIsBranch) {
  43488. return $operator === '==' && $a === $b;
  43489. }
  43490. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  43491. return false;
  43492. }
  43493. return version_compare($a, $b, $operator);
  43494. }
  43495. public function matchSpecific(Constraint $provider, $compareBranches = false)
  43496. {
  43497. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  43498. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  43499. $isEqualOp = self::OP_EQ === $this->operator;
  43500. $isNonEqualOp = self::OP_NE === $this->operator;
  43501. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  43502. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  43503. if ($isNonEqualOp || $isProviderNonEqualOp) {
  43504. return !$isEqualOp && !$isProviderEqualOp
  43505. || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  43506. }
  43507. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  43508. return true;
  43509. }
  43510. if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
  43511. if ($provider->version === $this->version
  43512. && self::$transOpInt[$provider->operator] === $providerNoEqualOp
  43513. && self::$transOpInt[$this->operator] !== $noEqualOp) {
  43514. return false;
  43515. }
  43516. return true;
  43517. }
  43518. return false;
  43519. }
  43520. public function __toString()
  43521. {
  43522. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  43523. }
  43524. }
  43525. <?php
  43526. namespace Composer\Semver\Constraint;
  43527. interface ConstraintInterface
  43528. {
  43529. public function matches(ConstraintInterface $provider);
  43530. public function getPrettyString();
  43531. public function __toString();
  43532. }
  43533. <?php
  43534. namespace Composer\Semver\Constraint;
  43535. class EmptyConstraint implements ConstraintInterface
  43536. {
  43537. protected $prettyString;
  43538. public function matches(ConstraintInterface $provider)
  43539. {
  43540. return true;
  43541. }
  43542. public function setPrettyString($prettyString)
  43543. {
  43544. $this->prettyString = $prettyString;
  43545. }
  43546. public function getPrettyString()
  43547. {
  43548. if ($this->prettyString) {
  43549. return $this->prettyString;
  43550. }
  43551. return $this->__toString();
  43552. }
  43553. public function __toString()
  43554. {
  43555. return '[]';
  43556. }
  43557. }
  43558. <?php
  43559. namespace Composer\Semver\Constraint;
  43560. class MultiConstraint implements ConstraintInterface
  43561. {
  43562. protected $constraints;
  43563. protected $prettyString;
  43564. protected $conjunctive;
  43565. public function __construct(array $constraints, $conjunctive = true)
  43566. {
  43567. $this->constraints = $constraints;
  43568. $this->conjunctive = $conjunctive;
  43569. }
  43570. public function getConstraints()
  43571. {
  43572. return $this->constraints;
  43573. }
  43574. public function isConjunctive()
  43575. {
  43576. return $this->conjunctive;
  43577. }
  43578. public function isDisjunctive()
  43579. {
  43580. return !$this->conjunctive;
  43581. }
  43582. public function matches(ConstraintInterface $provider)
  43583. {
  43584. if (false === $this->conjunctive) {
  43585. foreach ($this->constraints as $constraint) {
  43586. if ($constraint->matches($provider)) {
  43587. return true;
  43588. }
  43589. }
  43590. return false;
  43591. }
  43592. foreach ($this->constraints as $constraint) {
  43593. if (!$constraint->matches($provider)) {
  43594. return false;
  43595. }
  43596. }
  43597. return true;
  43598. }
  43599. public function setPrettyString($prettyString)
  43600. {
  43601. $this->prettyString = $prettyString;
  43602. }
  43603. public function getPrettyString()
  43604. {
  43605. if ($this->prettyString) {
  43606. return $this->prettyString;
  43607. }
  43608. return $this->__toString();
  43609. }
  43610. public function __toString()
  43611. {
  43612. $constraints = array();
  43613. foreach ($this->constraints as $constraint) {
  43614. $constraints[] = (string) $constraint;
  43615. }
  43616. return '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  43617. }
  43618. }
  43619. <?php
  43620. namespace Composer\Semver;
  43621. use Composer\Semver\Constraint\Constraint;
  43622. class Semver
  43623. {
  43624. const SORT_ASC = 1;
  43625. const SORT_DESC = -1;
  43626. private static $versionParser;
  43627. public static function satisfies($version, $constraints)
  43628. {
  43629. if (null === self::$versionParser) {
  43630. self::$versionParser = new VersionParser();
  43631. }
  43632. $versionParser = self::$versionParser;
  43633. $provider = new Constraint('==', $versionParser->normalize($version));
  43634. $constraints = $versionParser->parseConstraints($constraints);
  43635. return $constraints->matches($provider);
  43636. }
  43637. public static function satisfiedBy(array $versions, $constraints)
  43638. {
  43639. $versions = array_filter($versions, function ($version) use ($constraints) {
  43640. return Semver::satisfies($version, $constraints);
  43641. });
  43642. return array_values($versions);
  43643. }
  43644. public static function sort(array $versions)
  43645. {
  43646. return self::usort($versions, self::SORT_ASC);
  43647. }
  43648. public static function rsort(array $versions)
  43649. {
  43650. return self::usort($versions, self::SORT_DESC);
  43651. }
  43652. private static function usort(array $versions, $direction)
  43653. {
  43654. if (null === self::$versionParser) {
  43655. self::$versionParser = new VersionParser();
  43656. }
  43657. $versionParser = self::$versionParser;
  43658. $normalized = array();
  43659. foreach ($versions as $key => $version) {
  43660. $normalized[] = array($versionParser->normalize($version), $key);
  43661. }
  43662. usort($normalized, function (array $left, array $right) use ($direction) {
  43663. if ($left[0] === $right[0]) {
  43664. return 0;
  43665. }
  43666. if (Comparator::lessThan($left[0], $right[0])) {
  43667. return -$direction;
  43668. }
  43669. return $direction;
  43670. });
  43671. $sorted = array();
  43672. foreach ($normalized as $item) {
  43673. $sorted[] = $versions[$item[1]];
  43674. }
  43675. return $sorted;
  43676. }
  43677. }
  43678. <?php
  43679. namespace Composer\Semver;
  43680. use Composer\Semver\Constraint\ConstraintInterface;
  43681. use Composer\Semver\Constraint\EmptyConstraint;
  43682. use Composer\Semver\Constraint\MultiConstraint;
  43683. use Composer\Semver\Constraint\Constraint;
  43684. class VersionParser
  43685. {
  43686. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  43687. private static $stabilities = array('stable', 'RC', 'beta', 'alpha', 'dev');
  43688. public static function parseStability($version)
  43689. {
  43690. $version = preg_replace('{#.+$}i', '', $version);
  43691. if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
  43692. return 'dev';
  43693. }
  43694. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  43695. if (!empty($match[3])) {
  43696. return 'dev';
  43697. }
  43698. if (!empty($match[1])) {
  43699. if ('beta' === $match[1] || 'b' === $match[1]) {
  43700. return 'beta';
  43701. }
  43702. if ('alpha' === $match[1] || 'a' === $match[1]) {
  43703. return 'alpha';
  43704. }
  43705. if ('rc' === $match[1]) {
  43706. return 'RC';
  43707. }
  43708. }
  43709. return 'stable';
  43710. }
  43711. public static function normalizeStability($stability)
  43712. {
  43713. $stability = strtolower($stability);
  43714. return $stability === 'rc' ? 'RC' : $stability;
  43715. }
  43716. public function normalize($version, $fullVersion = null)
  43717. {
  43718. $version = trim($version);
  43719. if (null === $fullVersion) {
  43720. $fullVersion = $version;
  43721. }
  43722. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  43723. $version = $match[1];
  43724. }
  43725. if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
  43726. return '9999999-dev';
  43727. }
  43728. if ('dev-' === strtolower(substr($version, 0, 4))) {
  43729. return 'dev-' . substr($version, 4);
  43730. }
  43731. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  43732. $version = $match[1];
  43733. }
  43734. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  43735. $version = $matches[1]
  43736. . (!empty($matches[2]) ? $matches[2] : '.0')
  43737. . (!empty($matches[3]) ? $matches[3] : '.0')
  43738. . (!empty($matches[4]) ? $matches[4] : '.0');
  43739. $index = 5;
  43740. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  43741. $version = preg_replace('{\D}', '.', $matches[1]);
  43742. $index = 2;
  43743. }
  43744. if (isset($index)) {
  43745. if (!empty($matches[$index])) {
  43746. if ('stable' === $matches[$index]) {
  43747. return $version;
  43748. }
  43749. $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? ltrim($matches[$index + 1], '.-') : '');
  43750. }
  43751. if (!empty($matches[$index + 2])) {
  43752. $version .= '-dev';
  43753. }
  43754. return $version;
  43755. }
  43756. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  43757. try {
  43758. return $this->normalizeBranch($match[1]);
  43759. } catch (\Exception $e) {
  43760. }
  43761. }
  43762. $extraMessage = '';
  43763. if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) {
  43764. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  43765. } elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) {
  43766. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  43767. }
  43768. throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage);
  43769. }
  43770. public function parseNumericAliasPrefix($branch)
  43771. {
  43772. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', $branch, $matches)) {
  43773. return $matches['version'] . '.';
  43774. }
  43775. return false;
  43776. }
  43777. public function normalizeBranch($name)
  43778. {
  43779. $name = trim($name);
  43780. if (in_array($name, array('master', 'trunk', 'default'))) {
  43781. return $this->normalize($name);
  43782. }
  43783. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  43784. $version = '';
  43785. for ($i = 1; $i < 5; ++$i) {
  43786. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  43787. }
  43788. return str_replace('x', '9999999', $version) . '-dev';
  43789. }
  43790. return 'dev-' . $name;
  43791. }
  43792. public function parseConstraints($constraints)
  43793. {
  43794. $prettyConstraint = $constraints;
  43795. if (preg_match('{^([^,\s]*?)@(' . implode('|', self::$stabilities) . ')$}i', $constraints, $match)) {
  43796. $constraints = empty($match[1]) ? '*' : $match[1];
  43797. }
  43798. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
  43799. $constraints = $match[1];
  43800. }
  43801. $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
  43802. $orGroups = array();
  43803. foreach ($orConstraints as $constraints) {
  43804. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  43805. if (count($andConstraints) > 1) {
  43806. $constraintObjects = array();
  43807. foreach ($andConstraints as $constraint) {
  43808. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  43809. $constraintObjects[] = $parsedConstraint;
  43810. }
  43811. }
  43812. } else {
  43813. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  43814. }
  43815. if (1 === count($constraintObjects)) {
  43816. $constraint = $constraintObjects[0];
  43817. } else {
  43818. $constraint = new MultiConstraint($constraintObjects);
  43819. }
  43820. $orGroups[] = $constraint;
  43821. }
  43822. if (1 === count($orGroups)) {
  43823. $constraint = $orGroups[0];
  43824. } elseif (2 === count($orGroups)
  43825. && $orGroups[0] instanceof MultiConstraint
  43826. && $orGroups[1] instanceof MultiConstraint
  43827. && 2 === count($orGroups[0]->getConstraints())
  43828. && 2 === count($orGroups[1]->getConstraints())
  43829. && ($a = (string) $orGroups[0])
  43830. && substr($a, 0, 3) === '[>=' && (false !== ($posA = strpos($a, '<', 4)))
  43831. && ($b = (string) $orGroups[1])
  43832. && substr($b, 0, 3) === '[>=' && (false !== ($posB = strpos($b, '<', 4)))
  43833. && substr($a, $posA + 2, -1) === substr($b, 4, $posB - 5)
  43834. ) {
  43835. $constraint = new MultiConstraint(array(
  43836. new Constraint('>=', substr($a, 4, $posA - 5)),
  43837. new Constraint('<', substr($b, $posB + 2, -1)),
  43838. ));
  43839. } else {
  43840. $constraint = new MultiConstraint($orGroups, false);
  43841. }
  43842. $constraint->setPrettyString($prettyConstraint);
  43843. return $constraint;
  43844. }
  43845. private function parseConstraint($constraint)
  43846. {
  43847. if (preg_match('{^([^,\s]+?)@(' . implode('|', self::$stabilities) . ')$}i', $constraint, $match)) {
  43848. $constraint = $match[1];
  43849. if ($match[2] !== 'stable') {
  43850. $stabilityModifier = $match[2];
  43851. }
  43852. }
  43853. if (preg_match('{^v?[xX*](\.[xX*])*$}i', $constraint)) {
  43854. return array(new EmptyConstraint());
  43855. }
  43856. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?' . self::$modifierRegex . '(?:\+[^\s]+)?';
  43857. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  43858. if (substr($constraint, 0, 2) === '~>') {
  43859. throw new \UnexpectedValueException(
  43860. 'Could not parse version constraint ' . $constraint . ': ' .
  43861. 'Invalid operator "~>", you probably meant to use the "~" operator'
  43862. );
  43863. }
  43864. if (isset($matches[4]) && '' !== $matches[4]) {
  43865. $position = 4;
  43866. } elseif (isset($matches[3]) && '' !== $matches[3]) {
  43867. $position = 3;
  43868. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  43869. $position = 2;
  43870. } else {
  43871. $position = 1;
  43872. }
  43873. $stabilitySuffix = '';
  43874. if (!empty($matches[5])) {
  43875. $stabilitySuffix .= '-' . $this->expandStability($matches[5]) . (!empty($matches[6]) ? $matches[6] : '');
  43876. }
  43877. if (!empty($matches[7])) {
  43878. $stabilitySuffix .= '-dev';
  43879. }
  43880. if (!$stabilitySuffix) {
  43881. $stabilitySuffix = '-dev';
  43882. }
  43883. $lowVersion = $this->manipulateVersionString($matches, $position, 0) . $stabilitySuffix;
  43884. $lowerBound = new Constraint('>=', $lowVersion);
  43885. $highPosition = max(1, $position - 1);
  43886. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  43887. $upperBound = new Constraint('<', $highVersion);
  43888. return array(
  43889. $lowerBound,
  43890. $upperBound,
  43891. );
  43892. }
  43893. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  43894. if ('0' !== $matches[1] || '' === $matches[2]) {
  43895. $position = 1;
  43896. } elseif ('0' !== $matches[2] || '' === $matches[3]) {
  43897. $position = 2;
  43898. } else {
  43899. $position = 3;
  43900. }
  43901. $stabilitySuffix = '';
  43902. if (empty($matches[5]) && empty($matches[7])) {
  43903. $stabilitySuffix .= '-dev';
  43904. }
  43905. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  43906. $lowerBound = new Constraint('>=', $lowVersion);
  43907. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  43908. $upperBound = new Constraint('<', $highVersion);
  43909. return array(
  43910. $lowerBound,
  43911. $upperBound,
  43912. );
  43913. }
  43914. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  43915. if (isset($matches[3]) && '' !== $matches[3]) {
  43916. $position = 3;
  43917. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  43918. $position = 2;
  43919. } else {
  43920. $position = 1;
  43921. }
  43922. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  43923. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  43924. if ($lowVersion === '0.0.0.0-dev') {
  43925. return array(new Constraint('<', $highVersion));
  43926. }
  43927. return array(
  43928. new Constraint('>=', $lowVersion),
  43929. new Constraint('<', $highVersion),
  43930. );
  43931. }
  43932. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  43933. $lowStabilitySuffix = '';
  43934. if (empty($matches[6]) && empty($matches[8])) {
  43935. $lowStabilitySuffix = '-dev';
  43936. }
  43937. $lowVersion = $this->normalize($matches['from']);
  43938. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  43939. $empty = function ($x) {
  43940. return ($x === 0 || $x === '0') ? false : empty($x);
  43941. };
  43942. if ((!$empty($matches[11]) && !$empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) {
  43943. $highVersion = $this->normalize($matches['to']);
  43944. $upperBound = new Constraint('<=', $highVersion);
  43945. } else {
  43946. $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]);
  43947. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev';
  43948. $upperBound = new Constraint('<', $highVersion);
  43949. }
  43950. return array(
  43951. $lowerBound,
  43952. $upperBound,
  43953. );
  43954. }
  43955. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  43956. try {
  43957. $version = $this->normalize($matches[2]);
  43958. if (!empty($stabilityModifier) && $this->parseStability($version) === 'stable') {
  43959. $version .= '-' . $stabilityModifier;
  43960. } elseif ('<' === $matches[1] || '>=' === $matches[1]) {
  43961. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  43962. if (substr($matches[2], 0, 4) !== 'dev-') {
  43963. $version .= '-dev';
  43964. }
  43965. }
  43966. }
  43967. return array(new Constraint($matches[1] ?: '=', $version));
  43968. } catch (\Exception $e) {
  43969. }
  43970. }
  43971. $message = 'Could not parse version constraint ' . $constraint;
  43972. if (isset($e)) {
  43973. $message .= ': ' . $e->getMessage();
  43974. }
  43975. throw new \UnexpectedValueException($message);
  43976. }
  43977. private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
  43978. {
  43979. for ($i = 4; $i > 0; --$i) {
  43980. if ($i > $position) {
  43981. $matches[$i] = $pad;
  43982. } elseif ($i === $position && $increment) {
  43983. $matches[$i] += $increment;
  43984. if ($matches[$i] < 0) {
  43985. $matches[$i] = $pad;
  43986. --$position;
  43987. if ($i === 1) {
  43988. return;
  43989. }
  43990. }
  43991. }
  43992. }
  43993. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  43994. }
  43995. private function expandStability($stability)
  43996. {
  43997. $stability = strtolower($stability);
  43998. switch ($stability) {
  43999. case 'a':
  44000. return 'alpha';
  44001. case 'b':
  44002. return 'beta';
  44003. case 'p':
  44004. case 'pl':
  44005. return 'patch';
  44006. case 'rc':
  44007. return 'RC';
  44008. default:
  44009. return $stability;
  44010. }
  44011. }
  44012. }
  44013. Copyright (C) 2016 Composer
  44014. Permission is hereby granted, free of charge, to any person obtaining a copy of
  44015. this software and associated documentation files (the "Software"), to deal in
  44016. the Software without restriction, including without limitation the rights to
  44017. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  44018. of the Software, and to permit persons to whom the Software is furnished to do
  44019. so, subject to the following conditions:
  44020. The above copyright notice and this permission notice shall be included in all
  44021. copies or substantial portions of the Software.
  44022. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44023. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44024. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44025. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44026. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44027. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  44028. SOFTWARE.
  44029. <?php
  44030. namespace Composer\CaBundle;
  44031. use Psr\Log\LoggerInterface;
  44032. use Symfony\Component\Process\PhpProcess;
  44033. class CaBundle
  44034. {
  44035. private static $caPath;
  44036. private static $caFileValidity = array();
  44037. private static $useOpensslParse;
  44038. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  44039. {
  44040. if (self::$caPath !== null) {
  44041. return self::$caPath;
  44042. }
  44043. $envCertFile = getenv('SSL_CERT_FILE');
  44044. if ($envCertFile && is_readable($envCertFile) && static::validateCaFile($envCertFile, $logger)) {
  44045. return self::$caPath = $envCertFile;
  44046. }
  44047. $envCertDir = getenv('SSL_CERT_DIR');
  44048. if ($envCertDir && is_dir($envCertDir) && is_readable($envCertDir)) {
  44049. return self::$caPath = $envCertDir;
  44050. }
  44051. $configured = ini_get('openssl.cafile');
  44052. if ($configured && strlen($configured) > 0 && is_readable($configured) && static::validateCaFile($configured, $logger)) {
  44053. return self::$caPath = $configured;
  44054. }
  44055. $configured = ini_get('openssl.capath');
  44056. if ($configured && is_dir($configured) && is_readable($configured)) {
  44057. return self::$caPath = $configured;
  44058. }
  44059. $caBundlePaths = array(
  44060. '/etc/pki/tls/certs/ca-bundle.crt',
  44061. '/etc/ssl/certs/ca-certificates.crt',
  44062. '/etc/ssl/ca-bundle.pem',
  44063. '/usr/local/share/certs/ca-root-nss.crt',
  44064. '/usr/ssl/certs/ca-bundle.crt',
  44065. '/opt/local/share/curl/curl-ca-bundle.crt',
  44066. '/usr/local/share/curl/curl-ca-bundle.crt',
  44067. '/usr/share/ssl/certs/ca-bundle.crt',
  44068. '/etc/ssl/cert.pem',
  44069. '/usr/local/etc/ssl/cert.pem',
  44070. '/usr/local/etc/openssl/cert.pem',
  44071. );
  44072. foreach ($caBundlePaths as $caBundle) {
  44073. if (@is_readable($caBundle) && static::validateCaFile($caBundle, $logger)) {
  44074. return self::$caPath = $caBundle;
  44075. }
  44076. }
  44077. foreach ($caBundlePaths as $caBundle) {
  44078. $caBundle = dirname($caBundle);
  44079. if (@is_dir($caBundle) && glob($caBundle.'/*')) {
  44080. return self::$caPath = $caBundle;
  44081. }
  44082. }
  44083. return self::$caPath = static::getBundledCaBundlePath();
  44084. }
  44085. public static function getBundledCaBundlePath()
  44086. {
  44087. return __DIR__.'/../res/cacert.pem';
  44088. }
  44089. public static function validateCaFile($filename, LoggerInterface $logger = null)
  44090. {
  44091. static $warned = false;
  44092. if (isset(self::$caFileValidity[$filename])) {
  44093. return self::$caFileValidity[$filename];
  44094. }
  44095. $contents = file_get_contents($filename);
  44096. if (!static::isOpensslParseSafe()) {
  44097. if (!$warned && $logger) {
  44098. $logger->warning(sprintf(
  44099. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  44100. PHP_VERSION
  44101. ));
  44102. $warned = true;
  44103. }
  44104. $isValid = !empty($contents);
  44105. } else {
  44106. $isValid = (bool) openssl_x509_parse($contents);
  44107. }
  44108. if ($logger) {
  44109. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  44110. }
  44111. return self::$caFileValidity[$filename] = $isValid;
  44112. }
  44113. public static function isOpensslParseSafe()
  44114. {
  44115. if (null !== self::$useOpensslParse) {
  44116. return self::$useOpensslParse;
  44117. }
  44118. if (PHP_VERSION_ID >= 50600) {
  44119. return self::$useOpensslParse = true;
  44120. }
  44121. if (
  44122. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  44123. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  44124. || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
  44125. ) {
  44126. return self::$useOpensslParse = true;
  44127. }
  44128. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  44129. return self::$useOpensslParse = false;
  44130. }
  44131. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  44132. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  44133. if (preg_match($regex, PHP_VERSION, $m)) {
  44134. return ((int) $m[1]) >= $fixedVersion;
  44135. }
  44136. return false;
  44137. };
  44138. if (
  44139. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  44140. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  44141. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  44142. ) {
  44143. return self::$useOpensslParse = true;
  44144. }
  44145. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  44146. return self::$useOpensslParse = false;
  44147. }
  44148. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  44149. $script = <<<'EOT'
  44150. error_reporting(-1);
  44151. $info = openssl_x509_parse(base64_decode('%s'));
  44152. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  44153. EOT;
  44154. $script = '<'."?php\n".sprintf($script, $cert);
  44155. try {
  44156. $process = new PhpProcess($script);
  44157. $process->mustRun();
  44158. } catch (\Exception $e) {
  44159. return self::$useOpensslParse = false;
  44160. }
  44161. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  44162. $errorOutput = trim($process->getErrorOutput());
  44163. if (
  44164. count($output) === 3
  44165. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  44166. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  44167. && $output[2] === 'int(-1)'
  44168. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  44169. ) {
  44170. return self::$useOpensslParse = true;
  44171. }
  44172. return self::$useOpensslParse = false;
  44173. }
  44174. public static function reset()
  44175. {
  44176. self::$caFileValidity = array();
  44177. self::$caPath = null;
  44178. self::$useOpensslParse = null;
  44179. }
  44180. }
  44181. Copyright (c) 2012 PHP Framework Interoperability Group
  44182. Permission is hereby granted, free of charge, to any person obtaining a copy
  44183. of this software and associated documentation files (the "Software"), to deal
  44184. in the Software without restriction, including without limitation the rights
  44185. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44186. copies of the Software, and to permit persons to whom the Software is
  44187. furnished to do so, subject to the following conditions:
  44188. The above copyright notice and this permission notice shall be included in
  44189. all copies or substantial portions of the Software.
  44190. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44191. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44192. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44193. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44194. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44195. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44196. THE SOFTWARE.
  44197. <?php
  44198. namespace Psr\Log;
  44199. abstract class AbstractLogger implements LoggerInterface
  44200. {
  44201. public function emergency($message, array $context = array())
  44202. {
  44203. $this->log(LogLevel::EMERGENCY, $message, $context);
  44204. }
  44205. public function alert($message, array $context = array())
  44206. {
  44207. $this->log(LogLevel::ALERT, $message, $context);
  44208. }
  44209. public function critical($message, array $context = array())
  44210. {
  44211. $this->log(LogLevel::CRITICAL, $message, $context);
  44212. }
  44213. public function error($message, array $context = array())
  44214. {
  44215. $this->log(LogLevel::ERROR, $message, $context);
  44216. }
  44217. public function warning($message, array $context = array())
  44218. {
  44219. $this->log(LogLevel::WARNING, $message, $context);
  44220. }
  44221. public function notice($message, array $context = array())
  44222. {
  44223. $this->log(LogLevel::NOTICE, $message, $context);
  44224. }
  44225. public function info($message, array $context = array())
  44226. {
  44227. $this->log(LogLevel::INFO, $message, $context);
  44228. }
  44229. public function debug($message, array $context = array())
  44230. {
  44231. $this->log(LogLevel::DEBUG, $message, $context);
  44232. }
  44233. }
  44234. <?php
  44235. namespace Psr\Log;
  44236. class InvalidArgumentException extends \InvalidArgumentException
  44237. {
  44238. }
  44239. <?php
  44240. namespace Psr\Log;
  44241. class LogLevel
  44242. {
  44243. const EMERGENCY = 'emergency';
  44244. const ALERT = 'alert';
  44245. const CRITICAL = 'critical';
  44246. const ERROR = 'error';
  44247. const WARNING = 'warning';
  44248. const NOTICE = 'notice';
  44249. const INFO = 'info';
  44250. const DEBUG = 'debug';
  44251. }
  44252. <?php
  44253. namespace Psr\Log;
  44254. interface LoggerAwareInterface
  44255. {
  44256. public function setLogger(LoggerInterface $logger);
  44257. }
  44258. <?php
  44259. namespace Psr\Log;
  44260. trait LoggerAwareTrait
  44261. {
  44262. protected $logger;
  44263. public function setLogger(LoggerInterface $logger)
  44264. {
  44265. $this->logger = $logger;
  44266. }
  44267. }
  44268. <?php
  44269. namespace Psr\Log;
  44270. interface LoggerInterface
  44271. {
  44272. public function emergency($message, array $context = array());
  44273. public function alert($message, array $context = array());
  44274. public function critical($message, array $context = array());
  44275. public function error($message, array $context = array());
  44276. public function warning($message, array $context = array());
  44277. public function notice($message, array $context = array());
  44278. public function info($message, array $context = array());
  44279. public function debug($message, array $context = array());
  44280. public function log($level, $message, array $context = array());
  44281. }
  44282. <?php
  44283. namespace Psr\Log;
  44284. trait LoggerTrait
  44285. {
  44286. public function emergency($message, array $context = array())
  44287. {
  44288. $this->log(LogLevel::EMERGENCY, $message, $context);
  44289. }
  44290. public function alert($message, array $context = array())
  44291. {
  44292. $this->log(LogLevel::ALERT, $message, $context);
  44293. }
  44294. public function critical($message, array $context = array())
  44295. {
  44296. $this->log(LogLevel::CRITICAL, $message, $context);
  44297. }
  44298. public function error($message, array $context = array())
  44299. {
  44300. $this->log(LogLevel::ERROR, $message, $context);
  44301. }
  44302. public function warning($message, array $context = array())
  44303. {
  44304. $this->log(LogLevel::WARNING, $message, $context);
  44305. }
  44306. public function notice($message, array $context = array())
  44307. {
  44308. $this->log(LogLevel::NOTICE, $message, $context);
  44309. }
  44310. public function info($message, array $context = array())
  44311. {
  44312. $this->log(LogLevel::INFO, $message, $context);
  44313. }
  44314. public function debug($message, array $context = array())
  44315. {
  44316. $this->log(LogLevel::DEBUG, $message, $context);
  44317. }
  44318. abstract public function log($level, $message, array $context = array());
  44319. }
  44320. <?php
  44321. namespace Psr\Log;
  44322. class NullLogger extends AbstractLogger
  44323. {
  44324. public function log($level, $message, array $context = array())
  44325. {
  44326. }
  44327. }
  44328. <?php
  44329. namespace Psr\Log\Test;
  44330. use Psr\Log\LogLevel;
  44331. abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
  44332. {
  44333. abstract function getLogger();
  44334. abstract function getLogs();
  44335. public function testImplements()
  44336. {
  44337. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  44338. }
  44339. public function testLogsAtAllLevels($level, $message)
  44340. {
  44341. $logger = $this->getLogger();
  44342. $logger->{$level}($message, array('user' => 'Bob'));
  44343. $logger->log($level, $message, array('user' => 'Bob'));
  44344. $expected = array(
  44345. $level.' message of level '.$level.' with context: Bob',
  44346. $level.' message of level '.$level.' with context: Bob',
  44347. );
  44348. $this->assertEquals($expected, $this->getLogs());
  44349. }
  44350. public function provideLevelsAndMessages()
  44351. {
  44352. return array(
  44353. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  44354. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  44355. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  44356. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  44357. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  44358. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  44359. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  44360. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  44361. );
  44362. }
  44363. public function testThrowsOnInvalidLevel()
  44364. {
  44365. $logger = $this->getLogger();
  44366. $logger->log('invalid level', 'Foo');
  44367. }
  44368. public function testContextReplacement()
  44369. {
  44370. $logger = $this->getLogger();
  44371. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  44372. $expected = array('info {Message {nothing} Bob Bar a}');
  44373. $this->assertEquals($expected, $this->getLogs());
  44374. }
  44375. public function testObjectCastToString()
  44376. {
  44377. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  44378. $dummy->expects($this->once())
  44379. ->method('__toString')
  44380. ->will($this->returnValue('DUMMY'));
  44381. $this->getLogger()->warning($dummy);
  44382. }
  44383. public function testContextCanContainAnything()
  44384. {
  44385. $context = array(
  44386. 'bool' => true,
  44387. 'null' => null,
  44388. 'string' => 'Foo',
  44389. 'int' => 0,
  44390. 'float' => 0.5,
  44391. 'nested' => array('with object' => new DummyTest),
  44392. 'object' => new \DateTime,
  44393. 'resource' => fopen('php://memory', 'r'),
  44394. );
  44395. $this->getLogger()->warning('Crazy context data', $context);
  44396. }
  44397. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  44398. {
  44399. $this->getLogger()->warning('Random message', array('exception' => 'oops'));
  44400. $this->getLogger()->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  44401. }
  44402. }
  44403. class DummyTest
  44404. {
  44405. }<?php
  44406. require_once __DIR__ . '/composer' . '/autoload_real.php';
  44407. return ComposerAutoloaderInitComposerPhar1473672440::getLoader();
  44408. <?php
  44409. $vendorDir = dirname(dirname(__FILE__));
  44410. $baseDir = dirname($vendorDir);
  44411. return array(
  44412. 'Psr\\Log\\' => array($vendorDir . '/psr/log'),
  44413. );
  44414. <?php
  44415. $vendorDir = dirname(dirname(__FILE__));
  44416. $baseDir = dirname($vendorDir);
  44417. return array(
  44418. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  44419. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  44420. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  44421. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  44422. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  44423. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  44424. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  44425. 'Seld\\CliPrompt\\' => array($vendorDir . '/seld/cli-prompt/src'),
  44426. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  44427. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  44428. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  44429. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  44430. 'Composer\\' => array($baseDir . '/src/Composer'),
  44431. );
  44432. <?php
  44433. $vendorDir = dirname(dirname(__FILE__));
  44434. $baseDir = dirname($vendorDir);
  44435. return array(
  44436. );
  44437. <?php
  44438. $vendorDir = dirname(dirname(__FILE__));
  44439. $baseDir = dirname($vendorDir);
  44440. return array(
  44441. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  44442. );
  44443. <?php
  44444. class ComposerAutoloaderInitComposerPhar1473672440
  44445. {
  44446. private static $loader;
  44447. public static function loadClassLoader($class)
  44448. {
  44449. if ('Composer\Autoload\ClassLoader' === $class) {
  44450. require __DIR__ . '/ClassLoader.php';
  44451. }
  44452. }
  44453. public static function getLoader()
  44454. {
  44455. if (null !== self::$loader) {
  44456. return self::$loader;
  44457. }
  44458. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1473672440', 'loadClassLoader'), true, true);
  44459. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  44460. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1473672440', 'loadClassLoader'));
  44461. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
  44462. if ($useStaticLoader) {
  44463. require_once __DIR__ . '/autoload_static.php';
  44464. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1473672440::getInitializer($loader));
  44465. } else {
  44466. $map = require __DIR__ . '/autoload_namespaces.php';
  44467. foreach ($map as $namespace => $path) {
  44468. $loader->set($namespace, $path);
  44469. }
  44470. $map = require __DIR__ . '/autoload_psr4.php';
  44471. foreach ($map as $namespace => $path) {
  44472. $loader->setPsr4($namespace, $path);
  44473. }
  44474. $classMap = require __DIR__ . '/autoload_classmap.php';
  44475. if ($classMap) {
  44476. $loader->addClassMap($classMap);
  44477. }
  44478. }
  44479. $loader->register(true);
  44480. if ($useStaticLoader) {
  44481. $includeFiles = Composer\Autoload\ComposerStaticInitComposerPhar1473672440::$files;
  44482. } else {
  44483. $includeFiles = require __DIR__ . '/autoload_files.php';
  44484. }
  44485. foreach ($includeFiles as $fileIdentifier => $file) {
  44486. composerRequireComposerPhar1473672440($fileIdentifier, $file);
  44487. }
  44488. return $loader;
  44489. }
  44490. }
  44491. function composerRequireComposerPhar1473672440($fileIdentifier, $file)
  44492. {
  44493. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  44494. require $file;
  44495. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  44496. }
  44497. }
  44498. <?php
  44499. namespace Composer\Autoload;
  44500. class ComposerStaticInitComposerPhar1473672440
  44501. {
  44502. public static $files = array (
  44503. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  44504. );
  44505. public static $prefixLengthsPsr4 = array (
  44506. 'S' =>
  44507. array (
  44508. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  44509. 'Symfony\\Component\\Process\\' => 26,
  44510. 'Symfony\\Component\\Finder\\' => 25,
  44511. 'Symfony\\Component\\Filesystem\\' => 29,
  44512. 'Symfony\\Component\\Console\\' => 26,
  44513. 'Seld\\PharUtils\\' => 15,
  44514. 'Seld\\JsonLint\\' => 14,
  44515. 'Seld\\CliPrompt\\' => 15,
  44516. ),
  44517. 'J' =>
  44518. array (
  44519. 'JsonSchema\\' => 11,
  44520. ),
  44521. 'C' =>
  44522. array (
  44523. 'Composer\\Spdx\\' => 14,
  44524. 'Composer\\Semver\\' => 16,
  44525. 'Composer\\CaBundle\\' => 18,
  44526. 'Composer\\' => 9,
  44527. ),
  44528. );
  44529. public static $prefixDirsPsr4 = array (
  44530. 'Symfony\\Polyfill\\Mbstring\\' =>
  44531. array (
  44532. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  44533. ),
  44534. 'Symfony\\Component\\Process\\' =>
  44535. array (
  44536. 0 => __DIR__ . '/..' . '/symfony/process',
  44537. ),
  44538. 'Symfony\\Component\\Finder\\' =>
  44539. array (
  44540. 0 => __DIR__ . '/..' . '/symfony/finder',
  44541. ),
  44542. 'Symfony\\Component\\Filesystem\\' =>
  44543. array (
  44544. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  44545. ),
  44546. 'Symfony\\Component\\Console\\' =>
  44547. array (
  44548. 0 => __DIR__ . '/..' . '/symfony/console',
  44549. ),
  44550. 'Seld\\PharUtils\\' =>
  44551. array (
  44552. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  44553. ),
  44554. 'Seld\\JsonLint\\' =>
  44555. array (
  44556. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  44557. ),
  44558. 'Seld\\CliPrompt\\' =>
  44559. array (
  44560. 0 => __DIR__ . '/..' . '/seld/cli-prompt/src',
  44561. ),
  44562. 'JsonSchema\\' =>
  44563. array (
  44564. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  44565. ),
  44566. 'Composer\\Spdx\\' =>
  44567. array (
  44568. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  44569. ),
  44570. 'Composer\\Semver\\' =>
  44571. array (
  44572. 0 => __DIR__ . '/..' . '/composer/semver/src',
  44573. ),
  44574. 'Composer\\CaBundle\\' =>
  44575. array (
  44576. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  44577. ),
  44578. 'Composer\\' =>
  44579. array (
  44580. 0 => __DIR__ . '/../..' . '/src/Composer',
  44581. ),
  44582. );
  44583. public static $prefixesPsr0 = array (
  44584. 'P' =>
  44585. array (
  44586. 'Psr\\Log\\' =>
  44587. array (
  44588. 0 => __DIR__ . '/..' . '/psr/log',
  44589. ),
  44590. ),
  44591. );
  44592. public static function getInitializer(ClassLoader $loader)
  44593. {
  44594. return \Closure::bind(function () use ($loader) {
  44595. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1473672440::$prefixLengthsPsr4;
  44596. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1473672440::$prefixDirsPsr4;
  44597. $loader->prefixesPsr0 = ComposerStaticInitComposerPhar1473672440::$prefixesPsr0;
  44598. }, null, ClassLoader::class);
  44599. }
  44600. }
  44601. <?php
  44602. namespace Composer\Autoload;
  44603. class ClassLoader
  44604. {
  44605. private $prefixLengthsPsr4 = array();
  44606. private $prefixDirsPsr4 = array();
  44607. private $fallbackDirsPsr4 = array();
  44608. private $prefixesPsr0 = array();
  44609. private $fallbackDirsPsr0 = array();
  44610. private $useIncludePath = false;
  44611. private $classMap = array();
  44612. private $classMapAuthoritative = false;
  44613. private $missingClasses = array();
  44614. public function getPrefixes()
  44615. {
  44616. if (!empty($this->prefixesPsr0)) {
  44617. return call_user_func_array('array_merge', $this->prefixesPsr0);
  44618. }
  44619. return array();
  44620. }
  44621. public function getPrefixesPsr4()
  44622. {
  44623. return $this->prefixDirsPsr4;
  44624. }
  44625. public function getFallbackDirs()
  44626. {
  44627. return $this->fallbackDirsPsr0;
  44628. }
  44629. public function getFallbackDirsPsr4()
  44630. {
  44631. return $this->fallbackDirsPsr4;
  44632. }
  44633. public function getClassMap()
  44634. {
  44635. return $this->classMap;
  44636. }
  44637. public function addClassMap(array $classMap)
  44638. {
  44639. if ($this->classMap) {
  44640. $this->classMap = array_merge($this->classMap, $classMap);
  44641. } else {
  44642. $this->classMap = $classMap;
  44643. }
  44644. }
  44645. public function add($prefix, $paths, $prepend = false)
  44646. {
  44647. if (!$prefix) {
  44648. if ($prepend) {
  44649. $this->fallbackDirsPsr0 = array_merge(
  44650. (array) $paths,
  44651. $this->fallbackDirsPsr0
  44652. );
  44653. } else {
  44654. $this->fallbackDirsPsr0 = array_merge(
  44655. $this->fallbackDirsPsr0,
  44656. (array) $paths
  44657. );
  44658. }
  44659. return;
  44660. }
  44661. $first = $prefix[0];
  44662. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  44663. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  44664. return;
  44665. }
  44666. if ($prepend) {
  44667. $this->prefixesPsr0[$first][$prefix] = array_merge(
  44668. (array) $paths,
  44669. $this->prefixesPsr0[$first][$prefix]
  44670. );
  44671. } else {
  44672. $this->prefixesPsr0[$first][$prefix] = array_merge(
  44673. $this->prefixesPsr0[$first][$prefix],
  44674. (array) $paths
  44675. );
  44676. }
  44677. }
  44678. public function addPsr4($prefix, $paths, $prepend = false)
  44679. {
  44680. if (!$prefix) {
  44681. if ($prepend) {
  44682. $this->fallbackDirsPsr4 = array_merge(
  44683. (array) $paths,
  44684. $this->fallbackDirsPsr4
  44685. );
  44686. } else {
  44687. $this->fallbackDirsPsr4 = array_merge(
  44688. $this->fallbackDirsPsr4,
  44689. (array) $paths
  44690. );
  44691. }
  44692. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  44693. $length = strlen($prefix);
  44694. if ('\\' !== $prefix[$length - 1]) {
  44695. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  44696. }
  44697. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  44698. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  44699. } elseif ($prepend) {
  44700. $this->prefixDirsPsr4[$prefix] = array_merge(
  44701. (array) $paths,
  44702. $this->prefixDirsPsr4[$prefix]
  44703. );
  44704. } else {
  44705. $this->prefixDirsPsr4[$prefix] = array_merge(
  44706. $this->prefixDirsPsr4[$prefix],
  44707. (array) $paths
  44708. );
  44709. }
  44710. }
  44711. public function set($prefix, $paths)
  44712. {
  44713. if (!$prefix) {
  44714. $this->fallbackDirsPsr0 = (array) $paths;
  44715. } else {
  44716. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  44717. }
  44718. }
  44719. public function setPsr4($prefix, $paths)
  44720. {
  44721. if (!$prefix) {
  44722. $this->fallbackDirsPsr4 = (array) $paths;
  44723. } else {
  44724. $length = strlen($prefix);
  44725. if ('\\' !== $prefix[$length - 1]) {
  44726. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  44727. }
  44728. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  44729. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  44730. }
  44731. }
  44732. public function setUseIncludePath($useIncludePath)
  44733. {
  44734. $this->useIncludePath = $useIncludePath;
  44735. }
  44736. public function getUseIncludePath()
  44737. {
  44738. return $this->useIncludePath;
  44739. }
  44740. public function setClassMapAuthoritative($classMapAuthoritative)
  44741. {
  44742. $this->classMapAuthoritative = $classMapAuthoritative;
  44743. }
  44744. public function isClassMapAuthoritative()
  44745. {
  44746. return $this->classMapAuthoritative;
  44747. }
  44748. public function register($prepend = false)
  44749. {
  44750. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  44751. }
  44752. public function unregister()
  44753. {
  44754. spl_autoload_unregister(array($this, 'loadClass'));
  44755. }
  44756. public function loadClass($class)
  44757. {
  44758. if ($file = $this->findFile($class)) {
  44759. includeFile($file);
  44760. return true;
  44761. }
  44762. }
  44763. public function findFile($class)
  44764. {
  44765. if ('\\' == $class[0]) {
  44766. $class = substr($class, 1);
  44767. }
  44768. if (isset($this->classMap[$class])) {
  44769. return $this->classMap[$class];
  44770. }
  44771. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  44772. return false;
  44773. }
  44774. $file = $this->findFileWithExtension($class, '.php');
  44775. if (false === $file && defined('HHVM_VERSION')) {
  44776. $file = $this->findFileWithExtension($class, '.hh');
  44777. }
  44778. if (false === $file) {
  44779. $this->missingClasses[$class] = true;
  44780. }
  44781. return $file;
  44782. }
  44783. private function findFileWithExtension($class, $ext)
  44784. {
  44785. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  44786. $first = $class[0];
  44787. if (isset($this->prefixLengthsPsr4[$first])) {
  44788. foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
  44789. if (0 === strpos($class, $prefix)) {
  44790. foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
  44791. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
  44792. return $file;
  44793. }
  44794. }
  44795. }
  44796. }
  44797. }
  44798. foreach ($this->fallbackDirsPsr4 as $dir) {
  44799. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  44800. return $file;
  44801. }
  44802. }
  44803. if (false !== $pos = strrpos($class, '\\')) {
  44804. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  44805. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  44806. } else {
  44807. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  44808. }
  44809. if (isset($this->prefixesPsr0[$first])) {
  44810. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  44811. if (0 === strpos($class, $prefix)) {
  44812. foreach ($dirs as $dir) {
  44813. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  44814. return $file;
  44815. }
  44816. }
  44817. }
  44818. }
  44819. }
  44820. foreach ($this->fallbackDirsPsr0 as $dir) {
  44821. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  44822. return $file;
  44823. }
  44824. }
  44825. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  44826. return $file;
  44827. }
  44828. return false;
  44829. }
  44830. }
  44831. function includeFile($file)
  44832. {
  44833. include $file;
  44834. }
  44835. ##
  44836. ## Bundle of CA Root Certificates
  44837. ##
  44838. ## Certificate data from Mozilla as of: Wed Apr 20 03:12:05 2016
  44839. ##
  44840. ## This is a bundle of X.509 certificates of public Certificate Authorities
  44841. ## (CA). These were automatically extracted from Mozilla's root certificates
  44842. ## file (certdata.txt). This file can be found in the mozilla source tree:
  44843. ## http://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  44844. ##
  44845. ## It contains the certificates in PEM format and therefore
  44846. ## can be directly used with curl / libcurl / php_curl, or with
  44847. ## an Apache+mod_ssl webserver for SSL client authentication.
  44848. ## Just configure this file as the SSLCACertificateFile.
  44849. ##
  44850. ## Conversion done with mk-ca-bundle.pl version 1.25.
  44851. ## SHA1: 5df367cda83086392e1acdf22bfef00c48d5eba6
  44852. ##
  44853. Equifax Secure CA
  44854. =================
  44855. -----BEGIN CERTIFICATE-----
  44856. MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJVUzEQMA4GA1UE
  44857. ChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5
  44858. MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoT
  44859. B0VxdWlmYXgxLTArBgNVBAsTJEVxdWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCB
  44860. nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPR
  44861. fM6fBeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+AcJkVV5MW
  44862. 8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kCAwEAAaOCAQkwggEFMHAG
  44863. A1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UE
  44864. CxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoG
  44865. A1UdEAQTMBGBDzIwMTgwODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvS
  44866. spXXR9gjIBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQFMAMB
  44867. Af8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUAA4GBAFjOKer89961
  44868. zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y7qj/WsjTVbJmcVfewCHrPSqnI0kB
  44869. BIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee95
  44870. 70+sB3c4
  44871. -----END CERTIFICATE-----
  44872. GlobalSign Root CA
  44873. ==================
  44874. -----BEGIN CERTIFICATE-----
  44875. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  44876. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  44877. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  44878. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  44879. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  44880. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  44881. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  44882. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  44883. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  44884. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  44885. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  44886. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  44887. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  44888. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  44889. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  44890. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  44891. -----END CERTIFICATE-----
  44892. GlobalSign Root CA - R2
  44893. =======================
  44894. -----BEGIN CERTIFICATE-----
  44895. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  44896. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  44897. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  44898. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  44899. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  44900. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  44901. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  44902. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  44903. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  44904. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  44905. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  44906. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  44907. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  44908. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  44909. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  44910. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  44911. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  44912. -----END CERTIFICATE-----
  44913. Verisign Class 3 Public Primary Certification Authority - G3
  44914. ============================================================
  44915. -----BEGIN CERTIFICATE-----
  44916. MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
  44917. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  44918. cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  44919. IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
  44920. dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
  44921. CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
  44922. dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
  44923. cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
  44924. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  44925. ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
  44926. EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
  44927. cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
  44928. EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
  44929. 055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
  44930. ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
  44931. j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
  44932. /Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
  44933. xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
  44934. t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
  44935. -----END CERTIFICATE-----
  44936. Entrust.net Premium 2048 Secure Server CA
  44937. =========================================
  44938. -----BEGIN CERTIFICATE-----
  44939. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  44940. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  44941. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  44942. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  44943. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  44944. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  44945. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  44946. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  44947. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  44948. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  44949. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  44950. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  44951. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  44952. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  44953. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  44954. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  44955. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  44956. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  44957. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  44958. -----END CERTIFICATE-----
  44959. Baltimore CyberTrust Root
  44960. =========================
  44961. -----BEGIN CERTIFICATE-----
  44962. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  44963. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  44964. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  44965. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  44966. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  44967. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  44968. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  44969. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  44970. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  44971. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  44972. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  44973. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  44974. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  44975. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  44976. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  44977. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  44978. -----END CERTIFICATE-----
  44979. AddTrust Low-Value Services Root
  44980. ================================
  44981. -----BEGIN CERTIFICATE-----
  44982. MIIEGDCCAwCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  44983. QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYDVQQDExhBZGRU
  44984. cnVzdCBDbGFzcyAxIENBIFJvb3QwHhcNMDAwNTMwMTAzODMxWhcNMjAwNTMwMTAzODMxWjBlMQsw
  44985. CQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBO
  44986. ZXR3b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwggEiMA0GCSqGSIb3DQEB
  44987. AQUAA4IBDwAwggEKAoIBAQCWltQhSWDia+hBBwzexODcEyPNwTXH+9ZOEQpnXvUGW2ulCDtbKRY6
  44988. 54eyNAbFvAWlA3yCyykQruGIgb3WntP+LVbBFc7jJp0VLhD7Bo8wBN6ntGO0/7Gcrjyvd7ZWxbWr
  44989. oulpOj0OM3kyP3CCkplhbY0wCI9xP6ZIVxn4JdxLZlyldI+Yrsj5wAYi56xz36Uu+1LcsRVlIPo1
  44990. Zmne3yzxbrww2ywkEtvrNTVokMsAsJchPXQhI2U0K7t4WaPW4XY5mqRJjox0r26kmqPZm9I4XJui
  44991. GMx1I4S+6+JNM3GOGvDC+Mcdoq0Dlyz4zyXG9rgkMbFjXZJ/Y/AlyVMuH79NAgMBAAGjgdIwgc8w
  44992. HQYDVR0OBBYEFJWxtPCUtr3H2tERCSG+wa9J/RB7MAsGA1UdDwQEAwIBBjAPBgNVHRMBAf8EBTAD
  44993. AQH/MIGPBgNVHSMEgYcwgYSAFJWxtPCUtr3H2tERCSG+wa9J/RB7oWmkZzBlMQswCQYDVQQGEwJT
  44994. RTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEw
  44995. HwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBACxt
  44996. ZBsfzQ3duQH6lmM0MkhHma6X7f1yFqZzR1r0693p9db7RcwpiURdv0Y5PejuvE1Uhh4dbOMXJ0Ph
  44997. iVYrqW9yTkkz43J8KiOavD7/KCrto/8cI7pDVwlnTUtiBi34/2ydYB7YHEt9tTEv2dB8Xfjea4MY
  44998. eDdXL+gzB2ffHsdrKpV2ro9Xo/D0UrSpUwjP4E/TelOL/bscVjby/rK25Xa71SJlpz/+0WatC7xr
  44999. mYbvP33zGDLKe8bjq2RGlfgmadlVg3sslgf/WSxEo8bl6ancoWOAWiFeIc9TVPC6b4nbqKqVz4vj
  45000. ccweGyBECMB6tkD9xOQ14R0WHNC8K47Wcdk=
  45001. -----END CERTIFICATE-----
  45002. AddTrust External Root
  45003. ======================
  45004. -----BEGIN CERTIFICATE-----
  45005. MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  45006. QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
  45007. VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
  45008. NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
  45009. cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
  45010. Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
  45011. +iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
  45012. Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
  45013. aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
  45014. 2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
  45015. 7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
  45016. BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
  45017. VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
  45018. VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
  45019. IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
  45020. j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
  45021. 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
  45022. e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
  45023. G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
  45024. -----END CERTIFICATE-----
  45025. AddTrust Public Services Root
  45026. =============================
  45027. -----BEGIN CERTIFICATE-----
  45028. MIIEFTCCAv2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  45029. QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSAwHgYDVQQDExdBZGRU
  45030. cnVzdCBQdWJsaWMgQ0EgUm9vdDAeFw0wMDA1MzAxMDQxNTBaFw0yMDA1MzAxMDQxNTBaMGQxCzAJ
  45031. BgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQIE5l
  45032. dHdvcmsxIDAeBgNVBAMTF0FkZFRydXN0IFB1YmxpYyBDQSBSb290MIIBIjANBgkqhkiG9w0BAQEF
  45033. AAOCAQ8AMIIBCgKCAQEA6Rowj4OIFMEg2Dybjxt+A3S72mnTRqX4jsIMEZBRpS9mVEBV6tsfSlbu
  45034. nyNu9DnLoblv8n75XYcmYZ4c+OLspoH4IcUkzBEMP9smcnrHAZcHF/nXGCwwfQ56HmIexkvA/X1i
  45035. d9NEHif2P0tEs7c42TkfYNVRknMDtABp4/MUTu7R3AnPdzRGULD4EfL+OHn3Bzn+UZKXC1sIXzSG
  45036. Aa2Il+tmzV7R/9x98oTaunet3IAIx6eH1lWfl2royBFkuucZKT8Rs3iQhCBSWxHveNCD9tVIkNAw
  45037. HM+A+WD+eeSI8t0A65RF62WUaUC6wNW0uLp9BBGo6zEFlpROWCGOn9Bg/QIDAQABo4HRMIHOMB0G
  45038. A1UdDgQWBBSBPjfYkrAfd59ctKtzquf2NGAv+jALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  45039. /zCBjgYDVR0jBIGGMIGDgBSBPjfYkrAfd59ctKtzquf2NGAv+qFopGYwZDELMAkGA1UEBhMCU0Ux
  45040. FDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29yazEgMB4G
  45041. A1UEAxMXQWRkVHJ1c3QgUHVibGljIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBAAP3FUr4
  45042. JNojVhaTdt02KLmuG7jD8WS6IBh4lSknVwW8fCr0uVFV2ocC3g8WFzH4qnkuCRO7r7IgGRLlk/lL
  45043. +YPoRNWyQSW/iHVv/xD8SlTQX/D67zZzfRs2RcYhbbQVuE7PnFylPVoAjgbjPGsye/Kf8Lb93/Ao
  45044. GEjwxrzQvzSAlsJKsW2Ox5BF3i9nrEUEo3rcVZLJR2bYGozH7ZxOmuASu7VqTITh4SINhwBk/ox9
  45045. Yjllpu9CtoAlEmEBqCQTcAARJl/6NVDFSMwGR+gn2HCNX2TmoUQmXiLsks3/QppEIW1cxeMiHV9H
  45046. EufOX1362KqxMy3ZdvJOOjMMK7MtkAY=
  45047. -----END CERTIFICATE-----
  45048. AddTrust Qualified Certificates Root
  45049. ====================================
  45050. -----BEGIN CERTIFICATE-----
  45051. MIIEHjCCAwagAwIBAgIBATANBgkqhkiG9w0BAQUFADBnMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  45052. QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSMwIQYDVQQDExpBZGRU
  45053. cnVzdCBRdWFsaWZpZWQgQ0EgUm9vdDAeFw0wMDA1MzAxMDQ0NTBaFw0yMDA1MzAxMDQ0NTBaMGcx
  45054. CzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQ
  45055. IE5ldHdvcmsxIzAhBgNVBAMTGkFkZFRydXN0IFF1YWxpZmllZCBDQSBSb290MIIBIjANBgkqhkiG
  45056. 9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5B6a/twJWoekn0e+EV+vhDTbYjx5eLfpMLXsDBwqxBb/4Oxx
  45057. 64r1EW7tTw2R0hIYLUkVAcKkIhPHEWT/IhKauY5cLwjPcWqzZwFZ8V1G87B4pfYOQnrjfxvM0PC3
  45058. KP0q6p6zsLkEqv32x7SxuCqg+1jxGaBvcCV+PmlKfw8i2O+tCBGaKZnhqkRFmhJePp1tUvznoD1o
  45059. L/BLcHwTOK28FSXx1s6rosAx1i+f4P8UWfyEk9mHfExUE+uf0S0R+Bg6Ot4l2ffTQO2kBhLEO+GR
  45060. wVY18BTcZTYJbqukB8c10cIDMzZbdSZtQvESa0NvS3GU+jQd7RNuyoB/mC9suWXY6QIDAQABo4HU
  45061. MIHRMB0GA1UdDgQWBBQ5lYtii1zJ1IC6WA+XPxUIQ8yYpzALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/
  45062. BAUwAwEB/zCBkQYDVR0jBIGJMIGGgBQ5lYtii1zJ1IC6WA+XPxUIQ8yYp6FrpGkwZzELMAkGA1UE
  45063. BhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29y
  45064. azEjMCEGA1UEAxMaQWRkVHJ1c3QgUXVhbGlmaWVkIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQAD
  45065. ggEBABmrder4i2VhlRO6aQTvhsoToMeqT2QbPxj2qC0sVY8FtzDqQmodwCVRLae/DLPt7wh/bDxG
  45066. GuoYQ992zPlmhpwsaPXpF/gxsxjE1kh9I0xowX67ARRvxdlu3rsEQmr49lx95dr6h+sNNVJn0J6X
  45067. dgWTP5XHAeZpVTh/EGGZyeNfpso+gmNIquIISD6q8rKFYqa0p9m9N5xotS1WfbC3P6CxB9bpT9ze
  45068. RXEwMn8bLgn5v1Kh7sKAPgZcLlVAwRv1cEWw3F369nJad9Jjzc9YiQBCYz95OdBEsIJuQRno3eDB
  45069. iFrRHnGTHyQwdOUeqN48Jzd/g66ed8/wMLH/S5noxqE=
  45070. -----END CERTIFICATE-----
  45071. Entrust Root Certification Authority
  45072. ====================================
  45073. -----BEGIN CERTIFICATE-----
  45074. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  45075. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  45076. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  45077. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  45078. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  45079. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  45080. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  45081. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  45082. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  45083. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  45084. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  45085. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  45086. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  45087. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  45088. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  45089. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  45090. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  45091. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  45092. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  45093. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  45094. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  45095. -----END CERTIFICATE-----
  45096. RSA Security 2048 v3
  45097. ====================
  45098. -----BEGIN CERTIFICATE-----
  45099. MIIDYTCCAkmgAwIBAgIQCgEBAQAAAnwAAAAKAAAAAjANBgkqhkiG9w0BAQUFADA6MRkwFwYDVQQK
  45100. ExBSU0EgU2VjdXJpdHkgSW5jMR0wGwYDVQQLExRSU0EgU2VjdXJpdHkgMjA0OCBWMzAeFw0wMTAy
  45101. MjIyMDM5MjNaFw0yNjAyMjIyMDM5MjNaMDoxGTAXBgNVBAoTEFJTQSBTZWN1cml0eSBJbmMxHTAb
  45102. BgNVBAsTFFJTQSBTZWN1cml0eSAyMDQ4IFYzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
  45103. AQEAt49VcdKA3XtpeafwGFAyPGJn9gqVB93mG/Oe2dJBVGutn3y+Gc37RqtBaB4Y6lXIL5F4iSj7
  45104. Jylg/9+PjDvJSZu1pJTOAeo+tWN7fyb9Gd3AIb2E0S1PRsNO3Ng3OTsor8udGuorryGlwSMiuLgb
  45105. WhOHV4PR8CDn6E8jQrAApX2J6elhc5SYcSa8LWrg903w8bYqODGBDSnhAMFRD0xS+ARaqn1y07iH
  45106. KrtjEAMqs6FPDVpeRrc9DvV07Jmf+T0kgYim3WBU6JU2PcYJk5qjEoAAVZkZR73QpXzDuvsf9/UP
  45107. +Ky5tfQ3mBMY3oVbtwyCO4dvlTlYMNpuAWgXIszACwIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/
  45108. MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQHw1EwpKrpRa41JPr/JCwz0LGdjDAdBgNVHQ4E
  45109. FgQUB8NRMKSq6UWuNST6/yQsM9CxnYwwDQYJKoZIhvcNAQEFBQADggEBAF8+hnZuuDU8TjYcHnmY
  45110. v/3VEhF5Ug7uMYm83X/50cYVIeiKAVQNOvtUudZj1LGqlk2iQk3UUx+LEN5/Zb5gEydxiKRz44Rj
  45111. 0aRV4VCT5hsOedBnvEbIvz8XDZXmxpBp3ue0L96VfdASPz0+f00/FGj1EVDVwfSQpQgdMWD/YIwj
  45112. VAqv/qFuxdF6Kmh4zx6CCiC0H63lhbJqaHVOrSU3lIW+vaHU6rcMSzyd6BIA8F+sDeGscGNz9395
  45113. nzIlQnQFgCi/vcEkllgVsRch6YlL2weIZ/QVrXA+L02FO8K32/6YaCOJ4XQP3vTFhGMpG8zLB8kA
  45114. pKnXwiJPZ9d37CAFYd4=
  45115. -----END CERTIFICATE-----
  45116. GeoTrust Global CA
  45117. ==================
  45118. -----BEGIN CERTIFICATE-----
  45119. MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
  45120. Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
  45121. MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  45122. LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  45123. CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
  45124. BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
  45125. 8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
  45126. T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
  45127. vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
  45128. AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
  45129. DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
  45130. zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
  45131. d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
  45132. mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
  45133. XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
  45134. Mw==
  45135. -----END CERTIFICATE-----
  45136. GeoTrust Global CA 2
  45137. ====================
  45138. -----BEGIN CERTIFICATE-----
  45139. MIIDZjCCAk6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  45140. R2VvVHJ1c3QgSW5jLjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFsIENBIDIwHhcNMDQwMzA0MDUw
  45141. MDAwWhcNMTkwMzA0MDUwMDAwWjBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  45142. LjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFsIENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  45143. ggEKAoIBAQDvPE1APRDfO1MA4Wf+lGAVPoWI8YkNkMgoI5kF6CsgncbzYEbYwbLVjDHZ3CB5JIG/
  45144. NTL8Y2nbsSpr7iFY8gjpeMtvy/wWUsiRxP89c96xPqfCfWbB9X5SJBri1WeR0IIQ13hLTytCOb1k
  45145. LUCgsBDTOEhGiKEMuzozKmKY+wCdE1l/bztyqu6mD4b5BWHqZ38MN5aL5mkWRxHCJ1kDs6ZgwiFA
  45146. Vvqgx306E+PsV8ez1q6diYD3Aecs9pYrEw15LNnA5IZ7S4wMcoKK+xfNAGw6EzywhIdLFnopsk/b
  45147. HdQL82Y3vdj2V7teJHq4PIu5+pIaGoSe2HSPqht/XvT+RSIhAgMBAAGjYzBhMA8GA1UdEwEB/wQF
  45148. MAMBAf8wHQYDVR0OBBYEFHE4NvICMVNHK266ZUapEBVYIAUJMB8GA1UdIwQYMBaAFHE4NvICMVNH
  45149. K266ZUapEBVYIAUJMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQUFAAOCAQEAA/e1K6tdEPx7
  45150. srJerJsOflN4WT5CBP51o62sgU7XAotexC3IUnbHLB/8gTKY0UvGkpMzNTEv/NgdRN3ggX+d6Yvh
  45151. ZJFiCzkIjKx0nVnZellSlxG5FntvRdOW2TF9AjYPnDtuzywNA0ZF66D0f0hExghAzN4bcLUprbqL
  45152. OzRldRtxIR0sFAqwlpW41uryZfspuk/qkZN0abby/+Ea0AzRdoXLiiW9l14sbxWZJue2Kf8i7MkC
  45153. x1YAzUm5s2x7UwQa4qjJqhIFI8LO57sEAszAR6LkxCkvW0VXiVHuPOtSCP8HNR6fNWpHSlaY0VqF
  45154. H4z1Ir+rzoPz4iIprn2DQKi6bA==
  45155. -----END CERTIFICATE-----
  45156. GeoTrust Universal CA
  45157. =====================
  45158. -----BEGIN CERTIFICATE-----
  45159. MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  45160. R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
  45161. MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
  45162. Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  45163. ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
  45164. JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
  45165. RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
  45166. 7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
  45167. 8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
  45168. qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
  45169. Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
  45170. Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
  45171. KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
  45172. ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
  45173. XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
  45174. hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
  45175. aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
  45176. qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
  45177. oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
  45178. xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
  45179. KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
  45180. DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
  45181. xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
  45182. p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
  45183. P/rmMuGNG2+k5o7Y+SlIis5z/iw=
  45184. -----END CERTIFICATE-----
  45185. GeoTrust Universal CA 2
  45186. =======================
  45187. -----BEGIN CERTIFICATE-----
  45188. MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  45189. R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
  45190. MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
  45191. SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
  45192. A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
  45193. DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
  45194. j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
  45195. JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
  45196. QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
  45197. WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
  45198. 20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
  45199. ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
  45200. SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
  45201. 8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
  45202. +/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
  45203. BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
  45204. dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
  45205. 4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
  45206. mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
  45207. A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
  45208. Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
  45209. pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
  45210. FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
  45211. gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
  45212. X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
  45213. -----END CERTIFICATE-----
  45214. Visa eCommerce Root
  45215. ===================
  45216. -----BEGIN CERTIFICATE-----
  45217. MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQG
  45218. EwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2Ug
  45219. QXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2
  45220. WhcNMjIwNjI0MDAxNjEyWjBrMQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMm
  45221. VmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv
  45222. bW1lcmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h2mCxlCfL
  45223. F9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4ElpF7sDPwsRROEW+1QK8b
  45224. RaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdVZqW1LS7YgFmypw23RuwhY/81q6UCzyr0
  45225. TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI
  45226. /k4+oKsGGelT84ATB+0tvz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzs
  45227. GHxBvfaLdXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEG
  45228. MB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUFAAOCAQEAX/FBfXxc
  45229. CLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcRzCSs00Rsca4BIGsDoo8Ytyk6feUW
  45230. YFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pz
  45231. zkWKsKZJ/0x9nXGIxHYdkFsd7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBu
  45232. YQa7FkKMcPcw++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt
  45233. 398znM/jra6O1I7mT1GvFpLgXPYHDw==
  45234. -----END CERTIFICATE-----
  45235. Certum Root CA
  45236. ==============
  45237. -----BEGIN CERTIFICATE-----
  45238. MIIDDDCCAfSgAwIBAgIDAQAgMA0GCSqGSIb3DQEBBQUAMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQK
  45239. ExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBDQTAeFw0wMjA2MTExMDQ2Mzla
  45240. Fw0yNzA2MTExMDQ2MzlaMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8u
  45241. by4xEjAQBgNVBAMTCUNlcnR1bSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6x
  45242. wS7TT3zNJc4YPk/EjG+AanPIW1H4m9LcuwBcsaD8dQPugfCI7iNS6eYVM42sLQnFdvkrOYCJ5JdL
  45243. kKWoePhzQ3ukYbDYWMzhbGZ+nPMJXlVjhNWo7/OxLjBos8Q82KxujZlakE403Daaj4GIULdtlkIJ
  45244. 89eVgw1BS7Bqa/j8D35in2fE7SZfECYPCE/wpFcozo+47UX2bu4lXapuOb7kky/ZR6By6/qmW6/K
  45245. Uz/iDsaWVhFu9+lmqSbYf5VT7QqFiLpPKaVCjF62/IUgAKpoC6EahQGcxEZjgoi2IrHu/qpGWX7P
  45246. NSzVttpd90gzFFS269lvzs2I1qsb2pY7HVkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkq
  45247. hkiG9w0BAQUFAAOCAQEAuI3O7+cUus/usESSbLQ5PqKEbq24IXfS1HeCh+YgQYHu4vgRt2PRFze+
  45248. GXYkHAQaTOs9qmdvLdTN/mUxcMUbpgIKumB7bVjCmkn+YzILa+M6wKyrO7Do0wlRjBCDxjTgxSvg
  45249. GrZgFCdsMneMvLJymM/NzD+5yCRCFNZX/OYmQ6kd5YCQzgNUKD73P9P4Te1qCjqTE5s7FCMTY5w/
  45250. 0YcneeVMUeMBrYVdGjux1XMQpNPyvG5k9VpWkKjHDkx0Dy5xO/fIR/RpbxXyEV6DHpx8Uq79AtoS
  45251. qFlnGNu8cN2bsWntgM6JQEhqDjXKKWYVIZQs6GAqm4VKQPNriiTsBhYscw==
  45252. -----END CERTIFICATE-----
  45253. Comodo AAA Services root
  45254. ========================
  45255. -----BEGIN CERTIFICATE-----
  45256. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  45257. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  45258. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  45259. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  45260. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  45261. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  45262. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  45263. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  45264. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  45265. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  45266. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  45267. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  45268. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  45269. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  45270. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  45271. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  45272. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  45273. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  45274. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  45275. -----END CERTIFICATE-----
  45276. Comodo Secure Services root
  45277. ===========================
  45278. -----BEGIN CERTIFICATE-----
  45279. MIIEPzCCAyegAwIBAgIBATANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  45280. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  45281. TGltaXRlZDEkMCIGA1UEAwwbU2VjdXJlIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAw
  45282. MDAwMFoXDTI4MTIzMTIzNTk1OVowfjELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFu
  45283. Y2hlc3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxJDAi
  45284. BgNVBAMMG1NlY3VyZSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP
  45285. ADCCAQoCggEBAMBxM4KK0HDrc4eCQNUd5MvJDkKQ+d40uaG6EfQlhfPMcm3ye5drswfxdySRXyWP
  45286. 9nQ95IDC+DwN879A6vfIUtFyb+/Iq0G4bi4XKpVpDM3SHpR7LZQdqnXXs5jLrLxkU0C8j6ysNstc
  45287. rbvd4JQX7NFc0L/vpZXJkMWwrPsbQ996CF23uPJAGysnnlDOXmWCiIxe004MeuoIkbY2qitC++rC
  45288. oznl2yY4rYsK7hljxxwk3wN42ubqwUcaCwtGCd0C/N7Lh1/XMGNooa7cMqG6vv5Eq2i2pRcV/b3V
  45289. p6ea5EQz6YiO/O1R65NxTq0B50SOqy3LqP4BSUjwwN3HaNiS/j0CAwEAAaOBxzCBxDAdBgNVHQ4E
  45290. FgQUPNiTiMLAggnMAZkGkyDpnnAJY08wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  45291. gYEGA1UdHwR6MHgwO6A5oDeGNWh0dHA6Ly9jcmwuY29tb2RvY2EuY29tL1NlY3VyZUNlcnRpZmlj
  45292. YXRlU2VydmljZXMuY3JsMDmgN6A1hjNodHRwOi8vY3JsLmNvbW9kby5uZXQvU2VjdXJlQ2VydGlm
  45293. aWNhdGVTZXJ2aWNlcy5jcmwwDQYJKoZIhvcNAQEFBQADggEBAIcBbSMdflsXfcFhMs+P5/OKlFlm
  45294. 4J4oqF7Tt/Q05qo5spcWxYJvMqTpjOev/e/C6LlLqqP05tqNZSH7uoDrJiiFGv45jN5bBAS0VPmj
  45295. Z55B+glSzAVIqMk/IQQezkhr/IXownuvf7fM+F86/TXGDe+X3EyrEeFryzHRbPtIgKvcnDe4IRRL
  45296. DXE97IMzbtFuMhbsmMcWi1mmNKsFVy2T96oTy9IT4rcuO81rUBcJaD61JlfutuC23bkpgHl9j6Pw
  45297. pCikFcSF9CfUa7/lXORlAnZUtOM3ZiTTGWHIUhDlizeauan5Hb/qmZJhlv8BzaFfDbxxvA6sCx1H
  45298. RR3B7Hzs/Sk=
  45299. -----END CERTIFICATE-----
  45300. Comodo Trusted Services root
  45301. ============================
  45302. -----BEGIN CERTIFICATE-----
  45303. MIIEQzCCAyugAwIBAgIBATANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  45304. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  45305. TGltaXRlZDElMCMGA1UEAwwcVHJ1c3RlZCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczAeFw0wNDAxMDEw
  45306. MDAwMDBaFw0yODEyMzEyMzU5NTlaMH8xCzAJBgNVBAYTAkdCMRswGQYDVQQIDBJHcmVhdGVyIE1h
  45307. bmNoZXN0ZXIxEDAOBgNVBAcMB1NhbGZvcmQxGjAYBgNVBAoMEUNvbW9kbyBDQSBMaW1pdGVkMSUw
  45308. IwYDVQQDDBxUcnVzdGVkIENlcnRpZmljYXRlIFNlcnZpY2VzMIIBIjANBgkqhkiG9w0BAQEFAAOC
  45309. AQ8AMIIBCgKCAQEA33FvNlhTWvI2VFeAxHQIIO0Yfyod5jWaHiWsnOWWfnJSoBVC21ndZHoa0Lh7
  45310. 3TkVvFVIxO06AOoxEbrycXQaZ7jPM8yoMa+j49d/vzMtTGo87IvDktJTdyR0nAducPy9C1t2ul/y
  45311. /9c3S0pgePfw+spwtOpZqqPOSC+pw7ILfhdyFgymBwwbOM/JYrc/oJOlh0Hyt3BAd9i+FHzjqMB6
  45312. juljatEPmsbS9Is6FARW1O24zG71++IsWL1/T2sr92AkWCTOJu80kTrV44HQsvAEAtdbtz6SrGsS
  45313. ivnkBbA7kUlcsutT6vifR4buv5XAwAaf0lteERv0xwQ1KdJVXOTt6wIDAQABo4HJMIHGMB0GA1Ud
  45314. DgQWBBTFe1i97doladL3WRaoszLAeydb9DAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  45315. /zCBgwYDVR0fBHwwejA8oDqgOIY2aHR0cDovL2NybC5jb21vZG9jYS5jb20vVHJ1c3RlZENlcnRp
  45316. ZmljYXRlU2VydmljZXMuY3JsMDqgOKA2hjRodHRwOi8vY3JsLmNvbW9kby5uZXQvVHJ1c3RlZENl
  45317. cnRpZmljYXRlU2VydmljZXMuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQDIk4E7ibSvuIQSTI3S8Ntw
  45318. uleGFTQQuS9/HrCoiWChisJ3DFBKmwCL2Iv0QeLQg4pKHBQGsKNoBXAxMKdTmw7pSqBYaWcOrp32
  45319. pSxBvzwGa+RZzG0Q8ZZvH9/0BAKkn0U+yNj6NkZEUD+Cl5EfKNsYEYwq5GWDVxISjBc/lDb+XbDA
  45320. BHcTuPQV1T84zJQ6VdCsmPW6AF/ghhmBeC8owH7TzEIK9a5QoNE+xqFx7D+gIIxmOom0jtTYsU0l
  45321. R+4viMi14QVFwL4Ucd56/Y57fU0IlqUSc/AtyjcndBInTMu2l+nZrghtWjlA3QVHdWpaIbOjGM9O
  45322. 9y5Xt5hwXsjEeLBi
  45323. -----END CERTIFICATE-----
  45324. QuoVadis Root CA
  45325. ================
  45326. -----BEGIN CERTIFICATE-----
  45327. MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
  45328. ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
  45329. eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
  45330. MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
  45331. cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
  45332. EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
  45333. AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
  45334. J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
  45335. F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
  45336. YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
  45337. AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
  45338. PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
  45339. ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
  45340. MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
  45341. YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
  45342. ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
  45343. Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
  45344. Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
  45345. BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
  45346. FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
  45347. aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
  45348. tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
  45349. fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
  45350. LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
  45351. gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
  45352. 5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
  45353. 5nrQNiOKSnQ2+Q==
  45354. -----END CERTIFICATE-----
  45355. QuoVadis Root CA 2
  45356. ==================
  45357. -----BEGIN CERTIFICATE-----
  45358. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  45359. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  45360. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  45361. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  45362. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  45363. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  45364. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  45365. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  45366. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  45367. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  45368. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  45369. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  45370. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  45371. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  45372. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  45373. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  45374. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  45375. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  45376. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  45377. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  45378. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  45379. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  45380. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  45381. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  45382. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  45383. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  45384. -----END CERTIFICATE-----
  45385. QuoVadis Root CA 3
  45386. ==================
  45387. -----BEGIN CERTIFICATE-----
  45388. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  45389. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  45390. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  45391. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  45392. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  45393. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  45394. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  45395. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  45396. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  45397. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  45398. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  45399. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  45400. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  45401. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  45402. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  45403. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  45404. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  45405. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  45406. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  45407. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  45408. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  45409. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  45410. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  45411. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  45412. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  45413. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  45414. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  45415. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  45416. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  45417. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  45418. -----END CERTIFICATE-----
  45419. Security Communication Root CA
  45420. ==============================
  45421. -----BEGIN CERTIFICATE-----
  45422. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  45423. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  45424. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  45425. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  45426. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  45427. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  45428. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  45429. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  45430. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  45431. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  45432. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  45433. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  45434. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  45435. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  45436. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  45437. FL39vmwLAw==
  45438. -----END CERTIFICATE-----
  45439. Sonera Class 2 Root CA
  45440. ======================
  45441. -----BEGIN CERTIFICATE-----
  45442. MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
  45443. U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
  45444. NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
  45445. IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
  45446. /Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
  45447. dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
  45448. f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
  45449. tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
  45450. nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
  45451. XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
  45452. 0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
  45453. cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
  45454. Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
  45455. EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
  45456. llpwrN9M
  45457. -----END CERTIFICATE-----
  45458. UTN USERFirst Hardware Root CA
  45459. ==============================
  45460. -----BEGIN CERTIFICATE-----
  45461. MIIEdDCCA1ygAwIBAgIQRL4Mi1AAJLQR0zYq/mUK/TANBgkqhkiG9w0BAQUFADCBlzELMAkGA1UE
  45462. BhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEeMBwGA1UEChMVVGhl
  45463. IFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAd
  45464. BgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwHhcNOTkwNzA5MTgxMDQyWhcNMTkwNzA5MTgx
  45465. OTIyWjCBlzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0
  45466. eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVz
  45467. ZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwggEiMA0GCSqGSIb3
  45468. DQEBAQUAA4IBDwAwggEKAoIBAQCx98M4P7Sof885glFn0G2f0v9Y8+efK+wNiVSZuTiZFvfgIXlI
  45469. wrthdBKWHTxqctU8EGc6Oe0rE81m65UJM6Rsl7HoxuzBdXmcRl6Nq9Bq/bkqVRcQVLMZ8Jr28bFd
  45470. tqdt++BxF2uiiPsA3/4aMXcMmgF6sTLjKwEHOG7DpV4jvEWbe1DByTCP2+UretNb+zNAHqDVmBe8
  45471. i4fDidNdoI6yqqr2jmmIBsX6iSHzCJ1pLgkzmykNRg+MzEk0sGlRvfkGzWitZky8PqxhvQqIDsjf
  45472. Pe58BEydCl5rkdbux+0ojatNh4lz0G6k0B4WixThdkQDf2Os5M1JnMWS9KsyoUhbAgMBAAGjgbkw
  45473. gbYwCwYDVR0PBAQDAgHGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFKFyXyYbKJhDlV0HN9WF
  45474. lp1L0sNFMEQGA1UdHwQ9MDswOaA3oDWGM2h0dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9VVE4tVVNF
  45475. UkZpcnN0LUhhcmR3YXJlLmNybDAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwUGCCsGAQUF
  45476. BwMGBggrBgEFBQcDBzANBgkqhkiG9w0BAQUFAAOCAQEARxkP3nTGmZev/K0oXnWO6y1n7k57K9cM
  45477. //bey1WiCuFMVGWTYGufEpytXoMs61quwOQt9ABjHbjAbPLPSbtNk28GpgoiskliCE7/yMgUsogW
  45478. XecB5BKV5UU0s4tpvc+0hY91UZ59Ojg6FEgSxvunOxqNDYJAB+gECJChicsZUN/KHAG8HQQZexB2
  45479. lzvukJDKxA4fFm517zP4029bHpbj4HR3dHuKom4t3XbWOTCC8KucUvIqx69JXn7HaOWCgchqJ/kn
  45480. iCrVWFCVH/A7HFe7fRQ5YiuayZSSKqMiDP+JJn1fIytH1xUdqWqeUQ0qUZ6B+dQ7XnASfxAynB67
  45481. nfhmqA==
  45482. -----END CERTIFICATE-----
  45483. Camerfirma Chambers of Commerce Root
  45484. ====================================
  45485. -----BEGIN CERTIFICATE-----
  45486. MIIEvTCCA6WgAwIBAgIBADANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
  45487. QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
  45488. ZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdDAeFw0wMzA5MzAx
  45489. NjEzNDNaFw0zNzA5MzAxNjEzNDRaMH8xCzAJBgNVBAYTAkVVMScwJQYDVQQKEx5BQyBDYW1lcmZp
  45490. cm1hIFNBIENJRiBBODI3NDMyODcxIzAhBgNVBAsTGmh0dHA6Ly93d3cuY2hhbWJlcnNpZ24ub3Jn
  45491. MSIwIAYDVQQDExlDaGFtYmVycyBvZiBDb21tZXJjZSBSb290MIIBIDANBgkqhkiG9w0BAQEFAAOC
  45492. AQ0AMIIBCAKCAQEAtzZV5aVdGDDg2olUkfzIx1L4L1DZ77F1c2VHfRtbunXF/KGIJPov7coISjlU
  45493. xFF6tdpg6jg8gbLL8bvZkSM/SAFwdakFKq0fcfPJVD0dBmpAPrMMhe5cG3nCYsS4No41XQEMIwRH
  45494. NaqbYE6gZj3LJgqcQKH0XZi/caulAGgq7YN6D6IUtdQis4CwPAxaUWktWBiP7Zme8a7ileb2R6jW
  45495. DA+wWFjbw2Y3npuRVDM30pQcakjJyfKl2qUMI/cjDpwyVV5xnIQFUZot/eZOKjRa3spAN2cMVCFV
  45496. d9oKDMyXroDclDZK9D7ONhMeU+SsTjoF7Nuucpw4i9A5O4kKPnf+dQIBA6OCAUQwggFAMBIGA1Ud
  45497. EwEB/wQIMAYBAf8CAQwwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL2NybC5jaGFtYmVyc2lnbi5v
  45498. cmcvY2hhbWJlcnNyb290LmNybDAdBgNVHQ4EFgQU45T1sU3p26EpW1eLTXYGduHRooowDgYDVR0P
  45499. AQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzAnBgNVHREEIDAegRxjaGFtYmVyc3Jvb3RAY2hh
  45500. bWJlcnNpZ24ub3JnMCcGA1UdEgQgMB6BHGNoYW1iZXJzcm9vdEBjaGFtYmVyc2lnbi5vcmcwWAYD
  45501. VR0gBFEwTzBNBgsrBgEEAYGHLgoDATA+MDwGCCsGAQUFBwIBFjBodHRwOi8vY3BzLmNoYW1iZXJz
  45502. aWduLm9yZy9jcHMvY2hhbWJlcnNyb290Lmh0bWwwDQYJKoZIhvcNAQEFBQADggEBAAxBl8IahsAi
  45503. fJ/7kPMa0QOx7xP5IV8EnNrJpY0nbJaHkb5BkAFyk+cefV/2icZdp0AJPaxJRUXcLo0waLIJuvvD
  45504. L8y6C98/d3tGfToSJI6WjzwFCm/SlCgdbQzALogi1djPHRPH8EjX1wWnz8dHnjs8NMiAT9QUu/wN
  45505. UPf6s+xCX6ndbcj0dc97wXImsQEcXCz9ek60AcUFV7nnPKoF2YjpB0ZBzu9Bga5Y34OirsrXdx/n
  45506. ADydb47kMgkdTXg0eDQ8lJsm7U9xxhl6vSAiSFr+S30Dt+dYvsYyTnQeaN2oaFuzPu5ifdmA6Ap1
  45507. erfutGWaIZDgqtCYvDi1czyL+Nw=
  45508. -----END CERTIFICATE-----
  45509. Camerfirma Global Chambersign Root
  45510. ==================================
  45511. -----BEGIN CERTIFICATE-----
  45512. MIIExTCCA62gAwIBAgIBADANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
  45513. QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
  45514. ZXJzaWduLm9yZzEgMB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwHhcNMDMwOTMwMTYx
  45515. NDE4WhcNMzcwOTMwMTYxNDE4WjB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJt
  45516. YSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEg
  45517. MB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwggEgMA0GCSqGSIb3DQEBAQUAA4IBDQAw
  45518. ggEIAoIBAQCicKLQn0KuWxfH2H3PFIP8T8mhtxOviteePgQKkotgVvq0Mi+ITaFgCPS3CU6gSS9J
  45519. 1tPfnZdan5QEcOw/Wdm3zGaLmFIoCQLfxS+EjXqXd7/sQJ0lcqu1PzKY+7e3/HKE5TWH+VX6ox8O
  45520. by4o3Wmg2UIQxvi1RMLQQ3/bvOSiPGpVeAp3qdjqGTK3L/5cPxvusZjsyq16aUXjlg9V9ubtdepl
  45521. 6DJWk0aJqCWKZQbua795B9Dxt6/tLE2Su8CoX6dnfQTyFQhwrJLWfQTSM/tMtgsL+xrJxI0DqX5c
  45522. 8lCrEqWhz0hQpe/SyBoT+rB/sYIcd2oPX9wLlY/vQ37mRQklAgEDo4IBUDCCAUwwEgYDVR0TAQH/
  45523. BAgwBgEB/wIBDDA/BgNVHR8EODA2MDSgMqAwhi5odHRwOi8vY3JsLmNoYW1iZXJzaWduLm9yZy9j
  45524. aGFtYmVyc2lnbnJvb3QuY3JsMB0GA1UdDgQWBBRDnDafsJ4wTcbOX60Qq+UDpfqpFDAOBgNVHQ8B
  45525. Af8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgAHMCoGA1UdEQQjMCGBH2NoYW1iZXJzaWducm9vdEBj
  45526. aGFtYmVyc2lnbi5vcmcwKgYDVR0SBCMwIYEfY2hhbWJlcnNpZ25yb290QGNoYW1iZXJzaWduLm9y
  45527. ZzBbBgNVHSAEVDBSMFAGCysGAQQBgYcuCgEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly9jcHMuY2hh
  45528. bWJlcnNpZ24ub3JnL2Nwcy9jaGFtYmVyc2lnbnJvb3QuaHRtbDANBgkqhkiG9w0BAQUFAAOCAQEA
  45529. PDtwkfkEVCeR4e3t/mh/YV3lQWVPMvEYBZRqHN4fcNs+ezICNLUMbKGKfKX0j//U2K0X1S0E0T9Y
  45530. gOKBWYi+wONGkyT+kL0mojAt6JcmVzWJdJYY9hXiryQZVgICsroPFOrGimbBhkVVi76SvpykBMdJ
  45531. PJ7oKXqJ1/6v/2j1pReQvayZzKWGVwlnRtvWFsJG8eSpUPWP0ZIV018+xgBJOm5YstHRJw0lyDL4
  45532. IBHNfTIzSJRUTN3cecQwn+uOuFW114hcxWokPbLTBQNRxgfvzBRydD1ucs4YKIxKoHflCStFREes
  45533. t2d/AYoFWpO+ocH/+OcOZ6RHSXZddZAa9SaP8A==
  45534. -----END CERTIFICATE-----
  45535. XRamp Global CA Root
  45536. ====================
  45537. -----BEGIN CERTIFICATE-----
  45538. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  45539. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  45540. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  45541. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  45542. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  45543. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  45544. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  45545. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  45546. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  45547. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  45548. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  45549. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  45550. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  45551. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  45552. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  45553. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  45554. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  45555. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  45556. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  45557. -----END CERTIFICATE-----
  45558. Go Daddy Class 2 CA
  45559. ===================
  45560. -----BEGIN CERTIFICATE-----
  45561. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  45562. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  45563. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  45564. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  45565. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  45566. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  45567. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  45568. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  45569. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  45570. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  45571. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  45572. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  45573. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  45574. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  45575. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  45576. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  45577. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  45578. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  45579. vZ8=
  45580. -----END CERTIFICATE-----
  45581. Starfield Class 2 CA
  45582. ====================
  45583. -----BEGIN CERTIFICATE-----
  45584. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  45585. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  45586. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  45587. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  45588. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  45589. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  45590. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  45591. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  45592. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  45593. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  45594. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  45595. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  45596. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  45597. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  45598. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  45599. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  45600. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  45601. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  45602. QBFGmh95DmK/D5fs4C8fF5Q=
  45603. -----END CERTIFICATE-----
  45604. StartCom Certification Authority
  45605. ================================
  45606. -----BEGIN CERTIFICATE-----
  45607. MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
  45608. U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu
  45609. ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0
  45610. NjM2WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk
  45611. LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg
  45612. U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
  45613. ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y
  45614. o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/
  45615. Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d
  45616. eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt
  45617. 2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z
  45618. 6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ
  45619. osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/
  45620. untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc
  45621. UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT
  45622. 37uMdBNSSwIDAQABo4ICUjCCAk4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAa4wHQYDVR0OBBYE
  45623. FE4L7xqkQFulF2mHMMo0aEPQQa7yMGQGA1UdHwRdMFswLKAqoCiGJmh0dHA6Ly9jZXJ0LnN0YXJ0
  45624. Y29tLm9yZy9zZnNjYS1jcmwuY3JsMCugKaAnhiVodHRwOi8vY3JsLnN0YXJ0Y29tLm9yZy9zZnNj
  45625. YS1jcmwuY3JsMIIBXQYDVR0gBIIBVDCCAVAwggFMBgsrBgEEAYG1NwEBATCCATswLwYIKwYBBQUH
  45626. AgEWI2h0dHA6Ly9jZXJ0LnN0YXJ0Y29tLm9yZy9wb2xpY3kucGRmMDUGCCsGAQUFBwIBFilodHRw
  45627. Oi8vY2VydC5zdGFydGNvbS5vcmcvaW50ZXJtZWRpYXRlLnBkZjCB0AYIKwYBBQUHAgIwgcMwJxYg
  45628. U3RhcnQgQ29tbWVyY2lhbCAoU3RhcnRDb20pIEx0ZC4wAwIBARqBl0xpbWl0ZWQgTGlhYmlsaXR5
  45629. LCByZWFkIHRoZSBzZWN0aW9uICpMZWdhbCBMaW1pdGF0aW9ucyogb2YgdGhlIFN0YXJ0Q29tIENl
  45630. cnRpZmljYXRpb24gQXV0aG9yaXR5IFBvbGljeSBhdmFpbGFibGUgYXQgaHR0cDovL2NlcnQuc3Rh
  45631. cnRjb20ub3JnL3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilT
  45632. dGFydENvbSBGcmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOC
  45633. AgEAFmyZ9GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8jhvh
  45634. 3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUWFjgKXlf2Ysd6AgXm
  45635. vB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJzewT4F+irsfMuXGRuczE6Eri8sxHk
  45636. fY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3
  45637. fsNrarnDy0RLrHiQi+fHLB5LEUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZ
  45638. EoalHmdkrQYuL6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq
  45639. yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuCO3NJo2pXh5Tl
  45640. 1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6Vum0ABj6y6koQOdjQK/W/7HW/
  45641. lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkyShNOsF/5oirpt9P/FlUQqmMGqz9IgcgA38coro
  45642. g14=
  45643. -----END CERTIFICATE-----
  45644. Taiwan GRCA
  45645. ===========
  45646. -----BEGIN CERTIFICATE-----
  45647. MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
  45648. EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
  45649. DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
  45650. dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
  45651. ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
  45652. w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
  45653. BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
  45654. 1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
  45655. htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
  45656. J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
  45657. Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
  45658. B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
  45659. O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
  45660. lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
  45661. HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
  45662. 09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
  45663. TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
  45664. Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
  45665. Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
  45666. D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
  45667. DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
  45668. Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
  45669. 7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
  45670. CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
  45671. +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
  45672. -----END CERTIFICATE-----
  45673. Swisscom Root CA 1
  45674. ==================
  45675. -----BEGIN CERTIFICATE-----
  45676. MIIF2TCCA8GgAwIBAgIQXAuFXAvnWUHfV8w/f52oNjANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQG
  45677. EwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0YWwgQ2VydGlmaWNhdGUgU2Vy
  45678. dmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3QgQ0EgMTAeFw0wNTA4MTgxMjA2MjBaFw0yNTA4
  45679. MTgyMjA2MjBaMGQxCzAJBgNVBAYTAmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGln
  45680. aXRhbCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAxMIIC
  45681. IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0LmwqAzZuz8h+BvVM5OAFmUgdbI9m2BtRsiM
  45682. MW8Xw/qabFbtPMWRV8PNq5ZJkCoZSx6jbVfd8StiKHVFXqrWW/oLJdihFvkcxC7mlSpnzNApbjyF
  45683. NDhhSbEAn9Y6cV9Nbc5fuankiX9qUvrKm/LcqfmdmUc/TilftKaNXXsLmREDA/7n29uj/x2lzZAe
  45684. AR81sH8A25Bvxn570e56eqeqDFdvpG3FEzuwpdntMhy0XmeLVNxzh+XTF3xmUHJd1BpYwdnP2IkC
  45685. b6dJtDZd0KTeByy2dbcokdaXvij1mB7qWybJvbCXc9qukSbraMH5ORXWZ0sKbU/Lz7DkQnGMU3nn
  45686. 7uHbHaBuHYwadzVcFh4rUx80i9Fs/PJnB3r1re3WmquhsUvhzDdf/X/NTa64H5xD+SpYVUNFvJbN
  45687. cA78yeNmuk6NO4HLFWR7uZToXTNShXEuT46iBhFRyePLoW4xCGQMwtI89Tbo19AOeCMgkckkKmUp
  45688. WyL3Ic6DXqTz3kvTaI9GdVyDCW4pa8RwjPWd1yAv/0bSKzjCL3UcPX7ape8eYIVpQtPM+GP+HkM5
  45689. haa2Y0EQs3MevNP6yn0WR+Kn1dCjigoIlmJWbjTb2QK5MHXjBNLnj8KwEUAKrNVxAmKLMb7dxiNY
  45690. MUJDLXT5xp6mig/p/r+D5kNXJLrvRjSq1xIBOO0CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYw
  45691. HQYDVR0hBBYwFDASBgdghXQBUwABBgdghXQBUwABMBIGA1UdEwEB/wQIMAYBAf8CAQcwHwYDVR0j
  45692. BBgwFoAUAyUv3m+CATpcLNwroWm1Z9SM0/0wHQYDVR0OBBYEFAMlL95vggE6XCzcK6FptWfUjNP9
  45693. MA0GCSqGSIb3DQEBBQUAA4ICAQA1EMvspgQNDQ/NwNurqPKIlwzfky9NfEBWMXrrpA9gzXrzvsMn
  45694. jgM+pN0S734edAY8PzHyHHuRMSG08NBsl9Tpl7IkVh5WwzW9iAUPWxAaZOHHgjD5Mq2eUCzneAXQ
  45695. MbFamIp1TpBcahQq4FJHgmDmHtqBsfsUC1rxn9KVuj7QG9YVHaO+htXbD8BJZLsuUBlL0iT43R4H
  45696. VtA4oJVwIHaM190e3p9xxCPvgxNcoyQVTSlAPGrEqdi3pkSlDfTgnXceQHAm/NrZNuR55LU/vJtl
  45697. vrsRls/bxig5OgjOR1tTWsWZ/l2p3e9M1MalrQLmjAcSHm8D0W+go/MpvRLHUKKwf4ipmXeascCl
  45698. OS5cfGniLLDqN2qk4Vrh9VDlg++luyqI54zb/W1elxmofmZ1a3Hqv7HHb6D0jqTsNFFbjCYDcKF3
  45699. 1QESVwA12yPeDooomf2xEG9L/zgtYE4snOtnta1J7ksfrK/7DZBaZmBwXarNeNQk7shBoJMBkpxq
  45700. nvy5JMWzFYJ+vq6VK+uxwNrjAWALXmmshFZhvnEX/h0TD/7Gh0Xp/jKgGg0TpJRVcaUWi7rKibCy
  45701. x/yP2FS1k2Kdzs9Z+z0YzirLNRWCXf9UIltxUvu3yf5gmwBBZPCqKuy2QkPOiWaByIufOVQDJdMW
  45702. NY6E0F/6MBr1mmz0DlP5OlvRHA==
  45703. -----END CERTIFICATE-----
  45704. DigiCert Assured ID Root CA
  45705. ===========================
  45706. -----BEGIN CERTIFICATE-----
  45707. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  45708. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  45709. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  45710. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  45711. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  45712. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  45713. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  45714. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  45715. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  45716. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  45717. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  45718. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  45719. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  45720. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  45721. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  45722. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  45723. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  45724. -----END CERTIFICATE-----
  45725. DigiCert Global Root CA
  45726. =======================
  45727. -----BEGIN CERTIFICATE-----
  45728. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  45729. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  45730. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  45731. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  45732. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  45733. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  45734. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  45735. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  45736. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  45737. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  45738. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  45739. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  45740. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  45741. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  45742. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  45743. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  45744. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  45745. -----END CERTIFICATE-----
  45746. DigiCert High Assurance EV Root CA
  45747. ==================================
  45748. -----BEGIN CERTIFICATE-----
  45749. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  45750. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  45751. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  45752. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  45753. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  45754. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  45755. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  45756. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  45757. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  45758. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  45759. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  45760. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  45761. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  45762. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  45763. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  45764. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  45765. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  45766. -----END CERTIFICATE-----
  45767. Certplus Class 2 Primary CA
  45768. ===========================
  45769. -----BEGIN CERTIFICATE-----
  45770. MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE
  45771. BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN
  45772. OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy
  45773. dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
  45774. ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR
  45775. 5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ
  45776. Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO
  45777. YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e
  45778. e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME
  45779. CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ
  45780. YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t
  45781. L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD
  45782. P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R
  45783. TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+
  45784. 7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW
  45785. //1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
  45786. l7+ijrRU
  45787. -----END CERTIFICATE-----
  45788. DST Root CA X3
  45789. ==============
  45790. -----BEGIN CERTIFICATE-----
  45791. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
  45792. ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
  45793. DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
  45794. cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
  45795. ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
  45796. rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
  45797. UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
  45798. xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
  45799. utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
  45800. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
  45801. MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
  45802. dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
  45803. GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
  45804. RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
  45805. fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  45806. -----END CERTIFICATE-----
  45807. DST ACES CA X6
  45808. ==============
  45809. -----BEGIN CERTIFICATE-----
  45810. MIIECTCCAvGgAwIBAgIQDV6ZCtadt3js2AdWO4YV2TANBgkqhkiG9w0BAQUFADBbMQswCQYDVQQG
  45811. EwJVUzEgMB4GA1UEChMXRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QxETAPBgNVBAsTCERTVCBBQ0VT
  45812. MRcwFQYDVQQDEw5EU1QgQUNFUyBDQSBYNjAeFw0wMzExMjAyMTE5NThaFw0xNzExMjAyMTE5NTha
  45813. MFsxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdDERMA8GA1UE
  45814. CxMIRFNUIEFDRVMxFzAVBgNVBAMTDkRTVCBBQ0VTIENBIFg2MIIBIjANBgkqhkiG9w0BAQEFAAOC
  45815. AQ8AMIIBCgKCAQEAuT31LMmU3HWKlV1j6IR3dma5WZFcRt2SPp/5DgO0PWGSvSMmtWPuktKe1jzI
  45816. DZBfZIGxqAgNTNj50wUoUrQBJcWVHAx+PhCEdc/BGZFjz+iokYi5Q1K7gLFViYsx+tC3dr5BPTCa
  45817. pCIlF3PoHuLTrCq9Wzgh1SpL11V94zpVvddtawJXa+ZHfAjIgrrep4c9oW24MFbCswKBXy314pow
  45818. GCi4ZtPLAZZv6opFVdbgnf9nKxcCpk4aahELfrd755jWjHZvwTvbUJN+5dCOHze4vbrGn2zpfDPy
  45819. MjwmR/onJALJfh1biEITajV8fTXpLmaRcpPVMibEdPVTo7NdmvYJywIDAQABo4HIMIHFMA8GA1Ud
  45820. EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgHGMB8GA1UdEQQYMBaBFHBraS1vcHNAdHJ1c3Rkc3Qu
  45821. Y29tMGIGA1UdIARbMFkwVwYKYIZIAWUDAgEBATBJMEcGCCsGAQUFBwIBFjtodHRwOi8vd3d3LnRy
  45822. dXN0ZHN0LmNvbS9jZXJ0aWZpY2F0ZXMvcG9saWN5L0FDRVMtaW5kZXguaHRtbDAdBgNVHQ4EFgQU
  45823. CXIGThhDD+XWzMNqizF7eI+og7gwDQYJKoZIhvcNAQEFBQADggEBAKPYjtay284F5zLNAdMEA+V2
  45824. 5FYrnJmQ6AgwbN99Pe7lv7UkQIRJ4dEorsTCOlMwiPH1d25Ryvr/ma8kXxug/fKshMrfqfBfBC6t
  45825. Fr8hlxCBPeP/h40y3JTlR4peahPJlJU90u7INJXQgNStMgiAVDzgvVJT11J8smk/f3rPanTK+gQq
  45826. nExaBqXpIK1FZg9p8d2/6eMyi/rgwYZNcjwu2JN4Cir42NInPRmJX1p7ijvMDNpRrscL9yuwNwXs
  45827. vFcj4jjSm2jzVhKIT0J8uDHEtdvkyCE06UgRNe76x5JXxZ805Mf29w4LTJxoeHtxMcfrHuBnQfO3
  45828. oKfN5XozNmr6mis=
  45829. -----END CERTIFICATE-----
  45830. SwissSign Gold CA - G2
  45831. ======================
  45832. -----BEGIN CERTIFICATE-----
  45833. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  45834. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  45835. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  45836. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  45837. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  45838. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  45839. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  45840. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  45841. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  45842. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  45843. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  45844. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  45845. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  45846. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  45847. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  45848. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  45849. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  45850. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  45851. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  45852. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  45853. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  45854. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  45855. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  45856. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  45857. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  45858. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  45859. -----END CERTIFICATE-----
  45860. SwissSign Silver CA - G2
  45861. ========================
  45862. -----BEGIN CERTIFICATE-----
  45863. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  45864. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  45865. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  45866. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  45867. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  45868. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  45869. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  45870. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  45871. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  45872. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  45873. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  45874. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  45875. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  45876. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  45877. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  45878. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  45879. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  45880. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  45881. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  45882. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  45883. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  45884. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  45885. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  45886. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  45887. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  45888. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  45889. -----END CERTIFICATE-----
  45890. GeoTrust Primary Certification Authority
  45891. ========================================
  45892. -----BEGIN CERTIFICATE-----
  45893. MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
  45894. EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
  45895. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
  45896. CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
  45897. cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  45898. CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
  45899. b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
  45900. nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
  45901. RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
  45902. tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  45903. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
  45904. hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
  45905. Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
  45906. NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
  45907. Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
  45908. 1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
  45909. -----END CERTIFICATE-----
  45910. thawte Primary Root CA
  45911. ======================
  45912. -----BEGIN CERTIFICATE-----
  45913. MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
  45914. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  45915. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  45916. cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
  45917. MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
  45918. SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
  45919. KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
  45920. FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
  45921. oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
  45922. 1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
  45923. q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
  45924. aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
  45925. afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
  45926. VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
  45927. AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
  45928. uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
  45929. xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
  45930. jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
  45931. z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
  45932. -----END CERTIFICATE-----
  45933. VeriSign Class 3 Public Primary Certification Authority - G5
  45934. ============================================================
  45935. -----BEGIN CERTIFICATE-----
  45936. MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
  45937. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  45938. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  45939. IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
  45940. ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
  45941. yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
  45942. biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
  45943. dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
  45944. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  45945. ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
  45946. j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
  45947. Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
  45948. Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
  45949. fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
  45950. BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
  45951. Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
  45952. aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
  45953. SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
  45954. X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
  45955. KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
  45956. Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
  45957. ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
  45958. -----END CERTIFICATE-----
  45959. SecureTrust CA
  45960. ==============
  45961. -----BEGIN CERTIFICATE-----
  45962. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  45963. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  45964. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  45965. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  45966. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  45967. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  45968. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  45969. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  45970. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  45971. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  45972. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  45973. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  45974. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  45975. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  45976. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  45977. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  45978. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  45979. -----END CERTIFICATE-----
  45980. Secure Global CA
  45981. ================
  45982. -----BEGIN CERTIFICATE-----
  45983. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  45984. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  45985. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  45986. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  45987. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  45988. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  45989. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  45990. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  45991. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  45992. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  45993. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  45994. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  45995. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  45996. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  45997. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  45998. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  45999. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  46000. -----END CERTIFICATE-----
  46001. COMODO Certification Authority
  46002. ==============================
  46003. -----BEGIN CERTIFICATE-----
  46004. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  46005. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  46006. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  46007. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  46008. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  46009. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  46010. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  46011. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  46012. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  46013. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  46014. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  46015. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  46016. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  46017. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  46018. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  46019. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  46020. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  46021. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  46022. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  46023. -----END CERTIFICATE-----
  46024. Network Solutions Certificate Authority
  46025. =======================================
  46026. -----BEGIN CERTIFICATE-----
  46027. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  46028. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  46029. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  46030. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  46031. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  46032. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  46033. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  46034. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  46035. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  46036. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  46037. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  46038. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  46039. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  46040. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  46041. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  46042. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  46043. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  46044. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  46045. -----END CERTIFICATE-----
  46046. WellsSecure Public Root Certificate Authority
  46047. =============================================
  46048. -----BEGIN CERTIFICATE-----
  46049. MIIEvTCCA6WgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoM
  46050. F1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYw
  46051. NAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcN
  46052. MDcxMjEzMTcwNzU0WhcNMjIxMjE0MDAwNzU0WjCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dl
  46053. bGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYD
  46054. VQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  46055. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDub7S9eeKPCCGeOARBJe+rWxxTkqxtnt3CxC5FlAM1
  46056. iGd0V+PfjLindo8796jE2yljDpFoNoqXjopxaAkH5OjUDk/41itMpBb570OYj7OeUt9tkTmPOL13
  46057. i0Nj67eT/DBMHAGTthP796EfvyXhdDcsHqRePGj4S78NuR4uNuip5Kf4D8uCdXw1LSLWwr8L87T8
  46058. bJVhHlfXBIEyg1J55oNjz7fLY4sR4r1e6/aN7ZVyKLSsEmLpSjPmgzKuBXWVvYSV2ypcm44uDLiB
  46059. K0HmOFafSZtsdvqKXfcBeYF8wYNABf5x/Qw/zE5gCQ5lRxAvAcAFP4/4s0HvWkJ+We/SlwxlAgMB
  46060. AAGjggE0MIIBMDAPBgNVHRMBAf8EBTADAQH/MDkGA1UdHwQyMDAwLqAsoCqGKGh0dHA6Ly9jcmwu
  46061. cGtpLndlbGxzZmFyZ28uY29tL3dzcHJjYS5jcmwwDgYDVR0PAQH/BAQDAgHGMB0GA1UdDgQWBBQm
  46062. lRkQ2eihl5H/3BnZtQQ+0nMKajCBsgYDVR0jBIGqMIGngBQmlRkQ2eihl5H/3BnZtQQ+0nMKaqGB
  46063. i6SBiDCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRww
  46064. GgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMg
  46065. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHmCAQEwDQYJKoZIhvcNAQEFBQADggEBALkVsUSRzCPI
  46066. K0134/iaeycNzXK7mQDKfGYZUMbVmO2rvwNa5U3lHshPcZeG1eMd/ZDJPHV3V3p9+N701NX3leZ0
  46067. bh08rnyd2wIDBSxxSyU+B+NemvVmFymIGjifz6pBA4SXa5M4esowRBskRDPQ5NHcKDj0E0M1NSlj
  46068. qHyita04pO2t/caaH/+Xc/77szWnk4bGdpEA5qxRFsQnMlzbc9qlk1eOPm01JghZ1edE13YgY+es
  46069. E2fDbbFwRnzVlhE9iW9dqKHrjQrawx0zbKPqZxmamX9LPYNRKh3KL4YMon4QLSvUFpULB6ouFJJJ
  46070. tylv2G0xffX8oRAHh84vWdw+WNs=
  46071. -----END CERTIFICATE-----
  46072. COMODO ECC Certification Authority
  46073. ==================================
  46074. -----BEGIN CERTIFICATE-----
  46075. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  46076. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  46077. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  46078. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  46079. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  46080. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  46081. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  46082. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  46083. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  46084. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  46085. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  46086. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  46087. -----END CERTIFICATE-----
  46088. IGC/A
  46089. =====
  46090. -----BEGIN CERTIFICATE-----
  46091. MIIEAjCCAuqgAwIBAgIFORFFEJQwDQYJKoZIhvcNAQEFBQAwgYUxCzAJBgNVBAYTAkZSMQ8wDQYD
  46092. VQQIEwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVE
  46093. Q1NTSTEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZy
  46094. MB4XDTAyMTIxMzE0MjkyM1oXDTIwMTAxNzE0MjkyMlowgYUxCzAJBgNVBAYTAkZSMQ8wDQYDVQQI
  46095. EwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVEQ1NT
  46096. STEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZyMIIB
  46097. IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsh/R0GLFMzvABIaIs9z4iPf930Pfeo2aSVz2
  46098. TqrMHLmh6yeJ8kbpO0px1R2OLc/mratjUMdUC24SyZA2xtgv2pGqaMVy/hcKshd+ebUyiHDKcMCW
  46099. So7kVc0dJ5S/znIq7Fz5cyD+vfcuiWe4u0dzEvfRNWk68gq5rv9GQkaiv6GFGvm/5P9JhfejcIYy
  46100. HF2fYPepraX/z9E0+X1bF8bc1g4oa8Ld8fUzaJ1O/Id8NhLWo4DoQw1VYZTqZDdH6nfK0LJYBcNd
  46101. frGoRpAxVs5wKpayMLh35nnAvSk7/ZR3TL0gzUEl4C7HG7vupARB0l2tEmqKm0f7yd1GQOGdPDPQ
  46102. tQIDAQABo3cwdTAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBRjAVBgNVHSAEDjAMMAoGCCqB
  46103. egF5AQEBMB0GA1UdDgQWBBSjBS8YYFDCiQrdKyFP/45OqDAxNjAfBgNVHSMEGDAWgBSjBS8YYFDC
  46104. iQrdKyFP/45OqDAxNjANBgkqhkiG9w0BAQUFAAOCAQEABdwm2Pp3FURo/C9mOnTgXeQp/wYHE4RK
  46105. q89toB9RlPhJy3Q2FLwV3duJL92PoF189RLrn544pEfMs5bZvpwlqwN+Mw+VgQ39FuCIvjfwbF3Q
  46106. MZsyK10XZZOYYLxuj7GoPB7ZHPOpJkL5ZB3C55L29B5aqhlSXa/oovdgoPaN8In1buAKBQGVyYsg
  46107. Crpa/JosPL3Dt8ldeCUFP1YUmwza+zpI/pdpXsoQhvdOlgQITeywvl3cO45Pwf2aNjSaTFR+FwNI
  46108. lQgRHAdvhQh+XU3Endv7rs6y0bO4g2wdsrN58dhwmX7wEwLOXt1R0982gaEbeC9xs/FZTEYYKKuF
  46109. 0mBWWg==
  46110. -----END CERTIFICATE-----
  46111. Security Communication EV RootCA1
  46112. =================================
  46113. -----BEGIN CERTIFICATE-----
  46114. MIIDfTCCAmWgAwIBAgIBADANBgkqhkiG9w0BAQUFADBgMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  46115. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEqMCgGA1UECxMhU2VjdXJpdHkgQ29tbXVuaWNh
  46116. dGlvbiBFViBSb290Q0ExMB4XDTA3MDYwNjAyMTIzMloXDTM3MDYwNjAyMTIzMlowYDELMAkGA1UE
  46117. BhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKjAoBgNVBAsTIVNl
  46118. Y3VyaXR5IENvbW11bmljYXRpb24gRVYgUm9vdENBMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  46119. AQoCggEBALx/7FebJOD+nLpCeamIivqA4PUHKUPqjgo0No0c+qe1OXj/l3X3L+SqawSERMqm4miO
  46120. /VVQYg+kcQ7OBzgtQoVQrTyWb4vVog7P3kmJPdZkLjjlHmy1V4qe70gOzXppFodEtZDkBp2uoQSX
  46121. WHnvIEqCa4wiv+wfD+mEce3xDuS4GBPMVjZd0ZoeUWs5bmB2iDQL87PRsJ3KYeJkHcFGB7hj3R4z
  46122. ZbOOCVVSPbW9/wfrrWFVGCypaZhKqkDFMxRldAD5kd6vA0jFQFTcD4SQaCDFkpbcLuUCRarAX1T4
  46123. bepJz11sS6/vmsJWXMY1VkJqMF/Cq/biPT+zyRGPMUzXn0kCAwEAAaNCMEAwHQYDVR0OBBYEFDVK
  46124. 9U2vP9eCOKyrcWUXdYydVZPmMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqG
  46125. SIb3DQEBBQUAA4IBAQCoh+ns+EBnXcPBZsdAS5f8hxOQWsTvoMpfi7ent/HWtWS3irO4G8za+6xm
  46126. iEHO6Pzk2x6Ipu0nUBsCMCRGef4Eh3CXQHPRwMFXGZpppSeZq51ihPZRwSzJIxXYKLerJRO1RuGG
  46127. Av8mjMSIkh1W/hln8lXkgKNrnKt34VFxDSDbEJrbvXZ5B3eZKK2aXtqxT0QsNY6llsf9g/BYxnnW
  46128. mHyojf6GPgcWkuF75x3sM3Z+Qi5KhfmRiWiEA4Glm5q+4zfFVKtWOxgtQaQM+ELbmaDgcm+7XeEW
  46129. T1MKZPlO9L9OVL14bIjqv5wTJMJwaaJ/D8g8rQjJsJhAoyrniIPtd490
  46130. -----END CERTIFICATE-----
  46131. OISTE WISeKey Global Root GA CA
  46132. ===============================
  46133. -----BEGIN CERTIFICATE-----
  46134. MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
  46135. BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
  46136. A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
  46137. bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
  46138. VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
  46139. IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
  46140. IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
  46141. Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
  46142. Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
  46143. d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
  46144. /yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
  46145. LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
  46146. AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  46147. KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
  46148. MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
  46149. +vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
  46150. hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
  46151. okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
  46152. -----END CERTIFICATE-----
  46153. Microsec e-Szigno Root CA
  46154. =========================
  46155. -----BEGIN CERTIFICATE-----
  46156. MIIHqDCCBpCgAwIBAgIRAMy4579OKRr9otxmpRwsDxEwDQYJKoZIhvcNAQEFBQAwcjELMAkGA1UE
  46157. BhMCSFUxETAPBgNVBAcTCEJ1ZGFwZXN0MRYwFAYDVQQKEw1NaWNyb3NlYyBMdGQuMRQwEgYDVQQL
  46158. EwtlLVN6aWdubyBDQTEiMCAGA1UEAxMZTWljcm9zZWMgZS1Temlnbm8gUm9vdCBDQTAeFw0wNTA0
  46159. MDYxMjI4NDRaFw0xNzA0MDYxMjI4NDRaMHIxCzAJBgNVBAYTAkhVMREwDwYDVQQHEwhCdWRhcGVz
  46160. dDEWMBQGA1UEChMNTWljcm9zZWMgTHRkLjEUMBIGA1UECxMLZS1Temlnbm8gQ0ExIjAgBgNVBAMT
  46161. GU1pY3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
  46162. AQDtyADVgXvNOABHzNuEwSFpLHSQDCHZU4ftPkNEU6+r+ICbPHiN1I2uuO/TEdyB5s87lozWbxXG
  46163. d36hL+BfkrYn13aaHUM86tnsL+4582pnS4uCzyL4ZVX+LMsvfUh6PXX5qqAnu3jCBspRwn5mS6/N
  46164. oqdNAoI/gqyFxuEPkEeZlApxcpMqyabAvjxWTHOSJ/FrtfX9/DAFYJLG65Z+AZHCabEeHXtTRbjc
  46165. QR/Ji3HWVBTji1R4P770Yjtb9aPs1ZJ04nQw7wHb4dSrmZsqa/i9phyGI0Jf7Enemotb9HI6QMVJ
  46166. PqW+jqpx62z69Rrkav17fVVA71hu5tnVvCSrwe+3AgMBAAGjggQ3MIIEMzBnBggrBgEFBQcBAQRb
  46167. MFkwKAYIKwYBBQUHMAGGHGh0dHBzOi8vcmNhLmUtc3ppZ25vLmh1L29jc3AwLQYIKwYBBQUHMAKG
  46168. IWh0dHA6Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNydDAPBgNVHRMBAf8EBTADAQH/MIIBcwYD
  46169. VR0gBIIBajCCAWYwggFiBgwrBgEEAYGoGAIBAQEwggFQMCgGCCsGAQUFBwIBFhxodHRwOi8vd3d3
  46170. LmUtc3ppZ25vLmh1L1NaU1ovMIIBIgYIKwYBBQUHAgIwggEUHoIBEABBACAAdABhAG4A+gBzAO0A
  46171. dAB2AOEAbgB5ACAA6QByAHQAZQBsAG0AZQB6AOkAcwDpAGgAZQB6ACAA6QBzACAAZQBsAGYAbwBn
  46172. AGEAZADhAHMA4QBoAG8AegAgAGEAIABTAHoAbwBsAGcA4QBsAHQAYQB0APMAIABTAHoAbwBsAGcA
  46173. 4QBsAHQAYQB0AOEAcwBpACAAUwB6AGEAYgDhAGwAeQB6AGEAdABhACAAcwB6AGUAcgBpAG4AdAAg
  46174. AGsAZQBsAGwAIABlAGwAagDhAHIAbgBpADoAIABoAHQAdABwADoALwAvAHcAdwB3AC4AZQAtAHMA
  46175. egBpAGcAbgBvAC4AaAB1AC8AUwBaAFMAWgAvMIHIBgNVHR8EgcAwgb0wgbqggbeggbSGIWh0dHA6
  46176. Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNybIaBjmxkYXA6Ly9sZGFwLmUtc3ppZ25vLmh1L0NO
  46177. PU1pY3Jvc2VjJTIwZS1Temlnbm8lMjBSb290JTIwQ0EsT1U9ZS1Temlnbm8lMjBDQSxPPU1pY3Jv
  46178. c2VjJTIwTHRkLixMPUJ1ZGFwZXN0LEM9SFU/Y2VydGlmaWNhdGVSZXZvY2F0aW9uTGlzdDtiaW5h
  46179. cnkwDgYDVR0PAQH/BAQDAgEGMIGWBgNVHREEgY4wgYuBEGluZm9AZS1zemlnbm8uaHWkdzB1MSMw
  46180. IQYDVQQDDBpNaWNyb3NlYyBlLVN6aWduw7MgUm9vdCBDQTEWMBQGA1UECwwNZS1TemlnbsOzIEhT
  46181. WjEWMBQGA1UEChMNTWljcm9zZWMgS2Z0LjERMA8GA1UEBxMIQnVkYXBlc3QxCzAJBgNVBAYTAkhV
  46182. MIGsBgNVHSMEgaQwgaGAFMegSXUWYYTbMUuE0vE3QJDvTtz3oXakdDByMQswCQYDVQQGEwJIVTER
  46183. MA8GA1UEBxMIQnVkYXBlc3QxFjAUBgNVBAoTDU1pY3Jvc2VjIEx0ZC4xFDASBgNVBAsTC2UtU3pp
  46184. Z25vIENBMSIwIAYDVQQDExlNaWNyb3NlYyBlLVN6aWdubyBSb290IENBghEAzLjnv04pGv2i3Gal
  46185. HCwPETAdBgNVHQ4EFgQUx6BJdRZhhNsxS4TS8TdAkO9O3PcwDQYJKoZIhvcNAQEFBQADggEBANMT
  46186. nGZjWS7KXHAM/IO8VbH0jgdsZifOwTsgqRy7RlRw7lrMoHfqaEQn6/Ip3Xep1fvj1KcExJW4C+FE
  46187. aGAHQzAxQmHl7tnlJNUb3+FKG6qfx1/4ehHqE5MAyopYse7tDk2016g2JnzgOsHVV4Lxdbb9iV/a
  46188. 86g4nzUGCM4ilb7N1fy+W955a9x6qWVmvrElWl/tftOsRm1M9DKHtCAE4Gx4sHfRhUZLphK3dehK
  46189. yVZs15KrnfVJONJPU+NVkBHbmJbGSfI+9J8b4PeI3CVimUTYc78/MPMMNz7UwiiAc7EBt51alhQB
  46190. S6kRnSlqLtBdgcDPsiBDxwPgN05dCtxZICU=
  46191. -----END CERTIFICATE-----
  46192. Certigna
  46193. ========
  46194. -----BEGIN CERTIFICATE-----
  46195. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  46196. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  46197. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  46198. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  46199. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  46200. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  46201. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  46202. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  46203. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  46204. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  46205. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  46206. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  46207. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  46208. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  46209. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  46210. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  46211. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  46212. -----END CERTIFICATE-----
  46213. Deutsche Telekom Root CA 2
  46214. ==========================
  46215. -----BEGIN CERTIFICATE-----
  46216. MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT
  46217. RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG
  46218. A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5
  46219. MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G
  46220. A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS
  46221. b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5
  46222. bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI
  46223. KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY
  46224. AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK
  46225. Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV
  46226. jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV
  46227. HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr
  46228. E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy
  46229. zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8
  46230. rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G
  46231. dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
  46232. Cm26OWMohpLzGITY+9HPBVZkVw==
  46233. -----END CERTIFICATE-----
  46234. Cybertrust Global Root
  46235. ======================
  46236. -----BEGIN CERTIFICATE-----
  46237. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  46238. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  46239. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  46240. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  46241. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  46242. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  46243. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  46244. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  46245. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  46246. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  46247. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  46248. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  46249. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  46250. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  46251. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  46252. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  46253. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  46254. -----END CERTIFICATE-----
  46255. ePKI Root Certification Authority
  46256. =================================
  46257. -----BEGIN CERTIFICATE-----
  46258. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  46259. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  46260. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  46261. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  46262. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  46263. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  46264. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  46265. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  46266. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  46267. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  46268. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  46269. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  46270. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  46271. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  46272. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  46273. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  46274. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  46275. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  46276. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  46277. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  46278. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  46279. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  46280. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  46281. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  46282. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  46283. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  46284. -----END CERTIFICATE-----
  46285. T\xc3\x9c\x42\xC4\xB0TAK UEKAE K\xC3\xB6k Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1 - S\xC3\xBCr\xC3\xBCm 3
  46286. =============================================================================================================================
  46287. -----BEGIN CERTIFICATE-----
  46288. MIIFFzCCA/+gAwIBAgIBETANBgkqhkiG9w0BAQUFADCCASsxCzAJBgNVBAYTAlRSMRgwFgYDVQQH
  46289. DA9HZWJ6ZSAtIEtvY2FlbGkxRzBFBgNVBAoMPlTDvHJraXllIEJpbGltc2VsIHZlIFRla25vbG9q
  46290. aWsgQXJhxZ90xLFybWEgS3VydW11IC0gVMOcQsSwVEFLMUgwRgYDVQQLDD9VbHVzYWwgRWxla3Ry
  46291. b25payB2ZSBLcmlwdG9sb2ppIEFyYcWfdMSxcm1hIEVuc3RpdMO8c8O8IC0gVUVLQUUxIzAhBgNV
  46292. BAsMGkthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppMUowSAYDVQQDDEFUw5xCxLBUQUsgVUVLQUUg
  46293. S8O2ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSAtIFPDvHLDvG0gMzAeFw0wNzA4
  46294. MjQxMTM3MDdaFw0xNzA4MjExMTM3MDdaMIIBKzELMAkGA1UEBhMCVFIxGDAWBgNVBAcMD0dlYnpl
  46295. IC0gS29jYWVsaTFHMEUGA1UECgw+VMO8cmtpeWUgQmlsaW1zZWwgdmUgVGVrbm9sb2ppayBBcmHF
  46296. n3TEsXJtYSBLdXJ1bXUgLSBUw5xCxLBUQUsxSDBGBgNVBAsMP1VsdXNhbCBFbGVrdHJvbmlrIHZl
  46297. IEtyaXB0b2xvamkgQXJhxZ90xLFybWEgRW5zdGl0w7xzw7wgLSBVRUtBRTEjMCEGA1UECwwaS2Ft
  46298. dSBTZXJ0aWZpa2FzeW9uIE1lcmtlemkxSjBIBgNVBAMMQVTDnELEsFRBSyBVRUtBRSBLw7ZrIFNl
  46299. cnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIC0gU8O8csO8bSAzMIIBIjANBgkqhkiG9w0B
  46300. AQEFAAOCAQ8AMIIBCgKCAQEAim1L/xCIOsP2fpTo6iBkcK4hgb46ezzb8R1Sf1n68yJMlaCQvEhO
  46301. Eav7t7WNeoMojCZG2E6VQIdhn8WebYGHV2yKO7Rm6sxA/OOqbLLLAdsyv9Lrhc+hDVXDWzhXcLh1
  46302. xnnRFDDtG1hba+818qEhTsXOfJlfbLm4IpNQp81McGq+agV/E5wrHur+R84EpW+sky58K5+eeROR
  46303. 6Oqeyjh1jmKwlZMq5d/pXpduIF9fhHpEORlAHLpVK/swsoHvhOPc7Jg4OQOFCKlUAwUp8MmPi+oL
  46304. hmUZEdPpCSPeaJMDyTYcIW7OjGbxmTDY17PDHfiBLqi9ggtm/oLL4eAagsNAgQIDAQABo0IwQDAd
  46305. BgNVHQ4EFgQUvYiHyY/2pAoLquvF/pEjnatKijIwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  46306. MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAB18+kmPNOm3JpIWmgV050vQbTlswyb2zrgxvMTfvCr4
  46307. N5EY3ATIZJkrGG2AA1nJrvhY0D7twyOfaTyGOBye79oneNGEN3GKPEs5z35FBtYt2IpNeBLWrcLT
  46308. y9LQQfMmNkqblWwM7uXRQydmwYj3erMgbOqwaSvHIOgMA8RBBZniP+Rr+KCGgceExh/VS4ESshYh
  46309. LBOhgLJeDEoTniDYYkCrkOpkSi+sDQESeUWoL4cZaMjihccwsnX5OD+ywJO0a+IDRM5noN+J1q2M
  46310. dqMTw5RhK2vZbMEHCiIHhWyFJEapvj+LeISCfiQMnf2BN+MlqO02TpUsyZyQ2uypQjyttgI=
  46311. -----END CERTIFICATE-----
  46312. Buypass Class 2 CA 1
  46313. ====================
  46314. -----BEGIN CERTIFICATE-----
  46315. MIIDUzCCAjugAwIBAgIBATANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  46316. QnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3MgQ2xhc3MgMiBDQSAxMB4XDTA2
  46317. MTAxMzEwMjUwOVoXDTE2MTAxMzEwMjUwOVowSzELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBh
  46318. c3MgQVMtOTgzMTYzMzI3MR0wGwYDVQQDDBRCdXlwYXNzIENsYXNzIDIgQ0EgMTCCASIwDQYJKoZI
  46319. hvcNAQEBBQADggEPADCCAQoCggEBAIs8B0XY9t/mx8q6jUPFR42wWsE425KEHK8T1A9vNkYgxC7M
  46320. cXA0ojTTNy7Y3Tp3L8DrKehc0rWpkTSHIln+zNvnma+WwajHQN2lFYxuyHyXA8vmIPLXl18xoS83
  46321. 0r7uvqmtqEyeIWZDO6i88wmjONVZJMHCR3axiFyCO7srpgTXjAePzdVBHfCuuCkslFJgNJQ72uA4
  46322. 0Z0zPhX0kzLFANq1KWYOOngPIVJfAuWSeyXTkh4vFZ2B5J2O6O+JzhRMVB0cgRJNcKi+EAUXfh/R
  46323. uFdV7c27UsKwHnjCTTZoy1YmwVLBvXb3WNVyfh9EdrsAiR0WnVE1703CVu9r4Iw7DekCAwEAAaNC
  46324. MEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUP42aWYv8e3uco684sDntkHGA1sgwDgYDVR0P
  46325. AQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAVGn4TirnoB6NLJzKyQJHyIdFkhb5jatLPgcIV
  46326. 1Xp+DCmsNx4cfHZSldq1fyOhKXdlyTKdqC5Wq2B2zha0jX94wNWZUYN/Xtm+DKhQ7SLHrQVMdvvt
  46327. 7h5HZPb3J31cKA9FxVxiXqaakZG3Uxcu3K1gnZZkOb1naLKuBctN518fV4bVIJwo+28TOPX2EZL2
  46328. fZleHwzoq0QkKXJAPTZSr4xYkHPB7GEseaHsh7U/2k3ZIQAw3pDaDtMaSKk+hQsUi4y8QZ5q9w5w
  46329. wDX3OaJdZtB7WZ+oRxKaJyOkLY4ng5IgodcVf/EuGO70SH8vf/GhGLWhC5SgYiAynB321O+/TIho
  46330. -----END CERTIFICATE-----
  46331. EBG Elektronik Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1
  46332. ==========================================================================
  46333. -----BEGIN CERTIFICATE-----
  46334. MIIF5zCCA8+gAwIBAgIITK9zQhyOdAIwDQYJKoZIhvcNAQEFBQAwgYAxODA2BgNVBAMML0VCRyBF
  46335. bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMTcwNQYDVQQKDC5FQkcg
  46336. QmlsacWfaW0gVGVrbm9sb2ppbGVyaSB2ZSBIaXptZXRsZXJpIEEuxZ4uMQswCQYDVQQGEwJUUjAe
  46337. Fw0wNjA4MTcwMDIxMDlaFw0xNjA4MTQwMDMxMDlaMIGAMTgwNgYDVQQDDC9FQkcgRWxla3Ryb25p
  46338. ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTE3MDUGA1UECgwuRUJHIEJpbGnFn2lt
  46339. IFRla25vbG9qaWxlcmkgdmUgSGl6bWV0bGVyaSBBLsWeLjELMAkGA1UEBhMCVFIwggIiMA0GCSqG
  46340. SIb3DQEBAQUAA4ICDwAwggIKAoICAQDuoIRh0DpqZhAy2DE4f6en5f2h4fuXd7hxlugTlkaDT7by
  46341. X3JWbhNgpQGR4lvFzVcfd2NR/y8927k/qqk153nQ9dAktiHq6yOU/im/+4mRDGSaBUorzAzu8T2b
  46342. gmmkTPiab+ci2hC6X5L8GCcKqKpE+i4stPtGmggDg3KriORqcsnlZR9uKg+ds+g75AxuetpX/dfr
  46343. eYteIAbTdgtsApWjluTLdlHRKJ2hGvxEok3MenaoDT2/F08iiFD9rrbskFBKW5+VQarKD7JK/oCZ
  46344. TqNGFav4c0JqwmZ2sQomFd2TkuzbqV9UIlKRcF0T6kjsbgNs2d1s/OsNA/+mgxKb8amTD8UmTDGy
  46345. Y5lhcucqZJnSuOl14nypqZoaqsNW2xCaPINStnuWt6yHd6i58mcLlEOzrz5z+kI2sSXFCjEmN1Zn
  46346. uqMLfdb3ic1nobc6HmZP9qBVFCVMLDMNpkGMvQQxahByCp0OLna9XvNRiYuoP1Vzv9s6xiQFlpJI
  46347. qkuNKgPlV5EQ9GooFW5Hd4RcUXSfGenmHmMWOeMRFeNYGkS9y8RsZteEBt8w9DeiQyJ50hBs37vm
  46348. ExH8nYQKE3vwO9D8owrXieqWfo1IhR5kX9tUoqzVegJ5a9KK8GfaZXINFHDk6Y54jzJ0fFfy1tb0
  46349. Nokb+Clsi7n2l9GkLqq+CxnCRelwXQIDAJ3Zo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  46350. /wQEAwIBBjAdBgNVHQ4EFgQU587GT/wWZ5b6SqMHwQSny2re2kcwHwYDVR0jBBgwFoAU587GT/wW
  46351. Z5b6SqMHwQSny2re2kcwDQYJKoZIhvcNAQEFBQADggIBAJuYml2+8ygjdsZs93/mQJ7ANtyVDR2t
  46352. FcU22NU57/IeIl6zgrRdu0waypIN30ckHrMk2pGI6YNw3ZPX6bqz3xZaPt7gyPvT/Wwp+BVGoGgm
  46353. zJNSroIBk5DKd8pNSe/iWtkqvTDOTLKBtjDOWU/aWR1qeqRFsIImgYZ29fUQALjuswnoT4cCB64k
  46354. XPBfrAowzIpAoHMEwfuJJPaaHFy3PApnNgUIMbOv2AFoKuB4j3TeuFGkjGwgPaL7s9QJ/XvCgKqT
  46355. bCmYIai7FvOpEl90tYeY8pUm3zTvilORiF0alKM/fCL414i6poyWqD1SNGKfAB5UVUJnxk1Gj7sU
  46356. RT0KlhaOEKGXmdXTMIXM3rRyt7yKPBgpaP3ccQfuJDlq+u2lrDgv+R4QDgZxGhBM/nV+/x5XOULK
  46357. 1+EVoVZVWRvRo68R2E7DpSvvkL/A7IITW43WciyTTo9qKd+FPNMN4KIYEsxVL0e3p5sC/kH2iExt
  46358. 2qkBR4NkJ2IQgtYSe14DHzSpyZH+r11thie3I6p1GMog57AP14kOpmciY/SDQSsGS7tY1dHXt7kQ
  46359. Y9iJSrSq3RZj9W6+YKH47ejWkE8axsWgKdOnIaj1Wjz3x0miIZpKlVIglnKaZsv30oZDfCK+lvm9
  46360. AahH3eU7QPl1K5srRmSGjR70j/sHd9DqSaIcjVIUpgqT
  46361. -----END CERTIFICATE-----
  46362. certSIGN ROOT CA
  46363. ================
  46364. -----BEGIN CERTIFICATE-----
  46365. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  46366. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  46367. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  46368. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  46369. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  46370. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  46371. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  46372. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  46373. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  46374. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  46375. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  46376. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  46377. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  46378. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  46379. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  46380. -----END CERTIFICATE-----
  46381. CNNIC ROOT
  46382. ==========
  46383. -----BEGIN CERTIFICATE-----
  46384. MIIDVTCCAj2gAwIBAgIESTMAATANBgkqhkiG9w0BAQUFADAyMQswCQYDVQQGEwJDTjEOMAwGA1UE
  46385. ChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1QwHhcNMDcwNDE2MDcwOTE0WhcNMjcwNDE2MDcw
  46386. OTE0WjAyMQswCQYDVQQGEwJDTjEOMAwGA1UEChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1Qw
  46387. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDTNfc/c3et6FtzF8LRb+1VvG7q6KR5smzD
  46388. o+/hn7E7SIX1mlwhIhAsxYLO2uOabjfhhyzcuQxauohV3/2q2x8x6gHx3zkBwRP9SFIhxFXf2tiz
  46389. VHa6dLG3fdfA6PZZxU3Iva0fFNrfWEQlMhkqx35+jq44sDB7R3IJMfAw28Mbdim7aXZOV/kbZKKT
  46390. VrdvmW7bCgScEeOAH8tjlBAKqeFkgjH5jCftppkA9nCTGPihNIaj3XrCGHn2emU1z5DrvTOTn1Or
  46391. czvmmzQgLx3vqR1jGqCA2wMv+SYahtKNu6m+UjqHZ0gNv7Sg2Ca+I19zN38m5pIEo3/PIKe38zrK
  46392. y5nLAgMBAAGjczBxMBEGCWCGSAGG+EIBAQQEAwIABzAfBgNVHSMEGDAWgBRl8jGtKvf33VKWCscC
  46393. wQ7vptU7ETAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIB/jAdBgNVHQ4EFgQUZfIxrSr3991S
  46394. lgrHAsEO76bVOxEwDQYJKoZIhvcNAQEFBQADggEBAEs17szkrr/Dbq2flTtLP1se31cpolnKOOK5
  46395. Gv+e5m4y3R6u6jW39ZORTtpC4cMXYFDy0VwmuYK36m3knITnA3kXr5g9lNvHugDnuL8BV8F3RTIM
  46396. O/G0HAiw/VGgod2aHRM2mm23xzy54cXZF/qD1T0VoDy7HgviyJA/qIYM/PmLXoXLT1tLYhFHxUV8
  46397. BS9BsZ4QaRuZluBVeftOhpm4lNqGOGqTo+fLbuXf6iFViZx9fX+Y9QCJ7uOEwFyWtcVG6kbghVW2
  46398. G8kS1sHNzYDzAgE8yGnLRUhj2JTQ7IUOO04RZfSCjKY9ri4ilAnIXOo8gV0WKgOXFlUJ24pBgp5m
  46399. mxE=
  46400. -----END CERTIFICATE-----
  46401. ApplicationCA - Japanese Government
  46402. ===================================
  46403. -----BEGIN CERTIFICATE-----
  46404. MIIDoDCCAoigAwIBAgIBMTANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJKUDEcMBoGA1UEChMT
  46405. SmFwYW5lc2UgR292ZXJubWVudDEWMBQGA1UECxMNQXBwbGljYXRpb25DQTAeFw0wNzEyMTIxNTAw
  46406. MDBaFw0xNzEyMTIxNTAwMDBaMEMxCzAJBgNVBAYTAkpQMRwwGgYDVQQKExNKYXBhbmVzZSBHb3Zl
  46407. cm5tZW50MRYwFAYDVQQLEw1BcHBsaWNhdGlvbkNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  46408. CgKCAQEAp23gdE6Hj6UG3mii24aZS2QNcfAKBZuOquHMLtJqO8F6tJdhjYq+xpqcBrSGUeQ3DnR4
  46409. fl+Kf5Sk10cI/VBaVuRorChzoHvpfxiSQE8tnfWuREhzNgaeZCw7NCPbXCbkcXmP1G55IrmTwcrN
  46410. wVbtiGrXoDkhBFcsovW8R0FPXjQilbUfKW1eSvNNcr5BViCH/OlQR9cwFO5cjFW6WY2H/CPek9AE
  46411. jP3vbb3QesmlOmpyM8ZKDQUXKi17safY1vC+9D/qDihtQWEjdnjDuGWk81quzMKq2edY3rZ+nYVu
  46412. nyoKb58DKTCXKB28t89UKU5RMfkntigm/qJj5kEW8DOYRwIDAQABo4GeMIGbMB0GA1UdDgQWBBRU
  46413. WssmP3HMlEYNllPqa0jQk/5CdTAOBgNVHQ8BAf8EBAMCAQYwWQYDVR0RBFIwUKROMEwxCzAJBgNV
  46414. BAYTAkpQMRgwFgYDVQQKDA/ml6XmnKzlm73mlL/lupwxIzAhBgNVBAsMGuOCouODl+ODquOCseOD
  46415. vOOCt+ODp+ODs0NBMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADlqRHZ3ODrs
  46416. o2dGD/mLBqj7apAxzn7s2tGJfHrrLgy9mTLnsCTWw//1sogJhyzjVOGjprIIC8CFqMjSnHH2HZ9g
  46417. /DgzE+Ge3Atf2hZQKXsvcJEPmbo0NI2VdMV+eKlmXb3KIXdCEKxmJj3ekav9FfBv7WxfEPjzFvYD
  46418. io+nEhEMy/0/ecGc/WLuo89UDNErXxc+4z6/wCs+CZv+iKZ+tJIX/COUgb1up8WMwusRRdv4QcmW
  46419. dupwX3kSa+SjB1oF7ydJzyGfikwJcGapJsErEU4z0g781mzSDjJkaP+tBXhfAx2o45CsJOAPQKdL
  46420. rosot4LKGAfmt1t06SAZf7IbiVQ=
  46421. -----END CERTIFICATE-----
  46422. GeoTrust Primary Certification Authority - G3
  46423. =============================================
  46424. -----BEGIN CERTIFICATE-----
  46425. MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
  46426. BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
  46427. IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
  46428. eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
  46429. NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
  46430. YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
  46431. LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
  46432. hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
  46433. K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
  46434. c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
  46435. IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
  46436. dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
  46437. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
  46438. 2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
  46439. cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
  46440. Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
  46441. AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
  46442. t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
  46443. -----END CERTIFICATE-----
  46444. thawte Primary Root CA - G2
  46445. ===========================
  46446. -----BEGIN CERTIFICATE-----
  46447. MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
  46448. VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
  46449. IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
  46450. Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
  46451. MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
  46452. b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
  46453. IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
  46454. LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
  46455. 8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
  46456. mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
  46457. G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
  46458. rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
  46459. -----END CERTIFICATE-----
  46460. thawte Primary Root CA - G3
  46461. ===========================
  46462. -----BEGIN CERTIFICATE-----
  46463. MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
  46464. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  46465. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  46466. cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
  46467. ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
  46468. d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
  46469. VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
  46470. A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  46471. MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
  46472. P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
  46473. +BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
  46474. 7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
  46475. vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
  46476. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
  46477. KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
  46478. A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
  46479. t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
  46480. 8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
  46481. er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
  46482. -----END CERTIFICATE-----
  46483. GeoTrust Primary Certification Authority - G2
  46484. =============================================
  46485. -----BEGIN CERTIFICATE-----
  46486. MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
  46487. VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
  46488. Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
  46489. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
  46490. OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
  46491. MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
  46492. b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
  46493. BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
  46494. KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
  46495. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
  46496. EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
  46497. ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
  46498. npaqBA+K
  46499. -----END CERTIFICATE-----
  46500. VeriSign Universal Root Certification Authority
  46501. ===============================================
  46502. -----BEGIN CERTIFICATE-----
  46503. MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
  46504. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  46505. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  46506. IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
  46507. IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
  46508. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  46509. cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  46510. IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
  46511. aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
  46512. 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
  46513. MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
  46514. 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
  46515. AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
  46516. tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
  46517. CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
  46518. a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
  46519. DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
  46520. Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
  46521. Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
  46522. P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
  46523. wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
  46524. mJO37M2CYfE45k+XmCpajQ==
  46525. -----END CERTIFICATE-----
  46526. VeriSign Class 3 Public Primary Certification Authority - G4
  46527. ============================================================
  46528. -----BEGIN CERTIFICATE-----
  46529. MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
  46530. VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
  46531. b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
  46532. ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
  46533. YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
  46534. MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
  46535. cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
  46536. b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
  46537. IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
  46538. Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
  46539. rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
  46540. /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
  46541. HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
  46542. Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
  46543. A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
  46544. AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
  46545. -----END CERTIFICATE-----
  46546. NetLock Arany (Class Gold) Főtanúsítvány
  46547. ============================================
  46548. -----BEGIN CERTIFICATE-----
  46549. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  46550. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  46551. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  46552. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  46553. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  46554. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  46555. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  46556. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  46557. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  46558. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  46559. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  46560. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  46561. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  46562. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  46563. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  46564. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  46565. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  46566. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  46567. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  46568. -----END CERTIFICATE-----
  46569. Staat der Nederlanden Root CA - G2
  46570. ==================================
  46571. -----BEGIN CERTIFICATE-----
  46572. MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  46573. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  46574. Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
  46575. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  46576. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
  46577. 5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
  46578. vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
  46579. CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
  46580. e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
  46581. OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
  46582. CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
  46583. 48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
  46584. trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
  46585. qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
  46586. AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
  46587. ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
  46588. HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
  46589. A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
  46590. +51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
  46591. f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
  46592. kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
  46593. CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
  46594. URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
  46595. CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
  46596. oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
  46597. IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
  46598. 66+KAQ==
  46599. -----END CERTIFICATE-----
  46600. Juur-SK
  46601. =======
  46602. -----BEGIN CERTIFICATE-----
  46603. MIIE5jCCA86gAwIBAgIEO45L/DANBgkqhkiG9w0BAQUFADBdMRgwFgYJKoZIhvcNAQkBFglwa2lA
  46604. c2suZWUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKExlBUyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMRAw
  46605. DgYDVQQDEwdKdXVyLVNLMB4XDTAxMDgzMDE0MjMwMVoXDTE2MDgyNjE0MjMwMVowXTEYMBYGCSqG
  46606. SIb3DQEJARYJcGtpQHNrLmVlMQswCQYDVQQGEwJFRTEiMCAGA1UEChMZQVMgU2VydGlmaXRzZWVy
  46607. aW1pc2tlc2t1czEQMA4GA1UEAxMHSnV1ci1TSzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  46608. ggEBAIFxNj4zB9bjMI0TfncyRsvPGbJgMUaXhvSYRqTCZUXP00B841oiqBB4M8yIsdOBSvZiF3tf
  46609. TQou0M+LI+5PAk676w7KvRhj6IAcjeEcjT3g/1tf6mTll+g/mX8MCgkzABpTpyHhOEvWgxutr2TC
  46610. +Rx6jGZITWYfGAriPrsfB2WThbkasLnE+w0R9vXW+RvHLCu3GFH+4Hv2qEivbDtPL+/40UceJlfw
  46611. UR0zlv/vWT3aTdEVNMfqPxZIe5EcgEMPPbgFPtGzlc3Yyg/CQ2fbt5PgIoIuvvVoKIO5wTtpeyDa
  46612. Tpxt4brNj3pssAki14sL2xzVWiZbDcDq5WDQn/413z8CAwEAAaOCAawwggGoMA8GA1UdEwEB/wQF
  46613. MAMBAf8wggEWBgNVHSAEggENMIIBCTCCAQUGCisGAQQBzh8BAQEwgfYwgdAGCCsGAQUFBwICMIHD
  46614. HoHAAFMAZQBlACAAcwBlAHIAdABpAGYAaQBrAGEAYQB0ACAAbwBuACAAdgDkAGwAagBhAHMAdABh
  46615. AHQAdQBkACAAQQBTAC0AaQBzACAAUwBlAHIAdABpAGYAaQB0AHMAZQBlAHIAaQBtAGkAcwBrAGUA
  46616. cwBrAHUAcwAgAGEAbABhAG0ALQBTAEsAIABzAGUAcgB0AGkAZgBpAGsAYQBhAHQAaQBkAGUAIABr
  46617. AGkAbgBuAGkAdABhAG0AaQBzAGUAawBzMCEGCCsGAQUFBwIBFhVodHRwOi8vd3d3LnNrLmVlL2Nw
  46618. cy8wKwYDVR0fBCQwIjAgoB6gHIYaaHR0cDovL3d3dy5zay5lZS9qdXVyL2NybC8wHQYDVR0OBBYE
  46619. FASqekej5ImvGs8KQKcYP2/v6X2+MB8GA1UdIwQYMBaAFASqekej5ImvGs8KQKcYP2/v6X2+MA4G
  46620. A1UdDwEB/wQEAwIB5jANBgkqhkiG9w0BAQUFAAOCAQEAe8EYlFOiCfP+JmeaUOTDBS8rNXiRTHyo
  46621. ERF5TElZrMj3hWVcRrs7EKACr81Ptcw2Kuxd/u+gkcm2k298gFTsxwhwDY77guwqYHhpNjbRxZyL
  46622. abVAyJRld/JXIWY7zoVAtjNjGr95HvxcHdMdkxuLDF2FvZkwMhgJkVLpfKG6/2SSmuz+Ne6ML678
  46623. IIbsSt4beDI3poHSna9aEhbKmVv8b20OxaAehsmR0FyYgl9jDIpaq9iVpszLita/ZEuOyoqysOkh
  46624. Mp6qqIWYNIE5ITuoOlIyPfZrN4YGWhWY3PARZv40ILcD9EEQfTmEeZZyY7aWAuVrua0ZTbvGRNs2
  46625. yyqcjg==
  46626. -----END CERTIFICATE-----
  46627. Hongkong Post Root CA 1
  46628. =======================
  46629. -----BEGIN CERTIFICATE-----
  46630. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  46631. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  46632. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  46633. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  46634. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  46635. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  46636. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  46637. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  46638. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  46639. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  46640. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  46641. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  46642. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  46643. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  46644. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  46645. -----END CERTIFICATE-----
  46646. SecureSign RootCA11
  46647. ===================
  46648. -----BEGIN CERTIFICATE-----
  46649. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  46650. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  46651. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  46652. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  46653. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  46654. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  46655. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  46656. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  46657. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  46658. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  46659. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  46660. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  46661. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  46662. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  46663. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  46664. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  46665. -----END CERTIFICATE-----
  46666. ACEDICOM Root
  46667. =============
  46668. -----BEGIN CERTIFICATE-----
  46669. MIIFtTCCA52gAwIBAgIIYY3HhjsBggUwDQYJKoZIhvcNAQEFBQAwRDEWMBQGA1UEAwwNQUNFRElD
  46670. T00gUm9vdDEMMAoGA1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMB4XDTA4
  46671. MDQxODE2MjQyMloXDTI4MDQxMzE2MjQyMlowRDEWMBQGA1UEAwwNQUNFRElDT00gUm9vdDEMMAoG
  46672. A1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMIICIjANBgkqhkiG9w0BAQEF
  46673. AAOCAg8AMIICCgKCAgEA/5KV4WgGdrQsyFhIyv2AVClVYyT/kGWbEHV7w2rbYgIB8hiGtXxaOLHk
  46674. WLn709gtn70yN78sFW2+tfQh0hOR2QetAQXW8713zl9CgQr5auODAKgrLlUTY4HKRxx7XBZXehuD
  46675. YAQ6PmXDzQHe3qTWDLqO3tkE7hdWIpuPY/1NFgu3e3eM+SW10W2ZEi5PGrjm6gSSrj0RuVFCPYew
  46676. MYWveVqc/udOXpJPQ/yrOq2lEiZmueIM15jO1FillUAKt0SdE3QrwqXrIhWYENiLxQSfHY9g5QYb
  46677. m8+5eaA9oiM/Qj9r+hwDezCNzmzAv+YbX79nuIQZ1RXve8uQNjFiybwCq0Zfm/4aaJQ0PZCOrfbk
  46678. HQl/Sog4P75n/TSW9R28MHTLOO7VbKvU/PQAtwBbhTIWdjPp2KOZnQUAqhbm84F9b32qhm2tFXTT
  46679. xKJxqvQUfecyuB+81fFOvW8XAjnXDpVCOscAPukmYxHqC9FK/xidstd7LzrZlvvoHpKuE1XI2Sf2
  46680. 3EgbsCTBheN3nZqk8wwRHQ3ItBTutYJXCb8gWH8vIiPYcMt5bMlL8qkqyPyHK9caUPgn6C9D4zq9
  46681. 2Fdx/c6mUlv53U3t5fZvie27k5x2IXXwkkwp9y+cAS7+UEaeZAwUswdbxcJzbPEHXEUkFDWug/Fq
  46682. TYl6+rPYLWbwNof1K1MCAwEAAaOBqjCBpzAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKaz
  46683. 4SsrSbbXc6GqlPUB53NlTKxQMA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUprPhKytJttdzoaqU
  46684. 9QHnc2VMrFAwRAYDVR0gBD0wOzA5BgRVHSAAMDEwLwYIKwYBBQUHAgEWI2h0dHA6Ly9hY2VkaWNv
  46685. bS5lZGljb21ncm91cC5jb20vZG9jMA0GCSqGSIb3DQEBBQUAA4ICAQDOLAtSUWImfQwng4/F9tqg
  46686. aHtPkl7qpHMyEVNEskTLnewPeUKzEKbHDZ3Ltvo/Onzqv4hTGzz3gvoFNTPhNahXwOf9jU8/kzJP
  46687. eGYDdwdY6ZXIfj7QeQCM8htRM5u8lOk6e25SLTKeI6RF+7YuE7CLGLHdztUdp0J/Vb77W7tH1Pwk
  46688. zQSulgUV1qzOMPPKC8W64iLgpq0i5ALudBF/TP94HTXa5gI06xgSYXcGCRZj6hitoocf8seACQl1
  46689. ThCojz2GuHURwCRiipZ7SkXp7FnFvmuD5uHorLUwHv4FB4D54SMNUI8FmP8sX+g7tq3PgbUhh8oI
  46690. KiMnMCArz+2UW6yyetLHKKGKC5tNSixthT8Jcjxn4tncB7rrZXtaAWPWkFtPF2Y9fwsZo5NjEFIq
  46691. nxQWWOLcpfShFosOkYuByptZ+thrkQdlVV9SH686+5DdaaVbnG0OLLb6zqylfDJKZ0DcMDQj3dcE
  46692. I2bw/FWAp/tmGYI1Z2JwOV5vx+qQQEQIHriy1tvuWacNGHk0vFQYXlPKNFHtRQrmjseCNj6nOGOp
  46693. MCwXEGCSn1WHElkQwg9naRHMTh5+Spqtr0CodaxWkHS4oJyleW/c6RrIaQXpuvoDs3zk4E7Czp3o
  46694. tkYNbn5XOmeUwssfnHdKZ05phkOTOPu220+DkdRgfks+KzgHVZhepA==
  46695. -----END CERTIFICATE-----
  46696. Microsec e-Szigno Root CA 2009
  46697. ==============================
  46698. -----BEGIN CERTIFICATE-----
  46699. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  46700. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  46701. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  46702. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  46703. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  46704. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  46705. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  46706. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  46707. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  46708. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  46709. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  46710. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  46711. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  46712. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  46713. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  46714. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  46715. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  46716. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  46717. LXpUq3DDfSJlgnCW
  46718. -----END CERTIFICATE-----
  46719. GlobalSign Root CA - R3
  46720. =======================
  46721. -----BEGIN CERTIFICATE-----
  46722. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  46723. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  46724. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  46725. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  46726. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  46727. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  46728. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  46729. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  46730. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  46731. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  46732. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  46733. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  46734. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  46735. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  46736. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  46737. kpeDMdmztcpHWD9f
  46738. -----END CERTIFICATE-----
  46739. Autoridad de Certificacion Firmaprofesional CIF A62634068
  46740. =========================================================
  46741. -----BEGIN CERTIFICATE-----
  46742. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  46743. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  46744. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  46745. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  46746. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  46747. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  46748. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  46749. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  46750. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  46751. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  46752. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  46753. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  46754. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  46755. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  46756. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  46757. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  46758. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  46759. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  46760. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  46761. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  46762. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  46763. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  46764. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  46765. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  46766. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  46767. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  46768. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  46769. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  46770. -----END CERTIFICATE-----
  46771. Izenpe.com
  46772. ==========
  46773. -----BEGIN CERTIFICATE-----
  46774. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  46775. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  46776. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  46777. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  46778. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  46779. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  46780. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  46781. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  46782. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  46783. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  46784. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  46785. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  46786. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  46787. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  46788. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  46789. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  46790. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  46791. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  46792. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  46793. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  46794. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  46795. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  46796. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  46797. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  46798. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  46799. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  46800. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  46801. -----END CERTIFICATE-----
  46802. Chambers of Commerce Root - 2008
  46803. ================================
  46804. -----BEGIN CERTIFICATE-----
  46805. MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
  46806. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  46807. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  46808. QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
  46809. Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
  46810. ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
  46811. EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
  46812. cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
  46813. AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
  46814. XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
  46815. h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
  46816. ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
  46817. NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
  46818. D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
  46819. lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
  46820. 0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
  46821. ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
  46822. EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
  46823. G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
  46824. BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
  46825. bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
  46826. bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
  46827. CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
  46828. AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
  46829. wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
  46830. 3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
  46831. RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
  46832. M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
  46833. YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
  46834. 9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
  46835. zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
  46836. nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
  46837. OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
  46838. -----END CERTIFICATE-----
  46839. Global Chambersign Root - 2008
  46840. ==============================
  46841. -----BEGIN CERTIFICATE-----
  46842. MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
  46843. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  46844. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  46845. QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
  46846. NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
  46847. Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
  46848. QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
  46849. aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
  46850. VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
  46851. XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
  46852. ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
  46853. /gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
  46854. TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
  46855. H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
  46856. Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
  46857. HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
  46858. wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
  46859. AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
  46860. BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
  46861. BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
  46862. aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
  46863. aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
  46864. 1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
  46865. dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
  46866. /5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
  46867. ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
  46868. dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
  46869. 9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
  46870. foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
  46871. qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
  46872. P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
  46873. c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
  46874. 09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
  46875. -----END CERTIFICATE-----
  46876. Go Daddy Root Certificate Authority - G2
  46877. ========================================
  46878. -----BEGIN CERTIFICATE-----
  46879. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  46880. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  46881. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  46882. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  46883. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  46884. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  46885. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  46886. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  46887. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  46888. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  46889. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  46890. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  46891. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  46892. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  46893. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  46894. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  46895. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  46896. -----END CERTIFICATE-----
  46897. Starfield Root Certificate Authority - G2
  46898. =========================================
  46899. -----BEGIN CERTIFICATE-----
  46900. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  46901. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  46902. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  46903. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  46904. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  46905. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  46906. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  46907. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  46908. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  46909. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  46910. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  46911. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  46912. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  46913. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  46914. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  46915. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  46916. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  46917. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  46918. -----END CERTIFICATE-----
  46919. Starfield Services Root Certificate Authority - G2
  46920. ==================================================
  46921. -----BEGIN CERTIFICATE-----
  46922. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  46923. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  46924. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  46925. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  46926. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  46927. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  46928. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  46929. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  46930. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  46931. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  46932. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  46933. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  46934. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  46935. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  46936. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  46937. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  46938. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  46939. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  46940. -----END CERTIFICATE-----
  46941. AffirmTrust Commercial
  46942. ======================
  46943. -----BEGIN CERTIFICATE-----
  46944. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  46945. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  46946. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  46947. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  46948. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  46949. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  46950. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  46951. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  46952. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  46953. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  46954. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  46955. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  46956. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  46957. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  46958. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  46959. -----END CERTIFICATE-----
  46960. AffirmTrust Networking
  46961. ======================
  46962. -----BEGIN CERTIFICATE-----
  46963. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  46964. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  46965. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  46966. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  46967. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  46968. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  46969. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  46970. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  46971. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  46972. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  46973. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  46974. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  46975. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  46976. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  46977. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  46978. -----END CERTIFICATE-----
  46979. AffirmTrust Premium
  46980. ===================
  46981. -----BEGIN CERTIFICATE-----
  46982. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  46983. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  46984. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  46985. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  46986. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  46987. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  46988. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  46989. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  46990. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  46991. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  46992. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  46993. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  46994. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  46995. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  46996. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  46997. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  46998. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  46999. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  47000. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  47001. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  47002. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  47003. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  47004. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  47005. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  47006. -----END CERTIFICATE-----
  47007. AffirmTrust Premium ECC
  47008. =======================
  47009. -----BEGIN CERTIFICATE-----
  47010. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  47011. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  47012. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  47013. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  47014. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  47015. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  47016. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  47017. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  47018. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  47019. eQ==
  47020. -----END CERTIFICATE-----
  47021. Certum Trusted Network CA
  47022. =========================
  47023. -----BEGIN CERTIFICATE-----
  47024. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  47025. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  47026. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  47027. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  47028. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  47029. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  47030. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  47031. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  47032. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  47033. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  47034. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  47035. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  47036. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  47037. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  47038. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  47039. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  47040. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  47041. -----END CERTIFICATE-----
  47042. Certinomis - Autorité Racine
  47043. =============================
  47044. -----BEGIN CERTIFICATE-----
  47045. MIIFnDCCA4SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
  47046. Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxJjAkBgNVBAMMHUNlcnRpbm9taXMg
  47047. LSBBdXRvcml0w6kgUmFjaW5lMB4XDTA4MDkxNzA4Mjg1OVoXDTI4MDkxNzA4Mjg1OVowYzELMAkG
  47048. A1UEBhMCRlIxEzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMSYw
  47049. JAYDVQQDDB1DZXJ0aW5vbWlzIC0gQXV0b3JpdMOpIFJhY2luZTCCAiIwDQYJKoZIhvcNAQEBBQAD
  47050. ggIPADCCAgoCggIBAJ2Fn4bT46/HsmtuM+Cet0I0VZ35gb5j2CN2DpdUzZlMGvE5x4jYF1AMnmHa
  47051. wE5V3udauHpOd4cN5bjr+p5eex7Ezyh0x5P1FMYiKAT5kcOrJ3NqDi5N8y4oH3DfVS9O7cdxbwly
  47052. Lu3VMpfQ8Vh30WC8Tl7bmoT2R2FFK/ZQpn9qcSdIhDWerP5pqZ56XjUl+rSnSTV3lqc2W+HN3yNw
  47053. 2F1MpQiD8aYkOBOo7C+ooWfHpi2GR+6K/OybDnT0K0kCe5B1jPyZOQE51kqJ5Z52qz6WKDgmi92N
  47054. jMD2AR5vpTESOH2VwnHu7XSu5DaiQ3XV8QCb4uTXzEIDS3h65X27uK4uIJPT5GHfceF2Z5c/tt9q
  47055. c1pkIuVC28+BA5PY9OMQ4HL2AHCs8MF6DwV/zzRpRbWT5BnbUhYjBYkOjUjkJW+zeL9i9Qf6lSTC
  47056. lrLooyPCXQP8w9PlfMl1I9f09bze5N/NgL+RiH2nE7Q5uiy6vdFrzPOlKO1Enn1So2+WLhl+HPNb
  47057. xxaOu2B9d2ZHVIIAEWBsMsGoOBvrbpgT1u449fCfDu/+MYHB0iSVL1N6aaLwD4ZFjliCK0wi1F6g
  47058. 530mJ0jfJUaNSih8hp75mxpZuWW/Bd22Ql095gBIgl4g9xGC3srYn+Y3RyYe63j3YcNBZFgCQfna
  47059. 4NH4+ej9Uji29YnfAgMBAAGjWzBZMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G
  47060. A1UdDgQWBBQNjLZh2kS40RR9w759XkjwzspqsDAXBgNVHSAEEDAOMAwGCiqBegFWAgIAAQEwDQYJ
  47061. KoZIhvcNAQEFBQADggIBACQ+YAZ+He86PtvqrxyaLAEL9MW12Ukx9F1BjYkMTv9sov3/4gbIOZ/x
  47062. WqndIlgVqIrTseYyCYIDbNc/CMf4uboAbbnW/FIyXaR/pDGUu7ZMOH8oMDX/nyNTt7buFHAAQCva
  47063. R6s0fl6nVjBhK4tDrP22iCj1a7Y+YEq6QpA0Z43q619FVDsXrIvkxmUP7tCMXWY5zjKn2BCXwH40
  47064. nJ+U8/aGH88bc62UeYdocMMzpXDn2NU4lG9jeeu/Cg4I58UvD0KgKxRA/yHgBcUn4YQRE7rWhh1B
  47065. CxMjidPJC+iKunqjo3M3NYB9Ergzd0A4wPpeMNLytqOx1qKVl4GbUu1pTP+A5FPbVFsDbVRfsbjv
  47066. JL1vnxHDx2TCDyhihWZeGnuyt++uNckZM6i4J9szVb9o4XVIRFb7zdNIu0eJOqxp9YDG5ERQL1TE
  47067. qkPFMTFYvZbF6nVsmnWxTfj3l/+WFvKXTej28xH5On2KOG4Ey+HTRRWqpdEdnV1j6CTmNhTih60b
  47068. WfVEm/vXd3wfAXBioSAaosUaKPQhA+4u2cGA6rnZgtZbdsLLO7XSAPCjDuGtbkD326C00EauFddE
  47069. wk01+dIL8hf2rGbVJLJP0RyZwG71fet0BLj5TXcJ17TPBzAJ8bgAVtkXFhYKK4bfjwEZGuW7gmP/
  47070. vgt2Fl43N+bYdJeimUV5
  47071. -----END CERTIFICATE-----
  47072. Root CA Generalitat Valenciana
  47073. ==============================
  47074. -----BEGIN CERTIFICATE-----
  47075. MIIGizCCBXOgAwIBAgIEO0XlaDANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJFUzEfMB0GA1UE
  47076. ChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290
  47077. IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwHhcNMDEwNzA2MTYyMjQ3WhcNMjEwNzAxMTUyMjQ3
  47078. WjBoMQswCQYDVQQGEwJFUzEfMB0GA1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UE
  47079. CxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwggEiMA0G
  47080. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGKqtXETcvIorKA3Qdyu0togu8M1JAJke+WmmmO3I2
  47081. F0zo37i7L3bhQEZ0ZQKQUgi0/6iMweDHiVYQOTPvaLRfX9ptI6GJXiKjSgbwJ/BXufjpTjJ3Cj9B
  47082. ZPPrZe52/lSqfR0grvPXdMIKX/UIKFIIzFVd0g/bmoGlu6GzwZTNVOAydTGRGmKy3nXiz0+J2ZGQ
  47083. D0EbtFpKd71ng+CT516nDOeB0/RSrFOyA8dEJvt55cs0YFAQexvba9dHq198aMpunUEDEO5rmXte
  47084. JajCq+TA81yc477OMUxkHl6AovWDfgzWyoxVjr7gvkkHD6MkQXpYHYTqWBLI4bft75PelAgxAgMB
  47085. AAGjggM7MIIDNzAyBggrBgEFBQcBAQQmMCQwIgYIKwYBBQUHMAGGFmh0dHA6Ly9vY3NwLnBraS5n
  47086. dmEuZXMwEgYDVR0TAQH/BAgwBgEB/wIBAjCCAjQGA1UdIASCAiswggInMIICIwYKKwYBBAG/VQIB
  47087. ADCCAhMwggHoBggrBgEFBQcCAjCCAdoeggHWAEEAdQB0AG8AcgBpAGQAYQBkACAAZABlACAAQwBl
  47088. AHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAFIAYQDtAHoAIABkAGUAIABsAGEAIABHAGUAbgBlAHIA
  47089. YQBsAGkAdABhAHQAIABWAGEAbABlAG4AYwBpAGEAbgBhAC4ADQAKAEwAYQAgAEQAZQBjAGwAYQBy
  47090. AGEAYwBpAPMAbgAgAGQAZQAgAFAAcgDhAGMAdABpAGMAYQBzACAAZABlACAAQwBlAHIAdABpAGYA
  47091. aQBjAGEAYwBpAPMAbgAgAHEAdQBlACAAcgBpAGcAZQAgAGUAbAAgAGYAdQBuAGMAaQBvAG4AYQBt
  47092. AGkAZQBuAHQAbwAgAGQAZQAgAGwAYQAgAHAAcgBlAHMAZQBuAHQAZQAgAEEAdQB0AG8AcgBpAGQA
  47093. YQBkACAAZABlACAAQwBlAHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAHMAZQAgAGUAbgBjAHUAZQBu
  47094. AHQAcgBhACAAZQBuACAAbABhACAAZABpAHIAZQBjAGMAaQDzAG4AIAB3AGUAYgAgAGgAdAB0AHAA
  47095. OgAvAC8AdwB3AHcALgBwAGsAaQAuAGcAdgBhAC4AZQBzAC8AYwBwAHMwJQYIKwYBBQUHAgEWGWh0
  47096. dHA6Ly93d3cucGtpLmd2YS5lcy9jcHMwHQYDVR0OBBYEFHs100DSHHgZZu90ECjcPk+yeAT8MIGV
  47097. BgNVHSMEgY0wgYqAFHs100DSHHgZZu90ECjcPk+yeAT8oWykajBoMQswCQYDVQQGEwJFUzEfMB0G
  47098. A1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5S
  47099. b290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmGCBDtF5WgwDQYJKoZIhvcNAQEFBQADggEBACRh
  47100. TvW1yEICKrNcda3FbcrnlD+laJWIwVTAEGmiEi8YPyVQqHxK6sYJ2fR1xkDar1CdPaUWu20xxsdz
  47101. Ckj+IHLtb8zog2EWRpABlUt9jppSCS/2bxzkoXHPjCpaF3ODR00PNvsETUlR4hTJZGH71BTg9J63
  47102. NI8KJr2XXPR5OkowGcytT6CYirQxlyric21+eLj4iIlPsSKRZEv1UN4D2+XFducTZnV+ZfsBn5OH
  47103. iJ35Rld8TWCvmHMTI6QgkYH60GFmuH3Rr9ZvHmw96RH9qfmCIoaZM3Fa6hlXPZHNqcCjbgcTpsnt
  47104. +GijnsNacgmHKNHEc8RzGF9QdRYxn7fofMM=
  47105. -----END CERTIFICATE-----
  47106. TWCA Root Certification Authority
  47107. =================================
  47108. -----BEGIN CERTIFICATE-----
  47109. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  47110. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  47111. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  47112. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  47113. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  47114. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  47115. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  47116. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  47117. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  47118. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  47119. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  47120. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  47121. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  47122. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  47123. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  47124. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  47125. -----END CERTIFICATE-----
  47126. Security Communication RootCA2
  47127. ==============================
  47128. -----BEGIN CERTIFICATE-----
  47129. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  47130. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  47131. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  47132. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  47133. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  47134. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  47135. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  47136. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  47137. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  47138. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  47139. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  47140. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  47141. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  47142. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  47143. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  47144. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  47145. -----END CERTIFICATE-----
  47146. EC-ACC
  47147. ======
  47148. -----BEGIN CERTIFICATE-----
  47149. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  47150. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  47151. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  47152. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  47153. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  47154. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  47155. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  47156. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  47157. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  47158. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  47159. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  47160. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  47161. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  47162. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  47163. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  47164. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  47165. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  47166. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  47167. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  47168. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  47169. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  47170. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  47171. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  47172. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  47173. 5EI=
  47174. -----END CERTIFICATE-----
  47175. Hellenic Academic and Research Institutions RootCA 2011
  47176. =======================================================
  47177. -----BEGIN CERTIFICATE-----
  47178. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  47179. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  47180. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  47181. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  47182. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  47183. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  47184. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  47185. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  47186. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  47187. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  47188. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  47189. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  47190. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  47191. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  47192. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  47193. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  47194. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  47195. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  47196. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  47197. -----END CERTIFICATE-----
  47198. Actalis Authentication Root CA
  47199. ==============================
  47200. -----BEGIN CERTIFICATE-----
  47201. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  47202. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  47203. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  47204. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  47205. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  47206. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  47207. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  47208. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  47209. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  47210. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  47211. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  47212. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  47213. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  47214. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  47215. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  47216. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  47217. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  47218. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  47219. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  47220. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  47221. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  47222. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  47223. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  47224. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  47225. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  47226. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  47227. -----END CERTIFICATE-----
  47228. Trustis FPS Root CA
  47229. ===================
  47230. -----BEGIN CERTIFICATE-----
  47231. MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
  47232. EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
  47233. IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
  47234. BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
  47235. KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
  47236. RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
  47237. H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
  47238. cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
  47239. o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
  47240. AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
  47241. BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
  47242. GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
  47243. yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
  47244. 8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
  47245. l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
  47246. iB6XzCGcKQENZetX2fNXlrtIzYE=
  47247. -----END CERTIFICATE-----
  47248. StartCom Certification Authority
  47249. ================================
  47250. -----BEGIN CERTIFICATE-----
  47251. MIIHhzCCBW+gAwIBAgIBLTANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
  47252. U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu
  47253. ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0
  47254. NjM3WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk
  47255. LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg
  47256. U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
  47257. ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y
  47258. o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/
  47259. Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d
  47260. eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt
  47261. 2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z
  47262. 6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ
  47263. osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/
  47264. untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc
  47265. UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT
  47266. 37uMdBNSSwIDAQABo4ICEDCCAgwwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD
  47267. VR0OBBYEFE4L7xqkQFulF2mHMMo0aEPQQa7yMB8GA1UdIwQYMBaAFE4L7xqkQFulF2mHMMo0aEPQ
  47268. Qa7yMIIBWgYDVR0gBIIBUTCCAU0wggFJBgsrBgEEAYG1NwEBATCCATgwLgYIKwYBBQUHAgEWImh0
  47269. dHA6Ly93d3cuc3RhcnRzc2wuY29tL3BvbGljeS5wZGYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cu
  47270. c3RhcnRzc2wuY29tL2ludGVybWVkaWF0ZS5wZGYwgc8GCCsGAQUFBwICMIHCMCcWIFN0YXJ0IENv
  47271. bW1lcmNpYWwgKFN0YXJ0Q29tKSBMdGQuMAMCAQEagZZMaW1pdGVkIExpYWJpbGl0eSwgcmVhZCB0
  47272. aGUgc2VjdGlvbiAqTGVnYWwgTGltaXRhdGlvbnMqIG9mIHRoZSBTdGFydENvbSBDZXJ0aWZpY2F0
  47273. aW9uIEF1dGhvcml0eSBQb2xpY3kgYXZhaWxhYmxlIGF0IGh0dHA6Ly93d3cuc3RhcnRzc2wuY29t
  47274. L3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilTdGFydENvbSBG
  47275. cmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQsFAAOCAgEAjo/n3JR5
  47276. fPGFf59Jb2vKXfuM/gTFwWLRfUKKvFO3lANmMD+x5wqnUCBVJX92ehQN6wQOQOY+2IirByeDqXWm
  47277. N3PH/UvSTa0XQMhGvjt/UfzDtgUx3M2FIk5xt/JxXrAaxrqTi3iSSoX4eA+D/i+tLPfkpLst0OcN
  47278. Org+zvZ49q5HJMqjNTbOx8aHmNrs++myziebiMMEofYLWWivydsQD032ZGNcpRJvkrKTlMeIFw6T
  47279. tn5ii5B/q06f/ON1FE8qMt9bDeD1e5MNq6HPh+GlBEXoPBKlCcWw0bdT82AUuoVpaiF8H3VhFyAX
  47280. e2w7QSlc4axa0c2Mm+tgHRns9+Ww2vl5GKVFP0lDV9LdJNUso/2RjSe15esUBppMeyG7Oq0wBhjA
  47281. 2MFrLH9ZXF2RsXAiV+uKa0hK1Q8p7MZAwC+ITGgBF3f0JBlPvfrhsiAhS90a2Cl9qrjeVOwhVYBs
  47282. HvUwyKMQ5bLmKhQxw4UtjJixhlpPiVktucf3HMiKf8CdBUrmQk9io20ppB+Fq9vlgcitKj1MXVuE
  47283. JnHEhV5xJMqlG2zYYdMa4FTbzrqpMrUi9nNBCV24F10OD5mQ1kfabwo6YigUZ4LZ8dCAWZvLMdib
  47284. D4x3TrVoivJs9iQOLWxwxXPR3hTQcY+203sC9uO41Alua551hDnmfyWl8kgAwKQB2j8=
  47285. -----END CERTIFICATE-----
  47286. StartCom Certification Authority G2
  47287. ===================================
  47288. -----BEGIN CERTIFICATE-----
  47289. MIIFYzCCA0ugAwIBAgIBOzANBgkqhkiG9w0BAQsFADBTMQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
  47290. U3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg
  47291. RzIwHhcNMTAwMTAxMDEwMDAxWhcNMzkxMjMxMjM1OTAxWjBTMQswCQYDVQQGEwJJTDEWMBQGA1UE
  47292. ChMNU3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  47293. dHkgRzIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2iTZbB7cgNr2Cu+EWIAOVeq8O
  47294. o1XJJZlKxdBWQYeQTSFgpBSHO839sj60ZwNq7eEPS8CRhXBF4EKe3ikj1AENoBB5uNsDvfOpL9HG
  47295. 4A/LnooUCri99lZi8cVytjIl2bLzvWXFDSxu1ZJvGIsAQRSCb0AgJnooD/Uefyf3lLE3PbfHkffi
  47296. Aez9lInhzG7TNtYKGXmu1zSCZf98Qru23QumNK9LYP5/Q0kGi4xDuFby2X8hQxfqp0iVAXV16iul
  47297. Q5XqFYSdCI0mblWbq9zSOdIxHWDirMxWRST1HFSr7obdljKF+ExP6JV2tgXdNiNnvP8V4so75qbs
  47298. O+wmETRIjfaAKxojAuuKHDp2KntWFhxyKrOq42ClAJ8Em+JvHhRYW6Vsi1g8w7pOOlz34ZYrPu8H
  47299. vKTlXcxNnw3h3Kq74W4a7I/htkxNeXJdFzULHdfBR9qWJODQcqhaX2YtENwvKhOuJv4KHBnM0D4L
  47300. nMgJLvlblnpHnOl68wVQdJVznjAJ85eCXuaPOQgeWeU1FEIT/wCc976qUM/iUUjXuG+v+E5+M5iS
  47301. FGI6dWPPe/regjupuznixL0sAA7IF6wT700ljtizkC+p2il9Ha90OrInwMEePnWjFqmveiJdnxMa
  47302. z6eg6+OGCtP95paV1yPIN93EfKo2rJgaErHgTuixO/XWb/Ew1wIDAQABo0IwQDAPBgNVHRMBAf8E
  47303. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUS8W0QGutHLOlHGVuRjaJhwUMDrYwDQYJ
  47304. KoZIhvcNAQELBQADggIBAHNXPyzVlTJ+N9uWkusZXn5T50HsEbZH77Xe7XRcxfGOSeD8bpkTzZ+K
  47305. 2s06Ctg6Wgk/XzTQLwPSZh0avZyQN8gMjgdalEVGKua+etqhqaRpEpKwfTbURIfXUfEpY9Z1zRbk
  47306. J4kd+MIySP3bmdCPX1R0zKxnNBFi2QwKN4fRoxdIjtIXHfbX/dtl6/2o1PXWT6RbdejF0mCy2wl+
  47307. JYt7ulKSnj7oxXehPOBKc2thz4bcQ///If4jXSRK9dNtD2IEBVeC2m6kMyV5Sy5UGYvMLD0w6dEG
  47308. /+gyRr61M3Z3qAFdlsHB1b6uJcDJHgoJIIihDsnzb02CVAAgp9KP5DlUFy6NHrgbuxu9mk47EDTc
  47309. nIhT76IxW1hPkWLIwpqazRVdOKnWvvgTtZ8SafJQYqz7Fzf07rh1Z2AQ+4NQ+US1dZxAF7L+/Xld
  47310. blhYXzD8AK6vM8EOTmy6p6ahfzLbOOCxchcKK5HsamMm7YnUeMx0HgX4a/6ManY5Ka5lIxKVCCIc
  47311. l85bBu4M4ru8H0ST9tg4RQUh7eStqxK2A6RCLi3ECToDZ2mEmuFZkIoohdVddLHRDiBYmxOlsGOm
  47312. 7XtH/UVVMKTumtTm4ofvmMkyghEpIrwACjFeLQ/Ajulrso8uBtjRkcfGEvRM/TAXw8HaOFvjqerm
  47313. obp573PYtlNXLfbQ4ddI
  47314. -----END CERTIFICATE-----
  47315. Buypass Class 2 Root CA
  47316. =======================
  47317. -----BEGIN CERTIFICATE-----
  47318. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  47319. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  47320. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  47321. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  47322. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  47323. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  47324. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  47325. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  47326. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  47327. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  47328. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  47329. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  47330. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  47331. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  47332. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  47333. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  47334. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  47335. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  47336. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  47337. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  47338. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  47339. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  47340. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  47341. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  47342. rJgWVqA=
  47343. -----END CERTIFICATE-----
  47344. Buypass Class 3 Root CA
  47345. =======================
  47346. -----BEGIN CERTIFICATE-----
  47347. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  47348. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  47349. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  47350. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  47351. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  47352. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  47353. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  47354. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  47355. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  47356. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  47357. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  47358. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  47359. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  47360. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  47361. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  47362. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  47363. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  47364. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  47365. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  47366. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  47367. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  47368. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  47369. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  47370. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  47371. Cp/HuZc=
  47372. -----END CERTIFICATE-----
  47373. T-TeleSec GlobalRoot Class 3
  47374. ============================
  47375. -----BEGIN CERTIFICATE-----
  47376. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  47377. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  47378. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  47379. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  47380. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  47381. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  47382. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  47383. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  47384. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  47385. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  47386. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  47387. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  47388. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  47389. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  47390. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  47391. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  47392. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  47393. -----END CERTIFICATE-----
  47394. EE Certification Centre Root CA
  47395. ===============================
  47396. -----BEGIN CERTIFICATE-----
  47397. MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
  47398. EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
  47399. dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
  47400. MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
  47401. UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
  47402. ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  47403. DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
  47404. TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
  47405. rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
  47406. 93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
  47407. P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
  47408. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
  47409. MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
  47410. BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
  47411. xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
  47412. lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
  47413. uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
  47414. 3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
  47415. dcGWxZ0=
  47416. -----END CERTIFICATE-----
  47417. TURKTRUST Certificate Services Provider Root 2007
  47418. =================================================
  47419. -----BEGIN CERTIFICATE-----
  47420. MIIEPTCCAyWgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvzE/MD0GA1UEAww2VMOcUktUUlVTVCBF
  47421. bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEP
  47422. MA0GA1UEBwwGQW5rYXJhMV4wXAYDVQQKDFVUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUg
  47423. QmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgQXJhbMSxayAyMDA3MB4X
  47424. DTA3MTIyNTE4MzcxOVoXDTE3MTIyMjE4MzcxOVowgb8xPzA9BgNVBAMMNlTDnFJLVFJVU1QgRWxl
  47425. a3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTELMAkGA1UEBhMCVFIxDzAN
  47426. BgNVBAcMBkFua2FyYTFeMFwGA1UECgxVVMOcUktUUlVTVCBCaWxnaSDEsGxldGnFn2ltIHZlIEJp
  47427. bGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7Fni4gKGMpIEFyYWzEsWsgMjAwNzCCASIw
  47428. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKu3PgqMyKVYFeaK7yc9SrToJdPNM8Ig3BnuiD9N
  47429. YvDdE3ePYakqtdTyuTFYKTsvP2qcb3N2Je40IIDu6rfwxArNK4aUyeNgsURSsloptJGXg9i3phQv
  47430. KUmi8wUG+7RP2qFsmmaf8EMJyupyj+sA1zU511YXRxcw9L6/P8JorzZAwan0qafoEGsIiveGHtya
  47431. KhUG9qPw9ODHFNRRf8+0222vR5YXm3dx2KdxnSQM9pQ/hTEST7ruToK4uT6PIzdezKKqdfcYbwnT
  47432. rqdUKDT74eA7YH2gvnmJhsifLfkKS8RQouf9eRbHegsYz85M733WB2+Y8a+xwXrXgTW4qhe04MsC
  47433. AwEAAaNCMEAwHQYDVR0OBBYEFCnFkKslrxHkYb+j/4hhkeYO/pyBMA4GA1UdDwEB/wQEAwIBBjAP
  47434. BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAQDdr4Ouwo0RSVgrESLFF6QSU2TJ/s
  47435. Px+EnWVUXKgWAkD6bho3hO9ynYYKVZ1WKKxmLNA6VpM0ByWtCLCPyA8JWcqdmBzlVPi5RX9ql2+I
  47436. aE1KBiY3iAIOtsbWcpnOa3faYjGkVh+uX4132l32iPwa2Z61gfAyuOOI0JzzaqC5mxRZNTZPz/OO
  47437. Xl0XrRWV2N2y1RVuAE6zS89mlOTgzbUF2mNXi+WzqtvALhyQRNsaXRik7r4EW5nVcV9VZWRi1aKb
  47438. BFmGyGJ353yCRWo9F7/snXUMrqNvWtMvmDb08PUZqxFdyKbjKlhqQgnDvZImZjINXQhVdP+MmNAK
  47439. poRq0Tl9
  47440. -----END CERTIFICATE-----
  47441. D-TRUST Root Class 3 CA 2 2009
  47442. ==============================
  47443. -----BEGIN CERTIFICATE-----
  47444. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  47445. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  47446. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  47447. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  47448. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  47449. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  47450. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  47451. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  47452. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  47453. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  47454. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  47455. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  47456. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  47457. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  47458. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  47459. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  47460. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  47461. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  47462. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  47463. -----END CERTIFICATE-----
  47464. D-TRUST Root Class 3 CA 2 EV 2009
  47465. =================================
  47466. -----BEGIN CERTIFICATE-----
  47467. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  47468. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  47469. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  47470. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  47471. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  47472. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  47473. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  47474. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  47475. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  47476. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  47477. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  47478. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  47479. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  47480. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  47481. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  47482. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  47483. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  47484. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  47485. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  47486. w9y4AyHqnxbxLFS1
  47487. -----END CERTIFICATE-----
  47488. PSCProcert
  47489. ==========
  47490. -----BEGIN CERTIFICATE-----
  47491. MIIJhjCCB26gAwIBAgIBCzANBgkqhkiG9w0BAQsFADCCAR4xPjA8BgNVBAMTNUF1dG9yaWRhZCBk
  47492. ZSBDZXJ0aWZpY2FjaW9uIFJhaXogZGVsIEVzdGFkbyBWZW5lem9sYW5vMQswCQYDVQQGEwJWRTEQ
  47493. MA4GA1UEBxMHQ2FyYWNhczEZMBcGA1UECBMQRGlzdHJpdG8gQ2FwaXRhbDE2MDQGA1UEChMtU2lz
  47494. dGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMUMwQQYDVQQLEzpTdXBl
  47495. cmludGVuZGVuY2lhIGRlIFNlcnZpY2lvcyBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMSUw
  47496. IwYJKoZIhvcNAQkBFhZhY3JhaXpAc3VzY2VydGUuZ29iLnZlMB4XDTEwMTIyODE2NTEwMFoXDTIw
  47497. MTIyNTIzNTk1OVowgdExJjAkBgkqhkiG9w0BCQEWF2NvbnRhY3RvQHByb2NlcnQubmV0LnZlMQ8w
  47498. DQYDVQQHEwZDaGFjYW8xEDAOBgNVBAgTB01pcmFuZGExKjAoBgNVBAsTIVByb3ZlZWRvciBkZSBD
  47499. ZXJ0aWZpY2Fkb3MgUFJPQ0VSVDE2MDQGA1UEChMtU2lzdGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZp
  47500. Y2FjaW9uIEVsZWN0cm9uaWNhMQswCQYDVQQGEwJWRTETMBEGA1UEAxMKUFNDUHJvY2VydDCCAiIw
  47501. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANW39KOUM6FGqVVhSQ2oh3NekS1wwQYalNo97BVC
  47502. wfWMrmoX8Yqt/ICV6oNEolt6Vc5Pp6XVurgfoCfAUFM+jbnADrgV3NZs+J74BCXfgI8Qhd19L3uA
  47503. 3VcAZCP4bsm+lU/hdezgfl6VzbHvvnpC2Mks0+saGiKLt38GieU89RLAu9MLmV+QfI4tL3czkkoh
  47504. RqipCKzx9hEC2ZUWno0vluYC3XXCFCpa1sl9JcLB/KpnheLsvtF8PPqv1W7/U0HU9TI4seJfxPmO
  47505. EO8GqQKJ/+MMbpfg353bIdD0PghpbNjU5Db4g7ayNo+c7zo3Fn2/omnXO1ty0K+qP1xmk6wKImG2
  47506. 0qCZyFSTXai20b1dCl53lKItwIKOvMoDKjSuc/HUtQy9vmebVOvh+qBa7Dh+PsHMosdEMXXqP+UH
  47507. 0quhJZb25uSgXTcYOWEAM11G1ADEtMo88aKjPvM6/2kwLkDd9p+cJsmWN63nOaK/6mnbVSKVUyqU
  47508. td+tFjiBdWbjxywbk5yqjKPK2Ww8F22c3HxT4CAnQzb5EuE8XL1mv6JpIzi4mWCZDlZTOpx+FIyw
  47509. Bm/xhnaQr/2v/pDGj59/i5IjnOcVdo/Vi5QTcmn7K2FjiO/mpF7moxdqWEfLcU8UC17IAggmosvp
  47510. r2uKGcfLFFb14dq12fy/czja+eevbqQ34gcnAgMBAAGjggMXMIIDEzASBgNVHRMBAf8ECDAGAQH/
  47511. AgEBMDcGA1UdEgQwMC6CD3N1c2NlcnRlLmdvYi52ZaAbBgVghl4CAqASDBBSSUYtRy0yMDAwNDAz
  47512. Ni0wMB0GA1UdDgQWBBRBDxk4qpl/Qguk1yeYVKIXTC1RVDCCAVAGA1UdIwSCAUcwggFDgBStuyId
  47513. xuDSAaj9dlBSk+2YwU2u06GCASakggEiMIIBHjE+MDwGA1UEAxM1QXV0b3JpZGFkIGRlIENlcnRp
  47514. ZmljYWNpb24gUmFpeiBkZWwgRXN0YWRvIFZlbmV6b2xhbm8xCzAJBgNVBAYTAlZFMRAwDgYDVQQH
  47515. EwdDYXJhY2FzMRkwFwYDVQQIExBEaXN0cml0byBDYXBpdGFsMTYwNAYDVQQKEy1TaXN0ZW1hIE5h
  47516. Y2lvbmFsIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExQzBBBgNVBAsTOlN1cGVyaW50ZW5k
  47517. ZW5jaWEgZGUgU2VydmljaW9zIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExJTAjBgkqhkiG
  47518. 9w0BCQEWFmFjcmFpekBzdXNjZXJ0ZS5nb2IudmWCAQowDgYDVR0PAQH/BAQDAgEGME0GA1UdEQRG
  47519. MESCDnByb2NlcnQubmV0LnZloBUGBWCGXgIBoAwMClBTQy0wMDAwMDKgGwYFYIZeAgKgEgwQUklG
  47520. LUotMzE2MzUzNzMtNzB2BgNVHR8EbzBtMEagRKBChkBodHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52
  47521. ZS9sY3IvQ0VSVElGSUNBRE8tUkFJWi1TSEEzODRDUkxERVIuY3JsMCOgIaAfhh1sZGFwOi8vYWNy
  47522. YWl6LnN1c2NlcnRlLmdvYi52ZTA3BggrBgEFBQcBAQQrMCkwJwYIKwYBBQUHMAGGG2h0dHA6Ly9v
  47523. Y3NwLnN1c2NlcnRlLmdvYi52ZTBBBgNVHSAEOjA4MDYGBmCGXgMBAjAsMCoGCCsGAQUFBwIBFh5o
  47524. dHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52ZS9kcGMwDQYJKoZIhvcNAQELBQADggIBACtZ6yKZu4Sq
  47525. T96QxtGGcSOeSwORR3C7wJJg7ODU523G0+1ng3dS1fLld6c2suNUvtm7CpsR72H0xpkzmfWvADmN
  47526. g7+mvTV+LFwxNG9s2/NkAZiqlCxB3RWGymspThbASfzXg0gTB1GEMVKIu4YXx2sviiCtxQuPcD4q
  47527. uxtxj7mkoP3YldmvWb8lK5jpY5MvYB7Eqvh39YtsL+1+LrVPQA3uvFd359m21D+VJzog1eWuq2w1
  47528. n8GhHVnchIHuTQfiSLaeS5UtQbHh6N5+LwUeaO6/u5BlOsju6rEYNxxik6SgMexxbJHmpHmJWhSn
  47529. FFAFTKQAVzAswbVhltw+HoSvOULP5dAssSS830DD7X9jSr3hTxJkhpXzsOfIt+FTvZLm8wyWuevo
  47530. 5pLtp4EJFAv8lXrPj9Y0TzYS3F7RNHXGRoAvlQSMx4bEqCaJqD8Zm4G7UaRKhqsLEQ+xrmNTbSjq
  47531. 3TNWOByyrYDT13K9mmyZY+gAu0F2BbdbmRiKw7gSXFbPVgx96OLP7bx0R/vu0xdOIk9W/1DzLuY5
  47532. poLWccret9W6aAjtmcz9opLLabid+Qqkpj5PkygqYWwHJgD/ll9ohri4zspV4KuxPX+Y1zMOWj3Y
  47533. eMLEYC/HYvBhkdI4sPaeVdtAgAUSM84dkpvRabP/v/GSCmE1P93+hvS84Bpxs2Km
  47534. -----END CERTIFICATE-----
  47535. China Internet Network Information Center EV Certificates Root
  47536. ==============================================================
  47537. -----BEGIN CERTIFICATE-----
  47538. MIID9zCCAt+gAwIBAgIESJ8AATANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMCQ04xMjAwBgNV
  47539. BAoMKUNoaW5hIEludGVybmV0IE5ldHdvcmsgSW5mb3JtYXRpb24gQ2VudGVyMUcwRQYDVQQDDD5D
  47540. aGluYSBJbnRlcm5ldCBOZXR3b3JrIEluZm9ybWF0aW9uIENlbnRlciBFViBDZXJ0aWZpY2F0ZXMg
  47541. Um9vdDAeFw0xMDA4MzEwNzExMjVaFw0zMDA4MzEwNzExMjVaMIGKMQswCQYDVQQGEwJDTjEyMDAG
  47542. A1UECgwpQ2hpbmEgSW50ZXJuZXQgTmV0d29yayBJbmZvcm1hdGlvbiBDZW50ZXIxRzBFBgNVBAMM
  47543. PkNoaW5hIEludGVybmV0IE5ldHdvcmsgSW5mb3JtYXRpb24gQ2VudGVyIEVWIENlcnRpZmljYXRl
  47544. cyBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm35z7r07eKpkQ0H1UN+U8i6y
  47545. jUqORlTSIRLIOTJCBumD1Z9S7eVnAztUwYyZmczpwA//DdmEEbK40ctb3B75aDFk4Zv6dOtouSCV
  47546. 98YPjUesWgbdYavi7NifFy2cyjw1l1VxzUOFsUcW9SxTgHbP0wBkvUCZ3czY28Sf1hNfQYOL+Q2H
  47547. klY0bBoQCxfVWhyXWIQ8hBouXJE0bhlffxdpxWXvayHG1VA6v2G5BY3vbzQ6sm8UY78WO5upKv23
  47548. KzhmBsUs4qpnHkWnjQRmQvaPK++IIGmPMowUc9orhpFjIpryp9vOiYurXccUwVswah+xt54ugQEC
  47549. 7c+WXmPbqOY4twIDAQABo2MwYTAfBgNVHSMEGDAWgBR8cks5x8DbYqVPm6oYNJKiyoOCWTAPBgNV
  47550. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUfHJLOcfA22KlT5uqGDSSosqD
  47551. glkwDQYJKoZIhvcNAQEFBQADggEBACrDx0M3j92tpLIM7twUbY8opJhJywyA6vPtI2Z1fcXTIWd5
  47552. 0XPFtQO3WKwMVC/GVhMPMdoG52U7HW8228gd+f2ABsqjPWYWqJ1MFn3AlUa1UeTiH9fqBk1jjZaM
  47553. 7+czV0I664zBechNdn3e9rG3geCg+aF4RhcaVpjwTj2rHO3sOdwHSPdj/gauwqRcalsyiMXHM4Ws
  47554. ZkJHwlgkmeHlPuV1LI5D1l08eB6olYIpUNHRFrrvwb562bTYzB5MRuF3sTGrvSrIzo9uoV1/A3U0
  47555. 5K2JRVRevq4opbs/eHnrc7MKDf2+yfdWrPa37S+bISnHOLaVxATywy39FCqQmbkHzJ8=
  47556. -----END CERTIFICATE-----
  47557. Swisscom Root CA 2
  47558. ==================
  47559. -----BEGIN CERTIFICATE-----
  47560. MIIF2TCCA8GgAwIBAgIQHp4o6Ejy5e/DfEoeWhhntjANBgkqhkiG9w0BAQsFADBkMQswCQYDVQQG
  47561. EwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0YWwgQ2VydGlmaWNhdGUgU2Vy
  47562. dmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3QgQ0EgMjAeFw0xMTA2MjQwODM4MTRaFw0zMTA2
  47563. MjUwNzM4MTRaMGQxCzAJBgNVBAYTAmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGln
  47564. aXRhbCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAyMIIC
  47565. IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAlUJOhJ1R5tMJ6HJaI2nbeHCOFvErjw0DzpPM
  47566. LgAIe6szjPTpQOYXTKueuEcUMncy3SgM3hhLX3af+Dk7/E6J2HzFZ++r0rk0X2s682Q2zsKwzxNo
  47567. ysjL67XiPS4h3+os1OD5cJZM/2pYmLcX5BtS5X4HAB1f2uY+lQS3aYg5oUFgJWFLlTloYhyxCwWJ
  47568. wDaCFCE/rtuh/bxvHGCGtlOUSbkrRsVPACu/obvLP+DHVxxX6NZp+MEkUp2IVd3Chy50I9AU/SpH
  47569. Wrumnf2U5NGKpV+GY3aFy6//SSj8gO1MedK75MDvAe5QQQg1I3ArqRa0jG6F6bYRzzHdUyYb3y1a
  47570. SgJA/MTAtukxGggo5WDDH8SQjhBiYEQN7Aq+VRhxLKX0srwVYv8c474d2h5Xszx+zYIdkeNL6yxS
  47571. NLCK/RJOlrDrcH+eOfdmQrGrrFLadkBXeyq96G4DsguAhYidDMfCd7Camlf0uPoTXGiTOmekl9Ab
  47572. mbeGMktg2M7v0Ax/lZ9vh0+Hio5fCHyqW/xavqGRn1V9TrALacywlKinh/LTSlDcX3KwFnUey7QY
  47573. Ypqwpzmqm59m2I2mbJYV4+by+PGDYmy7Velhk6M99bFXi08jsJvllGov34zflVEpYKELKeRcVVi3
  47574. qPyZ7iVNTA6z00yPhOgpD/0QVAKFyPnlw4vP5w8CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYw
  47575. HQYDVR0hBBYwFDASBgdghXQBUwIBBgdghXQBUwIBMBIGA1UdEwEB/wQIMAYBAf8CAQcwHQYDVR0O
  47576. BBYEFE0mICKJS9PVpAqhb97iEoHF8TwuMB8GA1UdIwQYMBaAFE0mICKJS9PVpAqhb97iEoHF8Twu
  47577. MA0GCSqGSIb3DQEBCwUAA4ICAQAyCrKkG8t9voJXiblqf/P0wS4RfbgZPnm3qKhyN2abGu2sEzsO
  47578. v2LwnN+ee6FTSA5BesogpxcbtnjsQJHzQq0Qw1zv/2BZf82Fo4s9SBwlAjxnffUy6S8w5X2lejjQ
  47579. 82YqZh6NM4OKb3xuqFp1mrjX2lhIREeoTPpMSQpKwhI3qEAMw8jh0FcNlzKVxzqfl9NX+Ave5XLz
  47580. o9v/tdhZsnPdTSpxsrpJ9csc1fV5yJmz/MFMdOO0vSk3FQQoHt5FRnDsr7p4DooqzgB53MBfGWcs
  47581. a0vvaGgLQ+OswWIJ76bdZWGgr4RVSJFSHMYlkSrQwSIjYVmvRRGFHQEkNI/Ps/8XciATwoCqISxx
  47582. OQ7Qj1zB09GOInJGTB2Wrk9xseEFKZZZ9LuedT3PDTcNYtsmjGOpI99nBjx8Oto0QuFmtEYE3saW
  47583. mA9LSHokMnWRn6z3aOkquVVlzl1h0ydw2Df+n7mvoC5Wt6NlUe07qxS/TFED6F+KBZvuim6c779o
  47584. +sjaC+NCydAXFJy3SuCvkychVSa1ZC+N8f+mQAWFBVzKBxlcCxMoTFh/wqXvRdpg065lYZ1Tg3TC
  47585. rvJcwhbtkj6EPnNgiLx29CzP0H1907he0ZESEOnN3col49XtmS++dYFLJPlFRpTJKSFTnCZFqhMX
  47586. 5OfNeOI5wSsSnqaeG8XmDtkx2Q==
  47587. -----END CERTIFICATE-----
  47588. Swisscom Root EV CA 2
  47589. =====================
  47590. -----BEGIN CERTIFICATE-----
  47591. MIIF4DCCA8igAwIBAgIRAPL6ZOJ0Y9ON/RAdBB92ylgwDQYJKoZIhvcNAQELBQAwZzELMAkGA1UE
  47592. BhMCY2gxETAPBgNVBAoTCFN3aXNzY29tMSUwIwYDVQQLExxEaWdpdGFsIENlcnRpZmljYXRlIFNl
  47593. cnZpY2VzMR4wHAYDVQQDExVTd2lzc2NvbSBSb290IEVWIENBIDIwHhcNMTEwNjI0MDk0NTA4WhcN
  47594. MzEwNjI1MDg0NTA4WjBnMQswCQYDVQQGEwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsT
  47595. HERpZ2l0YWwgQ2VydGlmaWNhdGUgU2VydmljZXMxHjAcBgNVBAMTFVN3aXNzY29tIFJvb3QgRVYg
  47596. Q0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMT3HS9X6lds93BdY7BxUglgRCgz
  47597. o3pOCvrY6myLURYaVa5UJsTMRQdBTxB5f3HSek4/OE6zAMaVylvNwSqD1ycfMQ4jFrclyxy0uYAy
  47598. Xhqdk/HoPGAsp15XGVhRXrwsVgu42O+LgrQ8uMIkqBPHoCE2G3pXKSinLr9xJZDzRINpUKTk4Rti
  47599. GZQJo/PDvO/0vezbE53PnUgJUmfANykRHvvSEaeFGHR55E+FFOtSN+KxRdjMDUN/rhPSays/p8Li
  47600. qG12W0OfvrSdsyaGOx9/5fLoZigWJdBLlzin5M8J0TbDC77aO0RYjb7xnglrPvMyxyuHxuxenPaH
  47601. Za0zKcQvidm5y8kDnftslFGXEBuGCxobP/YCfnvUxVFkKJ3106yDgYjTdLRZncHrYTNaRdHLOdAG
  47602. alNgHa/2+2m8atwBz735j9m9W8E6X47aD0upm50qKGsaCnw8qyIL5XctcfaCNYGu+HuB5ur+rPQa
  47603. m3Rc6I8k9l2dRsQs0h4rIWqDJ2dVSqTjyDKXZpBy2uPUZC5f46Fq9mDU5zXNysRojddxyNMkM3Ox
  47604. bPlq4SjbX8Y96L5V5jcb7STZDxmPX2MYWFCBUWVv8p9+agTnNCRxunZLWB4ZvRVgRaoMEkABnRDi
  47605. xzgHcgplwLa7JSnaFp6LNYth7eVxV4O1PHGf40+/fh6Bn0GXAgMBAAGjgYYwgYMwDgYDVR0PAQH/
  47606. BAQDAgGGMB0GA1UdIQQWMBQwEgYHYIV0AVMCAgYHYIV0AVMCAjASBgNVHRMBAf8ECDAGAQH/AgED
  47607. MB0GA1UdDgQWBBRF2aWBbj2ITY1x0kbBbkUe88SAnTAfBgNVHSMEGDAWgBRF2aWBbj2ITY1x0kbB
  47608. bkUe88SAnTANBgkqhkiG9w0BAQsFAAOCAgEAlDpzBp9SSzBc1P6xXCX5145v9Ydkn+0UjrgEjihL
  47609. j6p7jjm02Vj2e6E1CqGdivdj5eu9OYLU43otb98TPLr+flaYC/NUn81ETm484T4VvwYmneTwkLbU
  47610. wp4wLh/vx3rEUMfqe9pQy3omywC0Wqu1kx+AiYQElY2NfwmTv9SoqORjbdlk5LgpWgi/UOGED1V7
  47611. XwgiG/W9mR4U9s70WBCCswo9GcG/W6uqmdjyMb3lOGbcWAXH7WMaLgqXfIeTK7KK4/HsGOV1timH
  47612. 59yLGn602MnTihdsfSlEvoqq9X46Lmgxk7lq2prg2+kupYTNHAq4Sgj5nPFhJpiTt3tm7JFe3VE/
  47613. 23MPrQRYCd0EApUKPtN236YQHoA96M2kZNEzx5LH4k5E4wnJTsJdhw4Snr8PyQUQ3nqjsTzyP6Wq
  47614. J3mtMX0f/fwZacXduT98zca0wjAefm6S139hdlqP65VNvBFuIXxZN5nQBrz5Bm0yFqXZaajh3DyA
  47615. HmBR3NdUIR7KYndP+tiPsys6DXhyyWhBWkdKwqPrGtcKqzwyVcgKEZzfdNbwQBUdyLmPtTbFr/gi
  47616. uMod89a2GQ+fYWVq6nTIfI/DT11lgh/ZDYnadXL77/FHZxOzyNEZiCcmmpl5fx7kLD977vHeTYuW
  47617. l8PVP3wbI+2ksx0WckNLIOFZfsLorSa/ovc=
  47618. -----END CERTIFICATE-----
  47619. CA Disig Root R1
  47620. ================
  47621. -----BEGIN CERTIFICATE-----
  47622. MIIFaTCCA1GgAwIBAgIJAMMDmu5QkG4oMA0GCSqGSIb3DQEBBQUAMFIxCzAJBgNVBAYTAlNLMRMw
  47623. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  47624. ZyBSb290IFIxMB4XDTEyMDcxOTA5MDY1NloXDTQyMDcxOTA5MDY1NlowUjELMAkGA1UEBhMCU0sx
  47625. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  47626. c2lnIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCqw3j33Jijp1pedxiy
  47627. 3QRkD2P9m5YJgNXoqqXinCaUOuiZc4yd39ffg/N4T0Dhf9Kn0uXKE5Pn7cZ3Xza1lK/oOI7bm+V8
  47628. u8yN63Vz4STN5qctGS7Y1oprFOsIYgrY3LMATcMjfF9DCCMyEtztDK3AfQ+lekLZWnDZv6fXARz2
  47629. m6uOt0qGeKAeVjGu74IKgEH3G8muqzIm1Cxr7X1r5OJeIgpFy4QxTaz+29FHuvlglzmxZcfe+5nk
  47630. CiKxLU3lSCZpq+Kq8/v8kiky6bM+TR8noc2OuRf7JT7JbvN32g0S9l3HuzYQ1VTW8+DiR0jm3hTa
  47631. YVKvJrT1cU/J19IG32PK/yHoWQbgCNWEFVP3Q+V8xaCJmGtzxmjOZd69fwX3se72V6FglcXM6pM6
  47632. vpmumwKjrckWtc7dXpl4fho5frLABaTAgqWjR56M6ly2vGfb5ipN0gTco65F97yLnByn1tUD3AjL
  47633. LhbKXEAz6GfDLuemROoRRRw1ZS0eRWEkG4IupZ0zXWX4Qfkuy5Q/H6MMMSRE7cderVC6xkGbrPAX
  47634. ZcD4XW9boAo0PO7X6oifmPmvTiT6l7Jkdtqr9O3jw2Dv1fkCyC2fg69naQanMVXVz0tv/wQFx1is
  47635. XxYb5dKj6zHbHzMVTdDypVP1y+E9Tmgt2BLdqvLmTZtJ5cUoobqwWsagtQIDAQABo0IwQDAPBgNV
  47636. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUiQq0OJMa5qvum5EY+fU8PjXQ
  47637. 04IwDQYJKoZIhvcNAQEFBQADggIBADKL9p1Kyb4U5YysOMo6CdQbzoaz3evUuii+Eq5FLAR0rBNR
  47638. xVgYZk2C2tXck8An4b58n1KeElb21Zyp9HWc+jcSjxyT7Ff+Bw+r1RL3D65hXlaASfX8MPWbTx9B
  47639. LxyE04nH4toCdu0Jz2zBuByDHBb6lM19oMgY0sidbvW9adRtPTXoHqJPYNcHKfyyo6SdbhWSVhlM
  47640. CrDpfNIZTUJG7L399ldb3Zh+pE3McgODWF3vkzpBemOqfDqo9ayk0d2iLbYq/J8BjuIQscTK5Gfb
  47641. VSUZP/3oNn6z4eGBrxEWi1CXYBmCAMBrTXO40RMHPuq2MU/wQppt4hF05ZSsjYSVPCGvxdpHyN85
  47642. YmLLW1AL14FABZyb7bq2ix4Eb5YgOe2kfSnbSM6C3NQCjR0EMVrHS/BsYVLXtFHCgWzN4funodKS
  47643. ds+xDzdYpPJScWc/DIh4gInByLUfkmO+p3qKViwaqKactV2zY9ATIKHrkWzQjX2v3wvkF7mGnjix
  47644. lAxYjOBVqjtjbZqJYLhkKpLGN/R+Q0O3c+gB53+XD9fyexn9GtePyfqFa3qdnom2piiZk4hA9z7N
  47645. UaPK6u95RyG1/jLix8NRb76AdPCkwzryT+lf3xkK8jsTQ6wxpLPn6/wY1gGp8yqPNg7rtLG8t0zJ
  47646. a7+h89n07eLw4+1knj0vllJPgFOL
  47647. -----END CERTIFICATE-----
  47648. CA Disig Root R2
  47649. ================
  47650. -----BEGIN CERTIFICATE-----
  47651. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  47652. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  47653. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  47654. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  47655. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  47656. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  47657. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  47658. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  47659. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  47660. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  47661. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  47662. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  47663. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  47664. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  47665. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  47666. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  47667. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  47668. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  47669. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  47670. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  47671. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  47672. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  47673. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  47674. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  47675. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  47676. -----END CERTIFICATE-----
  47677. ACCVRAIZ1
  47678. =========
  47679. -----BEGIN CERTIFICATE-----
  47680. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  47681. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  47682. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  47683. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  47684. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  47685. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  47686. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  47687. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  47688. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  47689. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  47690. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  47691. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  47692. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  47693. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  47694. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  47695. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  47696. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  47697. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  47698. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  47699. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  47700. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  47701. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  47702. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  47703. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  47704. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  47705. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  47706. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  47707. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  47708. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  47709. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  47710. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  47711. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  47712. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  47713. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  47714. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  47715. EfbRD0tVNEYqi4Y7
  47716. -----END CERTIFICATE-----
  47717. TWCA Global Root CA
  47718. ===================
  47719. -----BEGIN CERTIFICATE-----
  47720. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  47721. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  47722. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  47723. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  47724. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  47725. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  47726. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  47727. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  47728. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  47729. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  47730. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  47731. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  47732. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  47733. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  47734. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  47735. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  47736. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  47737. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  47738. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  47739. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  47740. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  47741. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  47742. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  47743. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  47744. -----END CERTIFICATE-----
  47745. TeliaSonera Root CA v1
  47746. ======================
  47747. -----BEGIN CERTIFICATE-----
  47748. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  47749. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  47750. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  47751. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  47752. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  47753. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  47754. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  47755. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  47756. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  47757. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  47758. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  47759. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  47760. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  47761. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  47762. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  47763. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  47764. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  47765. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  47766. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  47767. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  47768. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  47769. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  47770. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  47771. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  47772. -----END CERTIFICATE-----
  47773. E-Tugra Certification Authority
  47774. ===============================
  47775. -----BEGIN CERTIFICATE-----
  47776. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  47777. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  47778. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  47779. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  47780. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  47781. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  47782. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  47783. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  47784. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  47785. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  47786. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  47787. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  47788. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  47789. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  47790. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  47791. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  47792. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  47793. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  47794. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  47795. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  47796. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  47797. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  47798. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  47799. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  47800. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  47801. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  47802. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  47803. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  47804. C7TbO6Orb1wdtn7os4I07QZcJA==
  47805. -----END CERTIFICATE-----
  47806. T-TeleSec GlobalRoot Class 2
  47807. ============================
  47808. -----BEGIN CERTIFICATE-----
  47809. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  47810. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  47811. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  47812. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  47813. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  47814. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  47815. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  47816. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  47817. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  47818. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  47819. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  47820. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  47821. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  47822. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  47823. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  47824. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  47825. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  47826. -----END CERTIFICATE-----
  47827. Atos TrustedRoot 2011
  47828. =====================
  47829. -----BEGIN CERTIFICATE-----
  47830. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  47831. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  47832. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  47833. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  47834. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  47835. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  47836. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  47837. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  47838. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  47839. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  47840. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  47841. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  47842. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  47843. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  47844. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  47845. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  47846. -----END CERTIFICATE-----
  47847. QuoVadis Root CA 1 G3
  47848. =====================
  47849. -----BEGIN CERTIFICATE-----
  47850. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  47851. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  47852. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  47853. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  47854. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  47855. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  47856. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  47857. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  47858. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  47859. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  47860. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  47861. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  47862. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  47863. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  47864. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  47865. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  47866. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  47867. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  47868. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  47869. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  47870. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  47871. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  47872. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  47873. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  47874. hMJKzRwuJIczYOXD
  47875. -----END CERTIFICATE-----
  47876. QuoVadis Root CA 2 G3
  47877. =====================
  47878. -----BEGIN CERTIFICATE-----
  47879. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  47880. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  47881. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  47882. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  47883. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  47884. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  47885. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  47886. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  47887. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  47888. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  47889. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  47890. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  47891. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  47892. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  47893. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  47894. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  47895. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  47896. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  47897. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  47898. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  47899. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  47900. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  47901. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  47902. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  47903. O3jtZsSOeWmD3n+M
  47904. -----END CERTIFICATE-----
  47905. QuoVadis Root CA 3 G3
  47906. =====================
  47907. -----BEGIN CERTIFICATE-----
  47908. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  47909. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  47910. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  47911. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  47912. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  47913. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  47914. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  47915. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  47916. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  47917. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  47918. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  47919. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  47920. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  47921. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  47922. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  47923. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  47924. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  47925. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  47926. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  47927. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  47928. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  47929. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  47930. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  47931. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  47932. PpxxVJkES/1Y+Zj0
  47933. -----END CERTIFICATE-----
  47934. DigiCert Assured ID Root G2
  47935. ===========================
  47936. -----BEGIN CERTIFICATE-----
  47937. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  47938. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  47939. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  47940. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  47941. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  47942. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  47943. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  47944. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  47945. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  47946. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  47947. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  47948. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  47949. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  47950. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  47951. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  47952. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  47953. IhNzbM8m9Yop5w==
  47954. -----END CERTIFICATE-----
  47955. DigiCert Assured ID Root G3
  47956. ===========================
  47957. -----BEGIN CERTIFICATE-----
  47958. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  47959. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  47960. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  47961. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  47962. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  47963. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  47964. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  47965. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  47966. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  47967. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  47968. 1vUhZscv6pZjamVFkpUBtA==
  47969. -----END CERTIFICATE-----
  47970. DigiCert Global Root G2
  47971. =======================
  47972. -----BEGIN CERTIFICATE-----
  47973. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  47974. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  47975. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  47976. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  47977. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  47978. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  47979. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  47980. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  47981. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  47982. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  47983. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  47984. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  47985. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  47986. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  47987. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  47988. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  47989. MrY=
  47990. -----END CERTIFICATE-----
  47991. DigiCert Global Root G3
  47992. =======================
  47993. -----BEGIN CERTIFICATE-----
  47994. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  47995. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  47996. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  47997. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  47998. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  47999. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  48000. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  48001. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  48002. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  48003. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  48004. VOKa5Vt8sycX
  48005. -----END CERTIFICATE-----
  48006. DigiCert Trusted Root G4
  48007. ========================
  48008. -----BEGIN CERTIFICATE-----
  48009. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  48010. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  48011. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  48012. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  48013. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  48014. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  48015. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  48016. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  48017. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  48018. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  48019. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  48020. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  48021. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  48022. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  48023. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  48024. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  48025. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  48026. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  48027. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  48028. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  48029. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  48030. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  48031. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  48032. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  48033. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  48034. 82Z+
  48035. -----END CERTIFICATE-----
  48036. WoSign
  48037. ======
  48038. -----BEGIN CERTIFICATE-----
  48039. MIIFdjCCA16gAwIBAgIQXmjWEXGUY1BWAGjzPsnFkTANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQG
  48040. EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxKjAoBgNVBAMTIUNlcnRpZmljYXRpb24g
  48041. QXV0aG9yaXR5IG9mIFdvU2lnbjAeFw0wOTA4MDgwMTAwMDFaFw0zOTA4MDgwMTAwMDFaMFUxCzAJ
  48042. BgNVBAYTAkNOMRowGAYDVQQKExFXb1NpZ24gQ0EgTGltaXRlZDEqMCgGA1UEAxMhQ2VydGlmaWNh
  48043. dGlvbiBBdXRob3JpdHkgb2YgV29TaWduMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA
  48044. vcqNrLiRFVaXe2tcesLea9mhsMMQI/qnobLMMfo+2aYpbxY94Gv4uEBf2zmoAHqLoE1UfcIiePyO
  48045. CbiohdfMlZdLdNiefvAA5A6JrkkoRBoQmTIPJYhTpA2zDxIIFgsDcSccf+Hb0v1naMQFXQoOXXDX
  48046. 2JegvFNBmpGN9J42Znp+VsGQX+axaCA2pIwkLCxHC1l2ZjC1vt7tj/id07sBMOby8w7gLJKA84X5
  48047. KIq0VC6a7fd2/BVoFutKbOsuEo/Uz/4Mx1wdC34FMr5esAkqQtXJTpCzWQ27en7N1QhatH/YHGkR
  48048. +ScPewavVIMYe+HdVHpRaG53/Ma/UkpmRqGyZxq7o093oL5d//xWC0Nyd5DKnvnyOfUNqfTq1+ez
  48049. EC8wQjchzDBwyYaYD8xYTYO7feUapTeNtqwylwA6Y3EkHp43xP901DfA4v6IRmAR3Qg/UDaruHqk
  48050. lWJqbrDKaiFaafPz+x1wOZXzp26mgYmhiMU7ccqjUu6Du/2gd/Tkb+dC221KmYo0SLwX3OSACCK2
  48051. 8jHAPwQ+658geda4BmRkAjHXqc1S+4RFaQkAKtxVi8QGRkvASh0JWzko/amrzgD5LkhLJuYwTKVY
  48052. yrREgk/nkR4zw7CT/xH8gdLKH3Ep3XZPkiWvHYG3Dy+MwwbMLyejSuQOmbp8HkUff6oZRZb9/D0C
  48053. AwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFOFmzw7R
  48054. 8bNLtwYgFP6HEtX2/vs+MA0GCSqGSIb3DQEBBQUAA4ICAQCoy3JAsnbBfnv8rWTjMnvMPLZdRtP1
  48055. LOJwXcgu2AZ9mNELIaCJWSQBnfmvCX0KI4I01fx8cpm5o9dU9OpScA7F9dY74ToJMuYhOZO9sxXq
  48056. T2r09Ys/L3yNWC7F4TmgPsc9SnOeQHrAK2GpZ8nzJLmzbVUsWh2eJXLOC62qx1ViC777Y7NhRCOj
  48057. y+EaDveaBk3e1CNOIZZbOVtXHS9dCF4Jef98l7VNg64N1uajeeAz0JmWAjCnPv/So0M/BVoG6kQC
  48058. 2nz4SNAzqfkHx5Xh9T71XXG68pWpdIhhWeO/yloTunK0jF02h+mmxTwTv97QRCbut+wucPrXnbes
  48059. 5cVAWubXbHssw1abR80LzvobtCHXt2a49CUwi1wNuepnsvRtrtWhnk/Yn+knArAdBtaP4/tIEp9/
  48060. EaEQPkxROpaw0RPxx9gmrjrKkcRpnd8BKWRRb2jaFOwIQZeQjdCygPLPwj2/kWjFgGcexGATVdVh
  48061. mVd8upUPYUk6ynW8yQqTP2cOEvIo4jEbwFcW3wh8GcF+Dx+FHgo2fFt+J7x6v+Db9NpSvd4MVHAx
  48062. kUOVyLzwPt0JfjBkUO1/AaQzZ01oT74V77D2AhGiGxMlOtzCWfHjXEa7ZywCRuoeSKbmW9m1vFGi
  48063. kpbbqsY3Iqb+zCB0oy2pLmvLwIIRIbWTee5Ehr7XHuQe+w==
  48064. -----END CERTIFICATE-----
  48065. WoSign China
  48066. ============
  48067. -----BEGIN CERTIFICATE-----
  48068. MIIFWDCCA0CgAwIBAgIQUHBrzdgT/BtOOzNy0hFIjTANBgkqhkiG9w0BAQsFADBGMQswCQYDVQQG
  48069. EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxGzAZBgNVBAMMEkNBIOayg+mAmuagueiv
  48070. geS5pjAeFw0wOTA4MDgwMTAwMDFaFw0zOTA4MDgwMTAwMDFaMEYxCzAJBgNVBAYTAkNOMRowGAYD
  48071. VQQKExFXb1NpZ24gQ0EgTGltaXRlZDEbMBkGA1UEAwwSQ0Eg5rKD6YCa5qC56K+B5LmmMIICIjAN
  48072. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0EkhHiX8h8EqwqzbdoYGTufQdDTc7WU1/FDWiD+k
  48073. 8H/rD195L4mx/bxjWDeTmzj4t1up+thxx7S8gJeNbEvxUNUqKaqoGXqW5pWOdO2XCld19AXbbQs5
  48074. uQF/qvbW2mzmBeCkTVL829B0txGMe41P/4eDrv8FAxNXUDf+jJZSEExfv5RxadmWPgxDT74wwJ85
  48075. dE8GRV2j1lY5aAfMh09Qd5Nx2UQIsYo06Yms25tO4dnkUkWMLhQfkWsZHWgpLFbE4h4TV2TwYeO5
  48076. Ed+w4VegG63XX9Gv2ystP9Bojg/qnw+LNVgbExz03jWhCl3W6t8Sb8D7aQdGctyB9gQjF+BNdeFy
  48077. b7Ao65vh4YOhn0pdr8yb+gIgthhid5E7o9Vlrdx8kHccREGkSovrlXLp9glk3Kgtn3R46MGiCWOc
  48078. 76DbT52VqyBPt7D3h1ymoOQ3OMdc4zUPLK2jgKLsLl3Az+2LBcLmc272idX10kaO6m1jGx6KyX2m
  48079. +Jzr5dVjhU1zZmkR/sgO9MHHZklTfuQZa/HpelmjbX7FF+Ynxu8b22/8DU0GAbQOXDBGVWCvOGU6
  48080. yke6rCzMRh+yRpY/8+0mBe53oWprfi1tWFxK1I5nuPHa1UaKJ/kR8slC/k7e3x9cxKSGhxYzoacX
  48081. GKUN5AXlK8IrC6KVkLn9YDxOiT7nnO4fuwECAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1Ud
  48082. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFOBNv9ybQV0T6GTwp+kVpOGBwboxMA0GCSqGSIb3DQEBCwUA
  48083. A4ICAQBqinA4WbbaixjIvirTthnVZil6Xc1bL3McJk6jfW+rtylNpumlEYOnOXOvEESS5iVdT2H6
  48084. yAa+Tkvv/vMx/sZ8cApBWNromUuWyXi8mHwCKe0JgOYKOoICKuLJL8hWGSbueBwj/feTZU7n85iY
  48085. r83d2Z5AiDEoOqsuC7CsDCT6eiaY8xJhEPRdF/d+4niXVOKM6Cm6jBAyvd0zaziGfjk9DgNyp115
  48086. j0WKWa5bIW4xRtVZjc8VX90xJc/bYNaBRHIpAlf2ltTW/+op2znFuCyKGo3Oy+dCMYYFaA6eFN0A
  48087. kLppRQjbbpCBhqcqBT/mhDn4t/lXX0ykeVoQDF7Va/81XwVRHmyjdanPUIPTfPRm94KNPQx96N97
  48088. qA4bLJyuQHCH2u2nFoJavjVsIE4iYdm8UXrNemHcSxH5/mc0zy4EZmFcV5cjjPOGG0jfKq+nwf/Y
  48089. jj4Du9gqsPoUJbJRa4ZDhS4HIxaAjUz7tGM7zMN07RujHv41D198HRaG9Q7DlfEvr10lO1Hm13ZB
  48090. ONFLAzkopR6RctR9q5czxNM+4Gm2KHmgCY0c0f9BckgG/Jou5yD5m6Leie2uPAmvylezkolwQOQv
  48091. T8Jwg0DXJCxr5wkf09XHwQj02w47HAcLQxGEIYbpgNR12KvxAmLBsX5VYc8T1yaw15zLKYs4SgsO
  48092. kI26oQ==
  48093. -----END CERTIFICATE-----
  48094. COMODO RSA Certification Authority
  48095. ==================================
  48096. -----BEGIN CERTIFICATE-----
  48097. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  48098. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  48099. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  48100. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  48101. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  48102. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  48103. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  48104. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  48105. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  48106. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  48107. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  48108. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  48109. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  48110. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  48111. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  48112. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  48113. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  48114. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  48115. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  48116. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  48117. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  48118. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  48119. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  48120. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  48121. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  48122. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  48123. LaZRfyHBNVOFBkpdn627G190
  48124. -----END CERTIFICATE-----
  48125. USERTrust RSA Certification Authority
  48126. =====================================
  48127. -----BEGIN CERTIFICATE-----
  48128. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  48129. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  48130. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  48131. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  48132. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  48133. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  48134. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  48135. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  48136. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  48137. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  48138. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  48139. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  48140. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  48141. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  48142. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  48143. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  48144. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  48145. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  48146. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  48147. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  48148. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  48149. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  48150. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  48151. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  48152. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  48153. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  48154. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  48155. -----END CERTIFICATE-----
  48156. USERTrust ECC Certification Authority
  48157. =====================================
  48158. -----BEGIN CERTIFICATE-----
  48159. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  48160. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  48161. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  48162. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  48163. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  48164. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  48165. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  48166. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  48167. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  48168. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  48169. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  48170. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  48171. -----END CERTIFICATE-----
  48172. GlobalSign ECC Root CA - R4
  48173. ===========================
  48174. -----BEGIN CERTIFICATE-----
  48175. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  48176. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  48177. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  48178. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  48179. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  48180. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  48181. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  48182. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  48183. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  48184. -----END CERTIFICATE-----
  48185. GlobalSign ECC Root CA - R5
  48186. ===========================
  48187. -----BEGIN CERTIFICATE-----
  48188. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  48189. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  48190. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  48191. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  48192. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  48193. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  48194. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  48195. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  48196. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  48197. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  48198. -----END CERTIFICATE-----
  48199. Staat der Nederlanden Root CA - G3
  48200. ==================================
  48201. -----BEGIN CERTIFICATE-----
  48202. MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  48203. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  48204. Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC
  48205. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  48206. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y
  48207. olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t
  48208. x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy
  48209. EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K
  48210. Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur
  48211. mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5
  48212. 1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp
  48213. 07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo
  48214. FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE
  48215. 41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB
  48216. AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu
  48217. yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD
  48218. U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq
  48219. KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1
  48220. v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA
  48221. 8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b
  48222. 8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r
  48223. mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq
  48224. 1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI
  48225. JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV
  48226. tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk=
  48227. -----END CERTIFICATE-----
  48228. Staat der Nederlanden EV Root CA
  48229. ================================
  48230. -----BEGIN CERTIFICATE-----
  48231. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  48232. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  48233. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  48234. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  48235. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  48236. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  48237. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  48238. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  48239. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  48240. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  48241. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  48242. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  48243. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  48244. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  48245. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  48246. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  48247. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  48248. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  48249. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  48250. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  48251. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  48252. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  48253. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  48254. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  48255. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  48256. -----END CERTIFICATE-----
  48257. IdenTrust Commercial Root CA 1
  48258. ==============================
  48259. -----BEGIN CERTIFICATE-----
  48260. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  48261. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  48262. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  48263. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  48264. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  48265. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  48266. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  48267. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  48268. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  48269. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  48270. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  48271. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  48272. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  48273. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  48274. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  48275. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  48276. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  48277. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  48278. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  48279. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  48280. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  48281. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  48282. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  48283. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  48284. cGzM7vRX+Bi6hG6H
  48285. -----END CERTIFICATE-----
  48286. IdenTrust Public Sector Root CA 1
  48287. =================================
  48288. -----BEGIN CERTIFICATE-----
  48289. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  48290. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  48291. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  48292. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  48293. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  48294. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  48295. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  48296. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  48297. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  48298. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  48299. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  48300. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  48301. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  48302. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  48303. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  48304. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  48305. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  48306. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  48307. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  48308. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  48309. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  48310. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  48311. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  48312. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  48313. 3Wl9af0AVqW3rLatt8o+Ae+c
  48314. -----END CERTIFICATE-----
  48315. Entrust Root Certification Authority - G2
  48316. =========================================
  48317. -----BEGIN CERTIFICATE-----
  48318. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  48319. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  48320. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  48321. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  48322. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  48323. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  48324. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  48325. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  48326. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  48327. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  48328. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  48329. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  48330. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  48331. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  48332. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  48333. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  48334. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  48335. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  48336. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  48337. e4pIb4tF9g==
  48338. -----END CERTIFICATE-----
  48339. Entrust Root Certification Authority - EC1
  48340. ==========================================
  48341. -----BEGIN CERTIFICATE-----
  48342. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  48343. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  48344. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  48345. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  48346. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  48347. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  48348. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  48349. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  48350. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  48351. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  48352. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  48353. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  48354. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  48355. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  48356. -----END CERTIFICATE-----
  48357. CFCA EV ROOT
  48358. ============
  48359. -----BEGIN CERTIFICATE-----
  48360. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  48361. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  48362. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  48363. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  48364. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  48365. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  48366. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  48367. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  48368. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  48369. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  48370. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  48371. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  48372. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  48373. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  48374. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  48375. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  48376. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  48377. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  48378. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  48379. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  48380. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  48381. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  48382. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  48383. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  48384. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  48385. -----END CERTIFICATE-----
  48386. TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H5
  48387. =========================================================
  48388. -----BEGIN CERTIFICATE-----
  48389. MIIEJzCCAw+gAwIBAgIHAI4X/iQggTANBgkqhkiG9w0BAQsFADCBsTELMAkGA1UEBhMCVFIxDzAN
  48390. BgNVBAcMBkFua2FyYTFNMEsGA1UECgxEVMOcUktUUlVTVCBCaWxnaSDEsGxldGnFn2ltIHZlIEJp
  48391. bGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7Fni4xQjBABgNVBAMMOVTDnFJLVFJVU1Qg
  48392. RWxla3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSBINTAeFw0xMzA0MzAw
  48393. ODA3MDFaFw0yMzA0MjgwODA3MDFaMIGxMQswCQYDVQQGEwJUUjEPMA0GA1UEBwwGQW5rYXJhMU0w
  48394. SwYDVQQKDERUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnE
  48395. n2kgSGl6bWV0bGVyaSBBLsWeLjFCMEAGA1UEAww5VMOcUktUUlVTVCBFbGVrdHJvbmlrIFNlcnRp
  48396. ZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIEg1MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  48397. CgKCAQEApCUZ4WWe60ghUEoI5RHwWrom/4NZzkQqL/7hzmAD/I0Dpe3/a6i6zDQGn1k19uwsu537
  48398. jVJp45wnEFPzpALFp/kRGml1bsMdi9GYjZOHp3GXDSHHmflS0yxjXVW86B8BSLlg/kJK9siArs1m
  48399. ep5Fimh34khon6La8eHBEJ/rPCmBp+EyCNSgBbGM+42WAA4+Jd9ThiI7/PS98wl+d+yG6w8z5UNP
  48400. 9FR1bSmZLmZaQ9/LXMrI5Tjxfjs1nQ/0xVqhzPMggCTTV+wVunUlm+hkS7M0hO8EuPbJbKoCPrZV
  48401. 4jI3X/xml1/N1p7HIL9Nxqw/dV8c7TKcfGkAaZHjIxhT6QIDAQABo0IwQDAdBgNVHQ4EFgQUVpkH
  48402. HtOsDGlktAxQR95DLL4gwPswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZI
  48403. hvcNAQELBQADggEBAJ5FdnsXSDLyOIspve6WSk6BGLFRRyDN0GSxDsnZAdkJzsiZ3GglE9Rc8qPo
  48404. BP5yCccLqh0lVX6Wmle3usURehnmp349hQ71+S4pL+f5bFgWV1Al9j4uPqrtd3GqqpmWRgqujuwq
  48405. URawXs3qZwQcWDD1YIq9pr1N5Za0/EKJAWv2cMhQOQwt1WbZyNKzMrcbGW3LM/nfpeYVhDfwwvJl
  48406. lpKQd/Ct9JDpEXjXk4nAPQu6KfTomZ1yju2dL+6SfaHx/126M2CFYv4HAqGEVka+lgqaE9chTLd8
  48407. B59OTj+RdPsnnRHM3eaxynFNExc5JsUpISuTKWqW+qtB4Uu2NQvAmxU=
  48408. -----END CERTIFICATE-----
  48409. TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H6
  48410. =========================================================
  48411. -----BEGIN CERTIFICATE-----
  48412. MIIEJjCCAw6gAwIBAgIGfaHyZeyKMA0GCSqGSIb3DQEBCwUAMIGxMQswCQYDVQQGEwJUUjEPMA0G
  48413. A1UEBwwGQW5rYXJhMU0wSwYDVQQKDERUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmls
  48414. acWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLjFCMEAGA1UEAww5VMOcUktUUlVTVCBF
  48415. bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIEg2MB4XDTEzMTIxODA5
  48416. MDQxMFoXDTIzMTIxNjA5MDQxMFowgbExCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmExTTBL
  48417. BgNVBAoMRFTDnFJLVFJVU1QgQmlsZ2kgxLBsZXRpxZ9pbSB2ZSBCaWxpxZ9pbSBHw7x2ZW5sacSf
  48418. aSBIaXptZXRsZXJpIEEuxZ4uMUIwQAYDVQQDDDlUw5xSS1RSVVNUIEVsZWt0cm9uaWsgU2VydGlm
  48419. aWthIEhpem1ldCBTYcSfbGF5xLFjxLFzxLEgSDYwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  48420. AoIBAQCdsGjW6L0UlqMACprx9MfMkU1xeHe59yEmFXNRFpQJRwXiM/VomjX/3EsvMsew7eKC5W/a
  48421. 2uqsxgbPJQ1BgfbBOCK9+bGlprMBvD9QFyv26WZV1DOzXPhDIHiTVRZwGTLmiddk671IUP320EED
  48422. wnS3/faAz1vFq6TWlRKb55cTMgPp1KtDWxbtMyJkKbbSk60vbNg9tvYdDjTu0n2pVQ8g9P0pu5Fb
  48423. HH3GQjhtQiht1AH7zYiXSX6484P4tZgvsycLSF5W506jM7NE1qXyGJTtHB6plVxiSvgNZ1GpryHV
  48424. +DKdeboaX+UEVU0TRv/yz3THGmNtwx8XEsMeED5gCLMxAgMBAAGjQjBAMB0GA1UdDgQWBBTdVRcT
  48425. 9qzoSCHK77Wv0QAy7Z6MtTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG
  48426. 9w0BAQsFAAOCAQEAb1gNl0OqFlQ+v6nfkkU/hQu7VtMMUszIv3ZnXuaqs6fvuay0EBQNdH49ba3R
  48427. fdCaqaXKGDsCQC4qnFAUi/5XfldcEQlLNkVS9z2sFP1E34uXI9TDwe7UU5X+LEr+DXCqu4svLcsy
  48428. o4LyVN/Y8t3XSHLuSqMplsNEzm61kod2pLv0kmzOLBQJZo6NrRa1xxsJYTvjIKIDgI6tflEATseW
  48429. hvtDmHd9KMeP2Cpu54Rvl0EpABZeTeIT6lnAY2c6RPuY/ATTMHKm9ocJV612ph1jmv3XZch4gyt1
  48430. O6VbuA1df74jrlZVlFjvH4GMKrLN5ptjnhi85WsGtAuYSyher4hYyw==
  48431. -----END CERTIFICATE-----
  48432. Certinomis - Root CA
  48433. ====================
  48434. -----BEGIN CERTIFICATE-----
  48435. MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
  48436. Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAbBgNVBAMTFENlcnRpbm9taXMg
  48437. LSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMzMTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIx
  48438. EzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRD
  48439. ZXJ0aW5vbWlzIC0gUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQos
  48440. P5L2fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJflLieY6pOo
  48441. d5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQVWZUKxkd8aRi5pwP5ynap
  48442. z8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDFTKWrteoB4owuZH9kb/2jJZOLyKIOSY00
  48443. 8B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09x
  48444. RLWtwHkziOC/7aOgFLScCbAK42C++PhmiM1b8XcF4LVzbsF9Ri6OSyemzTUK/eVNfaoqoynHWmgE
  48445. 6OXWk6RiwsXm9E/G+Z8ajYJJGYrKWUM66A0ywfRMEwNvbqY/kXPLynNvEiCL7sCCeN5LLsJJwx3t
  48446. FvYk9CcbXFcx3FXuqB5vbKziRcxXV4p1VxngtViZSTYxPDMBbRZKzbgqg4SGm/lg0h9tkQPTYKbV
  48447. PZrdd5A9NaSfD171UkRpucC63M9933zZxKyGIjK8e2uR73r4F2iw4lNVYC2vPsKD2NkJK/DAZNuH
  48448. i5HMkesE/Xa0lZrmFAYb1TQdvtj/dBxThZngWVJKYe2InmtJiUZ+IFrZ50rlau7SZRFDAgMBAAGj
  48449. YzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTvkUz1pcMw6C8I
  48450. 6tNxIqSSaHh02TAfBgNVHSMEGDAWgBTvkUz1pcMw6C8I6tNxIqSSaHh02TANBgkqhkiG9w0BAQsF
  48451. AAOCAgEAfj1U2iJdGlg+O1QnurrMyOMaauo++RLrVl89UM7g6kgmJs95Vn6RHJk/0KGRHCwPT5iV
  48452. WVO90CLYiF2cN/z7ZMF4jIuaYAnq1fohX9B0ZedQxb8uuQsLrbWwF6YSjNRieOpWauwK0kDDPAUw
  48453. Pk2Ut59KA9N9J0u2/kTO+hkzGm2kQtHdzMjI1xZSg081lLMSVX3l4kLr5JyTCcBMWwerx20RoFAX
  48454. lCOotQqSD7J6wWAsOMwaplv/8gzjqh8c3LigkyfeY+N/IZ865Z764BNqdeuWXGKRlI5nU7aJ+BIJ
  48455. y29SWwNyhlCVCNSNh4YVH5Uk2KRvms6knZtt0rJ2BobGVgjF6wnaNsIbW0G+YSrjcOa4pvi2WsS9
  48456. Iff/ql+hbHY5ZtbqTFXhADObE5hjyW/QASAJN1LnDE8+zbz1X5YnpyACleAu6AdBBR8Vbtaw5Bng
  48457. DwKTACdyxYvRVB9dSsNAl35VpnzBMwQUAR1JIGkLGZOdblgi90AMRgwjY/M50n92Uaf0yKHxDHYi
  48458. I0ZSKS3io0EHVmmY0gUJvGnHWmHNj4FgFU2A3ZDifcRQ8ow7bkrHxuaAKzyBvBGAFhAn1/DNP3nM
  48459. cyrDflOR1m749fPH0FFNjkulW+YZFzvWgQncItzujrnEj1PhZ7szuIgVRs/taTX/dQ1G885x4cVr
  48460. hkIGuUE=
  48461. -----END CERTIFICATE-----
  48462. OISTE WISeKey Global Root GB CA
  48463. ===============================
  48464. -----BEGIN CERTIFICATE-----
  48465. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  48466. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  48467. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  48468. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  48469. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  48470. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  48471. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  48472. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  48473. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  48474. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  48475. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  48476. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  48477. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  48478. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  48479. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  48480. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  48481. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  48482. -----END CERTIFICATE-----
  48483. Certification Authority of WoSign G2
  48484. ====================================
  48485. -----BEGIN CERTIFICATE-----
  48486. MIIDfDCCAmSgAwIBAgIQayXaioidfLwPBbOxemFFRDANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQG
  48487. EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxLTArBgNVBAMTJENlcnRpZmljYXRpb24g
  48488. QXV0aG9yaXR5IG9mIFdvU2lnbiBHMjAeFw0xNDExMDgwMDU4NThaFw00NDExMDgwMDU4NThaMFgx
  48489. CzAJBgNVBAYTAkNOMRowGAYDVQQKExFXb1NpZ24gQ0EgTGltaXRlZDEtMCsGA1UEAxMkQ2VydGlm
  48490. aWNhdGlvbiBBdXRob3JpdHkgb2YgV29TaWduIEcyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  48491. CgKCAQEAvsXEoCKASU+/2YcRxlPhuw+9YH+v9oIOH9ywjj2X4FA8jzrvZjtFB5sg+OPXJYY1kBai
  48492. XW8wGQiHC38Gsp1ij96vkqVg1CuAmlI/9ZqD6TRay9nVYlzmDuDfBpgOgHzKtB0TiGsOqCR3A9Du
  48493. W/PKaZE1OVbFbeP3PU9ekzgkyhjpJMuSA93MHD0JcOQg5PGurLtzaaNjOg9FD6FKmsLRY6zLEPg9
  48494. 5k4ot+vElbGs/V6r+kHLXZ1L3PR8du9nfwB6jdKgGlxNIuG12t12s9R23164i5jIFFTMaxeSt+BK
  48495. v0mUYQs4kI9dJGwlezt52eJ+na2fmKEG/HgUYFf47oB3sQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  48496. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU+mCp62XF3RYUCE4MD42b4Pdkr2cwDQYJKoZI
  48497. hvcNAQELBQADggEBAFfDejaCnI2Y4qtAqkePx6db7XznPWZaOzG73/MWM5H8fHulwqZm46qwtyeY
  48498. P0nXYGdnPzZPSsvxFPpahygc7Y9BMsaV+X3avXtbwrAh449G3CE4Q3RM+zD4F3LBMvzIkRfEzFg3
  48499. TgvMWvchNSiDbGAtROtSjFA9tWwS1/oJu2yySrHFieT801LYYRf+epSEj3m2M1m6D8QL4nCgS3gu
  48500. +sif/a+RZQp4OBXllxcU3fngLDT4ONCEIgDAFFEYKwLcMFrw6AF8NTojrwjkr6qOKEJJLvD1mTS+
  48501. 7Q9LGOHSJDy7XUe3IfKN0QqZjuNuPq1w4I+5ysxugTH2e5x6eeRncRg=
  48502. -----END CERTIFICATE-----
  48503. CA WoSign ECC Root
  48504. ==================
  48505. -----BEGIN CERTIFICATE-----
  48506. MIICCTCCAY+gAwIBAgIQaEpYcIBr8I8C+vbe6LCQkDAKBggqhkjOPQQDAzBGMQswCQYDVQQGEwJD
  48507. TjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxGzAZBgNVBAMTEkNBIFdvU2lnbiBFQ0MgUm9v
  48508. dDAeFw0xNDExMDgwMDU4NThaFw00NDExMDgwMDU4NThaMEYxCzAJBgNVBAYTAkNOMRowGAYDVQQK
  48509. ExFXb1NpZ24gQ0EgTGltaXRlZDEbMBkGA1UEAxMSQ0EgV29TaWduIEVDQyBSb290MHYwEAYHKoZI
  48510. zj0CAQYFK4EEACIDYgAE4f2OuEMkq5Z7hcK6C62N4DrjJLnSsb6IOsq/Srj57ywvr1FQPEd1bPiU
  48511. t5v8KB7FVMxjnRZLU8HnIKvNrCXSf4/CwVqCXjCLelTOA7WRf6qU0NGKSMyCBSah1VES1ns2o0Iw
  48512. QDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUqv3VWqP2h4syhf3R
  48513. MluARZPzA7gwCgYIKoZIzj0EAwMDaAAwZQIxAOSkhLCB1T2wdKyUpOgOPQB0TKGXa/kNUTyh2Tv0
  48514. Daupn75OcsqF1NnstTJFGG+rrQIwfcf3aWMvoeGY7xMQ0Xk/0f7qO3/eVvSQsRUR2LIiFdAvwyYu
  48515. a/GRspBl9JrmkO5K
  48516. -----END CERTIFICATE-----
  48517. SZAFIR ROOT CA2
  48518. ===============
  48519. -----BEGIN CERTIFICATE-----
  48520. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  48521. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  48522. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  48523. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  48524. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  48525. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  48526. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  48527. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  48528. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  48529. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  48530. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  48531. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  48532. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  48533. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  48534. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  48535. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  48536. -----END CERTIFICATE-----
  48537. Certum Trusted Network CA 2
  48538. ===========================
  48539. -----BEGIN CERTIFICATE-----
  48540. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  48541. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  48542. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  48543. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  48544. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  48545. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  48546. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  48547. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  48548. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  48549. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  48550. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  48551. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  48552. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  48553. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  48554. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  48555. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  48556. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  48557. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  48558. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  48559. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  48560. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  48561. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  48562. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  48563. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  48564. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  48565. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  48566. zAYspsbiDrW5viSP
  48567. -----END CERTIFICATE-----
  48568. <?php
  48569. if (PHP_SAPI !== 'cli') {
  48570. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  48571. }
  48572. require __DIR__.'/../src/bootstrap.php';
  48573. use Composer\Console\Application;
  48574. error_reporting(-1);
  48575. if (function_exists('ini_set')) {
  48576. @ini_set('display_errors', 1);
  48577. $memoryInBytes = function ($value) {
  48578. $unit = strtolower(substr($value, -1, 1));
  48579. $value = (int) $value;
  48580. switch($unit) {
  48581. case 'g':
  48582. $value *= 1024;
  48583. // no break (cumulative multiplier)
  48584. case 'm':
  48585. $value *= 1024;
  48586. // no break (cumulative multiplier)
  48587. case 'k':
  48588. $value *= 1024;
  48589. }
  48590. return $value;
  48591. };
  48592. $memoryLimit = trim(ini_get('memory_limit'));
  48593. // Increase memory_limit if it is lower than 1GB
  48594. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1024) {
  48595. @ini_set('memory_limit', '1G');
  48596. }
  48597. unset($memoryInBytes, $memoryLimit);
  48598. }
  48599. // run the command application
  48600. $application = new Application();
  48601. $application->run();
  48602. Copyright (c) 2016 Nils Adermann, Jordi Boggiano
  48603. Permission is hereby granted, free of charge, to any person obtaining a copy
  48604. of this software and associated documentation files (the "Software"), to deal
  48605. in the Software without restriction, including without limitation the rights
  48606. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  48607. copies of the Software, and to permit persons to whom the Software is furnished
  48608. to do so, subject to the following conditions:
  48609. The above copyright notice and this permission notice shall be included in all
  48610. copies or substantial portions of the Software.
  48611. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  48612. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  48613. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  48614. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  48615. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  48616. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  48617. THE SOFTWARE.
  48618. ôVÞS±+~tPs�
  48619. Et�ÔØO���GBMB